; LLVM IR from MQCPack/mqcPack :: examples/tools (CheckGauInput)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.InputLine = type { ptr, ptr, i32, i32, i32, ptr, ptr }

@Last_Keyword = external dso_local global ptr, align 8
@Last_NonBlank = external dso_local global ptr, align 8
@mqc_Alloc_InputLine.Blank_count = external hidden global i32, align 4
@.str.54 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @mqc_FINDstrINline(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local ptr @mqc_DupString(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
define dso_local ptr @mqc_Alloc_InputLine(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store ptr null, ptr %5, align 8, !tbaa !5
  %6 = call noalias ptr @malloc(i64 noundef 176) #7
  store ptr %6, ptr %5, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %11

9:                                                ; preds = %2
  %10 = call i32 (ptr, ...) @printf(ptr noundef @.str.54)
  call void @exit(i32 noundef 0) #8
  unreachable

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %19

14:                                               ; preds = %11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.InputLine, ptr %15, i32 0, i32 1
  store ptr null, ptr %16, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.InputLine, ptr %17, i32 0, i32 0
  store ptr null, ptr %18, align 8, !tbaa !12
  br label %31

19:                                               ; preds = %11
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.InputLine, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.InputLine, ptr %23, i32 0, i32 0
  store ptr %22, ptr %24, align 8, !tbaa !12
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.InputLine, ptr %26, i32 0, i32 0
  store ptr %25, ptr %27, align 8, !tbaa !12
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.InputLine, ptr %29, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %19, %14
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = call ptr @mqc_DupString(ptr noundef %32, ptr noundef null)
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.InputLine, ptr %34, i32 0, i32 5
  store ptr %33, ptr %35, align 8, !tbaa !13
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  call void @mqc_Remove_Init_WhiteSpace(ptr noundef %36)
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = call ptr @mqc_DupString(ptr noundef %37, ptr noundef null)
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.InputLine, ptr %39, i32 0, i32 6
  store ptr %38, ptr %40, align 8, !tbaa !14
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.InputLine, ptr %41, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  call void @mqc_LOWER(ptr noundef %43)
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.InputLine, ptr %44, i32 0, i32 3
  store i32 0, ptr %45, align 4, !tbaa !15
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.InputLine, ptr %46, i32 0, i32 6
  %48 = load ptr, ptr %47, align 8, !tbaa !14
  %49 = call i64 @strlen(ptr noundef %48) #9
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %51, label %57

51:                                               ; preds = %31
  %52 = load i32, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !16
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !16
  %54 = load i32, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !16
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.InputLine, ptr %55, i32 0, i32 2
  store i32 %54, ptr %56, align 8, !tbaa !17
  br label %83

57:                                               ; preds = %31
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.InputLine, ptr %58, i32 0, i32 2
  store i32 0, ptr %59, align 8, !tbaa !17
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.InputLine, ptr %60, i32 0, i32 4
  store i32 0, ptr %61, align 8, !tbaa !18
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %62, ptr @Last_NonBlank, align 8, !tbaa !5
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.InputLine, ptr %63, i32 0, i32 6
  %65 = load ptr, ptr %64, align 8, !tbaa !14
  %66 = call i32 @strncmp(ptr noundef %65, ptr noundef @.str.55, i64 noundef 1) #9
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %57
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.InputLine, ptr %69, i32 0, i32 3
  store i32 1, ptr %70, align 4, !tbaa !15
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %71, ptr @Last_Keyword, align 8, !tbaa !5
  br label %82

72:                                               ; preds = %57
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.InputLine, ptr %73, i32 0, i32 6
  %75 = load ptr, ptr %74, align 8, !tbaa !14
  %76 = call i32 @mqc_FINDstrINline(ptr noundef @.str.56, ptr noundef %75)
  %77 = icmp ne i32 %76, -1
  br i1 %77, label %78, label %81

78:                                               ; preds = %72
  store i32 0, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !16
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.InputLine, ptr %79, i32 0, i32 4
  store i32 1, ptr %80, align 8, !tbaa !18
  br label %81

81:                                               ; preds = %78, %72
  br label %82

82:                                               ; preds = %81, %68
  br label %83

83:                                               ; preds = %82, %51
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret ptr %84
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_Remove_Init_WhiteSpace(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_LOWER(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind willreturn memory(read) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"InputLine", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !6, i64 32}
!14 = !{!10, !6, i64 40}
!15 = !{!10, !11, i64 20}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 16}
!18 = !{!10, !11, i64 24}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@Last_Keyword = external dso_local local_unnamed_addr global ptr, align 8
@Last_NonBlank = external dso_local local_unnamed_addr global ptr, align 8
@mqc_Alloc_InputLine.Blank_count = external hidden local_unnamed_addr global i32, align 4
@.str.54 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @mqc_FINDstrINline(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @mqc_DupString(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @mqc_Alloc_InputLine(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = tail call noalias dereferenceable_or_null(176) ptr @malloc(i64 noundef 176) #4
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %7

5:                                                ; preds = %2
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.54)
  tail call void @exit(i32 noundef 0) #5
  unreachable

7:                                                ; preds = %2
  %8 = icmp eq ptr %1, null
  br i1 %8, label %11, label %9

9:                                                ; preds = %7
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  store ptr %3, ptr %1, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %7, %9
  %.sink = phi ptr [ %10, %9 ], [ null, %7 ]
  %12 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %1, ptr %12, align 8
  store ptr %.sink, ptr %3, align 8
  %13 = tail call ptr @mqc_DupString(ptr noundef %0, ptr noundef null)
  %14 = getelementptr inbounds i8, ptr %3, i64 32
  store ptr %13, ptr %14, align 8, !tbaa !11
  tail call void @mqc_Remove_Init_WhiteSpace(ptr noundef %0)
  %15 = tail call ptr @mqc_DupString(ptr noundef %0, ptr noundef null)
  %16 = getelementptr inbounds i8, ptr %3, i64 40
  store ptr %15, ptr %16, align 8, !tbaa !12
  tail call void @mqc_LOWER(ptr noundef %15)
  %17 = getelementptr inbounds i8, ptr %3, i64 20
  store i32 0, ptr %17, align 4, !tbaa !13
  %18 = load ptr, ptr %16, align 8, !tbaa !12
  %char0 = load i8, ptr %18, align 1
  %19 = icmp eq i8 %char0, 0
  br i1 %19, label %20, label %24

20:                                               ; preds = %11
  %21 = load i32, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !14
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 %22, ptr %23, align 8, !tbaa !15
  br label %32

24:                                               ; preds = %11
  %25 = getelementptr inbounds i8, ptr %3, i64 16
  store i32 0, ptr %25, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %3, i64 24
  store i32 0, ptr %26, align 8, !tbaa !16
  store ptr %3, ptr @Last_NonBlank, align 8, !tbaa !17
  %lhsc = load i8, ptr %18, align 1
  %rhsc = load i8, ptr @.str.55, align 1
  %27 = icmp eq i8 %lhsc, %rhsc
  br i1 %27, label %28, label %29

28:                                               ; preds = %24
  store i32 1, ptr %17, align 4, !tbaa !13
  store ptr %3, ptr @Last_Keyword, align 8, !tbaa !17
  br label %32

29:                                               ; preds = %24
  %30 = tail call i32 @mqc_FINDstrINline(ptr noundef nonnull @.str.56, ptr noundef nonnull %18)
  %.not = icmp eq i32 %30, -1
  br i1 %.not, label %32, label %31

31:                                               ; preds = %29
  store i32 0, ptr @mqc_Alloc_InputLine.Blank_count, align 4, !tbaa !14
  store i32 1, ptr %26, align 8, !tbaa !16
  br label %32

32:                                               ; preds = %28, %31, %29, %20
  ret ptr %3
}

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_Remove_Init_WhiteSpace(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @mqc_LOWER(ptr noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(0) }
attributes #5 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"InputLine", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 32}
!12 = !{!6, !7, i64 40}
!13 = !{!6, !10, i64 20}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 16}
!16 = !{!6, !10, i64 24}
!17 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass