character(100) a,b,c
character x
read*,a,b,c
x="a"
do
	if(x=="a")then
		if(trim(a)=="")then
        	print"(A)","A"
        	exit
        else
        	x=a(1:1)
            a=a(2:)
       	endif
    else if(x=="b")then
			if(trim(b)=="")then
        		print"(A)","B"
        		exit
        	else
        		x=b(1:1)
            	b=b(2:)
       		endif
	else
		if(trim(c)=="")then
        	print"(A)","C"
        	exit
        else
        	x=c(1:1)
            c=c(2:)
       	endif
    endif
end do
end
; 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.2856f5516231dab14caf4ec0656db7f6 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_7889/source.f\00"
@_QQcl.61 = linkonce constant [1 x i8] c"a"
@_QQcl. = linkonce constant [0 x i8] zeroinitializer
@_QQcl.284129 = 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

define void @_QQmain() local_unnamed_addr {
  %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 { ptr, i64, i32, i8, i8, i8, i8 }, align 8
  %7 = alloca [1 x i8], align 1
  %8 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 3)
  %9 = tail call i1 @_FortranAioInputAscii(ptr %8, ptr nonnull @_QFEa, i64 100)
  %10 = tail call i1 @_FortranAioInputAscii(ptr %8, ptr nonnull @_QFEb, i64 100)
  %11 = tail call i1 @_FortranAioInputAscii(ptr %8, ptr nonnull @_QFEc, i64 100)
  %12 = tail call i32 @_FortranAioEndIoStatement(ptr %8)
  %.unpack = load i8, ptr @_QQcl.61, align 1, !tbaa !3
  store i8 %.unpack, ptr %7, align 1, !tbaa !3
  %.fca.1.gep84 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 1
  %.fca.2.gep85 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 2
  %.fca.3.gep86 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 3
  %.fca.4.gep87 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 4
  %.fca.5.gep88 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 5
  %.fca.6.gep89 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %3, i64 0, i32 6
  %.fca.1.gep51 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 1
  %.fca.2.gep53 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 2
  %.fca.3.gep55 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 3
  %.fca.4.gep57 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 4
  %.fca.5.gep59 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 5
  %.fca.6.gep61 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %4, i64 0, i32 6
  %.fca.1.gep124 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 1
  %.fca.2.gep125 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 2
  %.fca.3.gep126 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 3
  %.fca.4.gep127 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 4
  %.fca.5.gep128 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 5
  %.fca.6.gep129 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %2, i64 0, i32 6
  %.fca.1.gep16 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 1
  %.fca.2.gep18 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 2
  %.fca.3.gep20 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 3
  %.fca.4.gep22 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 4
  %.fca.5.gep24 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 5
  %.fca.6.gep26 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %5, i64 0, i32 6
  %.fca.1.gep173 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 1
  %.fca.2.gep174 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 2
  %.fca.3.gep175 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 3
  %.fca.4.gep176 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 4
  %.fca.5.gep177 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 5
  %.fca.6.gep178 = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %1, i64 0, i32 6
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 1
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 2
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 3
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 4
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 5
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8 }, ptr %6, i64 0, i32 6
  br label %13

.backedge:                                        ; preds = %.loopexit, %.loopexit226, %.loopexit227
  %.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), %.loopexit226 ], [ getelementptr inbounds ([100 x i8], ptr @_QFEc, i64 0, i64 99), %.loopexit227 ]
  store i8 32, ptr %.sink, align 1, !tbaa !3
  br label %13

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

16:                                               ; preds = %13
  store ptr @_QFEa, ptr %1, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep173, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep174, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep175, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep176, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep177, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep178, align 1, !tbaa !7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, 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 %6, ptr nonnull %1, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 5)
  %.fca.0.load = load ptr, ptr %6, 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.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 8)
  %22 = call i1 @_FortranAioOutputAscii(ptr %21, ptr nonnull @_QQcl.41, i64 1)
  br label %43

.loopexit:                                        ; preds = %16
  %23 = load i8, ptr @_QFEa, align 16
  store i8 %23, ptr %7, 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

24:                                               ; preds = %13
  %25 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %7, ptr nonnull @_QQcl.62, i64 1, i64 1)
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %35

27:                                               ; preds = %24
  store ptr @_QFEb, ptr %2, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep124, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep125, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep126, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep127, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep128, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep129, 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.gep18, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep20, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep22, align 1, !tbaa !7
  store i8 2, ptr %.fca.5.gep24, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep26, align 1, !tbaa !7
  %28 = call {} @_FortranATrim(ptr nonnull %5, ptr nonnull %2, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 13)
  %.fca.0.load28 = load ptr, ptr %5, align 8, !tbaa !7
  %.fca.1.load31 = load i64, ptr %.fca.1.gep16, align 8, !tbaa !7
  %29 = call i32 @_FortranACharacterCompareScalar1(ptr %.fca.0.load28, ptr nonnull @_QQcl., i64 %.fca.1.load31, i64 0)
  %30 = icmp eq i32 %29, 0
  call void @free(ptr %.fca.0.load28)
  br i1 %30, label %31, label %.loopexit226

31:                                               ; preds = %27
  %32 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 16)
  %33 = call i1 @_FortranAioOutputAscii(ptr %32, ptr nonnull @_QQcl.42, i64 1)
  br label %43

.loopexit226:                                     ; preds = %27
  %34 = load i8, ptr @_QFEb, align 16
  store i8 %34, ptr %7, 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

35:                                               ; preds = %24
  store ptr @_QFEc, ptr %3, align 8, !tbaa !7
  store i64 100, ptr %.fca.1.gep84, align 8, !tbaa !7
  store i32 20180515, ptr %.fca.2.gep85, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep86, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep87, align 1, !tbaa !7
  store i8 0, ptr %.fca.5.gep88, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep89, 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.gep53, align 8, !tbaa !7
  store i8 0, ptr %.fca.3.gep55, align 4, !tbaa !7
  store i8 40, ptr %.fca.4.gep57, align 1, !tbaa !7
  store i8 2, ptr %.fca.5.gep59, align 2, !tbaa !7
  store i8 0, ptr %.fca.6.gep61, align 1, !tbaa !7
  %36 = call {} @_FortranATrim(ptr nonnull %4, ptr nonnull %3, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 22)
  %.fca.0.load63 = load ptr, ptr %4, align 8, !tbaa !7
  %.fca.1.load66 = load i64, ptr %.fca.1.gep51, align 8, !tbaa !7
  %37 = call i32 @_FortranACharacterCompareScalar1(ptr %.fca.0.load63, ptr nonnull @_QQcl., i64 %.fca.1.load66, i64 0)
  %38 = icmp eq i32 %37, 0
  call void @free(ptr %.fca.0.load63)
  br i1 %38, label %39, label %.loopexit227

39:                                               ; preds = %35
  %40 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.2856f5516231dab14caf4ec0656db7f6, i32 24)
  %41 = call i1 @_FortranAioOutputAscii(ptr %40, ptr nonnull @_QQcl.43, i64 1)
  br label %43

.loopexit227:                                     ; preds = %35
  %42 = load i8, ptr @_QFEc, align 16
  store i8 %42, ptr %7, 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

43:                                               ; preds = %20, %31, %39
  %.sink228 = phi ptr [ %21, %20 ], [ %32, %31 ], [ %40, %39 ]
  %44 = call i32 @_FortranAioEndIoStatement(ptr %.sink228)
  ret void
}

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

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

; 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) #1

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

attributes #0 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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}
