program atcoder
implicit none
character(len=100) :: a, b, c
character :: t

read(*,*) a, b, c

t = a(1:1)
a = a(2:100)

do
	if (t == 'a') then
    	if (trim(a) == '')then
    		write(*,'(a)') 'A'
        	stop
    	end if
    	t = a(1:1)
        a = a(2:100)
	else if (t == 'b') then
    	if (trim(b) == '')then
    		write(*,'(a)') 'B'
        	stop
    	end if
    	t = b(1:1)
        b = b(2:100)
	else
    	if (trim(c) == '')then
    		write(*,'(a)') 'C'
        	stop
    	end if
    	t = c(1:1)
        c = c(2:100)
	end if
end do

end program atcoder
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEa = internal global [100 x i8] undef
@_QFEb = internal global [100 x i8] undef
@_QFEc = internal global [100 x i8] undef
@_QQcl.e80656f6e29eba09cbc428fc57a9c9ce = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7890/source.f\00"
@_QQcl.61 = linkonce constant [1 x i8] c"a"
@_QQcl. = linkonce constant [0 x i8] zeroinitializer
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.41 = linkonce constant [1 x i8] c"A"
@_QQcl.62 = linkonce constant [1 x i8] c"b"
@_QQcl.42 = linkonce constant [1 x i8] c"B"
@_QQcl.43 = linkonce constant [1 x i8] c"C"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
.preheader:
  %0 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %3 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %4 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %5 = alloca { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %6 = alloca [1 x i8], align 1
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 6)
  %8 = tail call i1 @_FortranAioInputAscii(ptr %7, ptr nonnull @_QFEa, i64 100)
  %9 = tail call i1 @_FortranAioInputAscii(ptr %7, ptr nonnull @_QFEb, i64 100)
  %10 = tail call i1 @_FortranAioInputAscii(ptr %7, ptr nonnull @_QFEc, i64 100)
  %11 = tail call i32 @_FortranAioEndIoStatement(ptr %7)
  %12 = load i8, ptr @_QFEa, align 16
  store i8 %12, ptr %6, align 1
  tail call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(99) @_QFEa, ptr noundef nonnull align 1 dereferenceable(99) getelementptr inbounds ([100 x i8], ptr @_QFEa, i64 0, i64 1), i64 99, i1 false)
  store i8 32, ptr getelementptr inbounds ([100 x i8], ptr @_QFEa, i64 0, i64 99), align 1, !tbaa !3
  %.fca.1.gep83 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 1
  %.fca.2.gep84 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 2
  %.fca.3.gep85 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 3
  %.fca.4.gep86 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 4
  %.fca.5.gep87 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 5
  %.fca.6.gep88 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 6
  %.fca.1.gep50 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 1
  %.fca.2.gep52 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 2
  %.fca.3.gep54 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 3
  %.fca.4.gep56 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 4
  %.fca.5.gep58 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 5
  %.fca.6.gep60 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 6
  %.fca.1.gep123 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 1
  %.fca.2.gep124 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 2
  %.fca.3.gep125 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 3
  %.fca.4.gep126 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 4
  %.fca.5.gep127 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 5
  %.fca.6.gep128 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 6
  %.fca.1.gep15 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 1
  %.fca.2.gep17 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 2
  %.fca.3.gep19 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 3
  %.fca.4.gep21 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 4
  %.fca.5.gep23 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 5
  %.fca.6.gep25 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 6
  %.fca.1.gep172 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 1
  %.fca.2.gep173 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 2
  %.fca.3.gep174 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 3
  %.fca.4.gep175 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 4
  %.fca.5.gep176 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 5
  %.fca.6.gep177 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %0, i64 0, i32 6
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 2
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 4
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 5
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 6
  br label %13

.backedge:                                        ; preds = %.loopexit, %.loopexit227, %.loopexit228
  %.sink = phi ptr [ getelementptr inbounds ([100 x i8], ptr @_QFEa, i64 0, i64 99), %.loopexit ], [ getelementptr inbounds ([100 x i8], ptr @_QFEb, i64 0, i64 99), %.loopexit227 ], [ getelementptr inbounds ([100 x i8], ptr @_QFEc, i64 0, i64 99), %.loopexit228 ]
  store i8 32, ptr %.sink, align 1, !tbaa !3
  br label %13

13:                                               ; preds = %.backedge, %.preheader
  %14 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.61, i64 1, i64 1)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %26

16:                                               ; preds = %13
  store ptr @_QFEa, ptr %0, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep172, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep173, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep174, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep175, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep176, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep177, align 1, !tbaa !7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep, align 1, !tbaa !7
  store i8 2, ptr %.fca.5.gep, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %17 = call {} @_FortranATrim(ptr nonnull %5, ptr nonnull %0, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 11)
  %.fca.0.load = load ptr, ptr %5, align 8, !tbaa !7
  %.fca.1.load = load i64, ptr %.fca.1.gep, align 8, !tbaa !7
  %18 = call i32 @_FortranACharacterCompareScalar1(ptr %.fca.0.load, ptr nonnull @_QQcl., i64 %.fca.1.load, i64 0)
  %19 = icmp eq i32 %18, 0
  call void @free(ptr %.fca.0.load)
  br i1 %19, label %20, label %.loopexit

20:                                               ; preds = %16
  %21 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 14)
  %22 = call i1 @_FortranAioOutputAscii(ptr %21, ptr nonnull @_QQcl.41, i64 1)
  %23 = call i32 @_FortranAioEndIoStatement(ptr %21)
  %24 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.loopexit:                                        ; preds = %16
  %25 = load i8, ptr @_QFEa, align 16
  store i8 %25, ptr %6, align 1
  call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(99) @_QFEa, ptr noundef nonnull align 1 dereferenceable(99) getelementptr inbounds ([100 x i8], ptr @_QFEa, i64 0, i64 1), i64 99, i1 false)
  br label %.backedge

26:                                               ; preds = %13
  %27 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.62, i64 1, i64 1)
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %39

29:                                               ; preds = %26
  store ptr @_QFEb, ptr %1, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep123, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep124, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep125, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep126, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep127, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep128, align 1, !tbaa !7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep17, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep19, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep21, align 1, !tbaa !7
  store i8 2, ptr %.fca.5.gep23, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep25, align 1, !tbaa !7
  %30 = call {} @_FortranATrim(ptr nonnull %4, ptr nonnull %1, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 18)
  %.fca.0.load27 = load ptr, ptr %4, align 8, !tbaa !7
  %.fca.1.load30 = load i64, ptr %.fca.1.gep15, align 8, !tbaa !7
  %31 = call i32 @_FortranACharacterCompareScalar1(ptr %.fca.0.load27, ptr nonnull @_QQcl., i64 %.fca.1.load30, i64 0)
  %32 = icmp eq i32 %31, 0
  call void @free(ptr %.fca.0.load27)
  br i1 %32, label %33, label %.loopexit227

33:                                               ; preds = %29
  %34 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 21)
  %35 = call i1 @_FortranAioOutputAscii(ptr %34, ptr nonnull @_QQcl.42, i64 1)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %34)
  %37 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.loopexit227:                                     ; preds = %29
  %38 = load i8, ptr @_QFEb, align 16
  store i8 %38, ptr %6, align 1
  call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(99) @_QFEb, ptr noundef nonnull align 1 dereferenceable(99) getelementptr inbounds ([100 x i8], ptr @_QFEb, i64 0, i64 1), i64 99, i1 false)
  br label %.backedge

39:                                               ; preds = %26
  store ptr @_QFEc, ptr %2, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep83, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep84, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep85, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep86, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep87, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep88, align 1, !tbaa !7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  store i32 20180515, ptr %.fca.2.gep52, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep54, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep56, align 1, !tbaa !7
  store i8 2, ptr %.fca.5.gep58, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep60, align 1, !tbaa !7
  %40 = call {} @_FortranATrim(ptr nonnull %3, ptr nonnull %2, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 26)
  %.fca.0.load62 = load ptr, ptr %3, align 8, !tbaa !7
  %.fca.1.load65 = load i64, ptr %.fca.1.gep50, align 8, !tbaa !7
  %41 = call i32 @_FortranACharacterCompareScalar1(ptr %.fca.0.load62, ptr nonnull @_QQcl., i64 %.fca.1.load65, i64 0)
  %42 = icmp eq i32 %41, 0
  call void @free(ptr %.fca.0.load62)
  br i1 %42, label %43, label %.loopexit228

43:                                               ; preds = %39
  %44 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.e80656f6e29eba09cbc428fc57a9c9ce, i32 28)
  %45 = call i1 @_FortranAioOutputAscii(ptr %44, ptr nonnull @_QQcl.43, i64 1)
  %46 = call i32 @_FortranAioEndIoStatement(ptr %44)
  %47 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

.loopexit228:                                     ; preds = %39
  %48 = load i8, ptr @_QFEc, align 16
  store i8 %48, ptr %6, align 1
  call void @llvm.memmove.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(99) @_QFEc, ptr noundef nonnull align 1 dereferenceable(99) getelementptr inbounds ([100 x i8], ptr @_QFEc, i64 0, i64 1), i64 99, i1 false)
  br label %.backedge
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memmove.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i1 immarg) #2

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

declare {} @_FortranATrim(ptr, ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
