; LLVM IR from KhArtNJava/MySQLConnectorUE4Plugin :: ThirdPartyLibs/mariadb-connector-c/examples (test_output)

; 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"

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [1024 x i8], align 16
  %7 = alloca [1024 x i8], align 16
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1024, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %12 = load i32, ptr %4, align 4, !tbaa !5
  %13 = icmp slt i32 %12, 3
  br i1 %13, label %14, label %16

14:                                               ; preds = %2
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @exit(i32 noundef -1) #6
  unreachable

16:                                               ; preds = %2
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 1
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = call noalias ptr @popen(ptr noundef %19, ptr noundef @.str.1)
  store ptr %20, ptr %8, align 8, !tbaa !9
  %21 = icmp ne ptr %20, null
  br i1 %21, label %27, label %22

22:                                               ; preds = %16
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = getelementptr inbounds ptr, ptr %23, i64 1
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %25)
  call void @exit(i32 noundef -1) #6
  unreachable

27:                                               ; preds = %16
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 2
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = call noalias ptr @fopen(ptr noundef %30, ptr noundef @.str.3)
  store ptr %31, ptr %9, align 8, !tbaa !9
  %32 = icmp ne ptr %31, null
  br i1 %32, label %38, label %33

33:                                               ; preds = %27
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %34, i64 2
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %36)
  call void @exit(i32 noundef -1) #6
  unreachable

38:                                               ; preds = %27
  br label %39

39:                                               ; preds = %44, %38
  %40 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = call ptr @fgets(ptr noundef %40, i32 noundef 8, ptr noundef %41)
  %43 = icmp ne ptr null, %42
  br i1 %43, label %44, label %48

44:                                               ; preds = %39
  %45 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %46 = load ptr, ptr %9, align 8, !tbaa !9
  %47 = call i32 @fputs(ptr noundef %45, ptr noundef %46)
  br label %39, !llvm.loop !11

48:                                               ; preds = %39
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = call i32 @pclose(ptr noundef %49)
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = call i32 @fflush(ptr noundef %51)
  %53 = load ptr, ptr %9, align 8, !tbaa !9
  %54 = call i32 @fclose(ptr noundef %53)
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 3
  br i1 %56, label %57, label %58

57:                                               ; preds = %48
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %103

58:                                               ; preds = %48
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = getelementptr inbounds ptr, ptr %59, i64 3
  %61 = load ptr, ptr %60, align 8, !tbaa !9
  %62 = call noalias ptr @fopen(ptr noundef %61, ptr noundef @.str.1)
  store ptr %62, ptr %10, align 8, !tbaa !9
  %63 = icmp ne ptr %62, null
  br i1 %63, label %65, label %64

64:                                               ; preds = %58
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %103

65:                                               ; preds = %58
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = getelementptr inbounds ptr, ptr %66, i64 2
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = call noalias ptr @fopen(ptr noundef %68, ptr noundef @.str.1)
  store ptr %69, ptr %9, align 8, !tbaa !9
  %70 = icmp ne ptr %69, null
  br i1 %70, label %76, label %71

71:                                               ; preds = %65
  %72 = load ptr, ptr %5, align 8, !tbaa !9
  %73 = getelementptr inbounds ptr, ptr %72, i64 2
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %74)
  call void @exit(i32 noundef -1) #6
  unreachable

76:                                               ; preds = %65
  br label %77

77:                                               ; preds = %96, %76
  %78 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  %79 = load ptr, ptr %10, align 8, !tbaa !9
  %80 = call ptr @fgets(ptr noundef %78, i32 noundef 1023, ptr noundef %79)
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %97

82:                                               ; preds = %77
  %83 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %84 = load ptr, ptr %9, align 8, !tbaa !9
  %85 = call ptr @fgets(ptr noundef %83, i32 noundef 1023, ptr noundef %84)
  %86 = icmp ne ptr %85, null
  br i1 %86, label %89, label %87

87:                                               ; preds = %82
  %88 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %98

89:                                               ; preds = %82
  %90 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %91 = getelementptr inbounds [1024 x i8], ptr %7, i64 0, i64 0
  %92 = call i32 @strcmp(ptr noundef %90, ptr noundef %91) #7
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %89
  %95 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %98

96:                                               ; preds = %89
  br label %77, !llvm.loop !13

97:                                               ; preds = %77
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %103

98:                                               ; preds = %94, %87
  %99 = load ptr, ptr %10, align 8, !tbaa !9
  %100 = call i32 @fclose(ptr noundef %99)
  %101 = load ptr, ptr %9, align 8, !tbaa !9
  %102 = call i32 @fclose(ptr noundef %101)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %103

103:                                              ; preds = %98, %97, %64, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr %6) #5
  %104 = load i32, ptr %3, align 4
  ret i32 %104
}

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

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

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

declare noalias ptr @popen(ptr noundef, ptr noundef) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #2

declare i32 @fputs(ptr noundef, ptr noundef) #2

declare i32 @pclose(ptr noundef) #2

declare i32 @fflush(ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 = { nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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"

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca [1024 x i8], align 16
  %4 = alloca [1024 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #5
  %5 = icmp slt i32 %0, 3
  br i1 %5, label %6, label %8

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

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = tail call noalias ptr @popen(ptr noundef %10, ptr noundef nonnull @.str.1)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %15

12:                                               ; preds = %8
  %13 = load ptr, ptr %9, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %13)
  tail call void @exit(i32 noundef -1) #6
  unreachable

15:                                               ; preds = %8
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = tail call noalias ptr @fopen(ptr noundef %17, ptr noundef nonnull @.str.3)
  %.not21 = icmp eq ptr %18, null
  br i1 %.not21, label %20, label %.preheader28

.preheader28:                                     ; preds = %15
  %19 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 8, ptr noundef nonnull %11)
  %.not2229 = icmp eq ptr %19, null
  br i1 %.not2229, label %._crit_edge, label %.lr.ph

20:                                               ; preds = %15
  %21 = load ptr, ptr %16, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %21)
  tail call void @exit(i32 noundef -1) #6
  unreachable

.lr.ph:                                           ; preds = %.preheader28, %.lr.ph
  %23 = call i32 @fputs(ptr noundef nonnull %3, ptr noundef nonnull %18)
  %24 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 8, ptr noundef nonnull %11)
  %.not22 = icmp eq ptr %24, null
  br i1 %.not22, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader28
  %25 = call i32 @pclose(ptr noundef nonnull %11)
  %26 = call i32 @fflush(ptr noundef nonnull %18)
  %27 = call i32 @fclose(ptr noundef nonnull %18)
  %28 = icmp eq i32 %0, 3
  br i1 %28, label %.loopexit, label %29

29:                                               ; preds = %._crit_edge
  %30 = getelementptr inbounds i8, ptr %1, i64 24
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = call noalias ptr @fopen(ptr noundef %31, ptr noundef nonnull @.str.1)
  %.not23 = icmp eq ptr %32, null
  br i1 %.not23, label %.loopexit, label %33

33:                                               ; preds = %29
  %34 = load ptr, ptr %16, align 8, !tbaa !5
  %35 = call noalias ptr @fopen(ptr noundef %34, ptr noundef nonnull @.str.1)
  %.not24 = icmp eq ptr %35, null
  br i1 %.not24, label %36, label %.preheader

36:                                               ; preds = %33
  %37 = load ptr, ptr %16, align 8, !tbaa !5
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %37)
  call void @exit(i32 noundef -1) #6
  unreachable

.preheader:                                       ; preds = %33, %42
  %39 = call ptr @fgets(ptr noundef nonnull %4, i32 noundef 1023, ptr noundef nonnull %32)
  %.not25 = icmp eq ptr %39, null
  br i1 %.not25, label %.loopexit, label %40

40:                                               ; preds = %.preheader
  %41 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 1023, ptr noundef nonnull %35)
  %.not26 = icmp eq ptr %41, null
  br i1 %.not26, label %44, label %42

42:                                               ; preds = %40
  %43 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) %4) #7
  %.not27 = icmp eq i32 %43, 0
  br i1 %.not27, label %.preheader, label %44, !llvm.loop !11

44:                                               ; preds = %42, %40
  %.str.7.sink = phi ptr [ @.str.6, %40 ], [ @.str.7, %42 ]
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.7.sink)
  %46 = call i32 @fclose(ptr noundef nonnull %32)
  %47 = call i32 @fclose(ptr noundef nonnull %35)
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %29, %._crit_edge, %44
  %.0 = phi i32 [ 1, %44 ], [ 0, %._crit_edge ], [ 0, %29 ], [ 0, %.preheader ]
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #5
  ret i32 %.0
}

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

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

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @popen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @pclose(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { mustprogress nofree nounwind willreturn memory(argmem: 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 = { nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass