; LLVM IR from daanx/mimalloc-bench :: bench/cfrac (cfrac)

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

@verbose = external dso_local global i32, align 4
@debug = external dso_local global i32, align 4
@stdout = external global ptr, align 8
@stderr = external global ptr, align 8
@progName = external dso_local global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [69 x i8], align 1
@optind = external global i32, align 4
@main.argvx = external hidden global [2 x ptr], align 16
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracNabort = external global i32, align 4
@.str.14 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracTsolns = external global i32, align 4
@.str.15 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracT2solns = external global i32, align 4
@.str.16 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracPsolns = external global i32, align 4
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracFsolns = external global i32, align 4
@.str.18 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @psetq(ptr noundef, ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @pdestroy(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr 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 @findk(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #3

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

declare i32 @fputp(ptr noundef, ptr noundef) #4

declare i32 @putc(i32 noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = 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 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1073741824, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store ptr null, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 3, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr @progName, align 8, !tbaa !9
  br label %20

20:                                               ; preds = %47, %2
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = call i32 (i32, ptr, ptr, ...) @getopt(i32 noundef %21, ptr noundef %22, ptr noundef @.str.7)
  store i32 %23, ptr %11, align 4, !tbaa !5
  %24 = icmp ne i32 %23, -1
  br i1 %24, label %25, label %48

25:                                               ; preds = %20
  %26 = load i32, ptr %11, align 4, !tbaa !5
  switch i32 %26, label %42 [
    i32 97, label %27
    i32 107, label %30
    i32 105, label %33
    i32 100, label %36
    i32 118, label %39
  ]

27:                                               ; preds = %25
  %28 = load ptr, ptr @optarg, align 8, !tbaa !9
  %29 = call i32 @atoi(ptr noundef %28)
  store i32 %29, ptr %14, align 4, !tbaa !5
  br label %47

30:                                               ; preds = %25
  %31 = load ptr, ptr @optarg, align 8, !tbaa !9
  %32 = call i32 @atoi(ptr noundef %31)
  store i32 %32, ptr %10, align 4, !tbaa !5
  br label %47

33:                                               ; preds = %25
  %34 = load ptr, ptr @optarg, align 8, !tbaa !9
  %35 = call i32 @atoi(ptr noundef %34)
  store i32 %35, ptr %8, align 4, !tbaa !5
  br label %47

36:                                               ; preds = %25
  %37 = load i32, ptr @debug, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr @debug, align 4, !tbaa !5
  br label %47

39:                                               ; preds = %25
  %40 = load i32, ptr @verbose, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr @verbose, align 4, !tbaa !5
  br label %47

42:                                               ; preds = %25
  br label %43

43:                                               ; preds = %65, %42
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = load ptr, ptr @progName, align 8, !tbaa !9
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.8, ptr noundef %45) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %182

47:                                               ; preds = %39, %36, %33, %30, %27
  br label %20, !llvm.loop !11

48:                                               ; preds = %20
  %49 = load i32, ptr @optind, align 4, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sub nsw i32 %50, %49
  store i32 %51, ptr %4, align 4, !tbaa !5
  %52 = load i32, ptr @optind, align 4, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds ptr, ptr %53, i64 %54
  store ptr %55, ptr %5, align 8, !tbaa !9
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %48
  store i32 1, ptr %4, align 4, !tbaa !5
  store ptr @main.argvx, ptr %5, align 8, !tbaa !9
  br label %59

59:                                               ; preds = %58, %48
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = icmp slt i32 %60, 1
  br i1 %61, label %65, label %62

62:                                               ; preds = %59
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 3
  br i1 %64, label %65, label %66

65:                                               ; preds = %62, %59
  br label %43

66:                                               ; preds = %62
  %67 = load ptr, ptr %5, align 8, !tbaa !9
  %68 = getelementptr inbounds ptr, ptr %67, i32 1
  store ptr %68, ptr %5, align 8, !tbaa !9
  %69 = load ptr, ptr %67, align 8, !tbaa !9
  %70 = call ptr @atop(ptr noundef %69)
  %71 = call ptr @psetq(ptr noundef %12, ptr noundef %70)
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr %4, align 4, !tbaa !5
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %83

76:                                               ; preds = %66
  %77 = load ptr, ptr %5, align 8, !tbaa !9
  %78 = getelementptr inbounds ptr, ptr %77, i32 1
  store ptr %78, ptr %5, align 8, !tbaa !9
  %79 = load ptr, ptr %77, align 8, !tbaa !9
  %80 = call i32 @atoi(ptr noundef %79)
  store i32 %80, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  store i32 %82, ptr %4, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %76, %66
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %93

86:                                               ; preds = %83
  %87 = load ptr, ptr %5, align 8, !tbaa !9
  %88 = getelementptr inbounds ptr, ptr %87, i32 1
  store ptr %88, ptr %5, align 8, !tbaa !9
  %89 = load ptr, ptr %87, align 8, !tbaa !9
  %90 = call i32 @atoi(ptr noundef %89)
  store i32 %90, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %4, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %86, %83
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %122

96:                                               ; preds = %93
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %110

99:                                               ; preds = %96
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = udiv i32 %100, 2
  %102 = add i32 %101, 5
  store i32 %102, ptr %10, align 4, !tbaa !5
  %103 = load i32, ptr @verbose, align 4, !tbaa !5
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %109

105:                                              ; preds = %99
  %106 = load ptr, ptr @stdout, align 8, !tbaa !9
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.10, i32 noundef %107) #5
  br label %109

109:                                              ; preds = %105, %99
  br label %110

110:                                              ; preds = %109, %96
  %111 = load ptr, ptr %12, align 8, !tbaa !9
  %112 = load i32, ptr %14, align 4, !tbaa !5
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = call i32 @findk(ptr noundef %111, ptr noundef %6, i32 noundef %112, i32 noundef %113)
  store i32 %114, ptr %7, align 4, !tbaa !5
  %115 = load i32, ptr @verbose, align 4, !tbaa !5
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %121

117:                                              ; preds = %110
  %118 = load ptr, ptr @stdout, align 8, !tbaa !9
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.11, i32 noundef %119) #5
  br label %121

121:                                              ; preds = %117, %110
  br label %122

122:                                              ; preds = %121, %93
  %123 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %123, ptr %9, align 4, !tbaa !5
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = load i32, ptr %14, align 4, !tbaa !5
  %127 = call i32 @pcfracInit(i32 noundef %124, i32 noundef %125, i32 noundef %126)
  %128 = load ptr, ptr %12, align 8, !tbaa !9
  %129 = call ptr @pcfrac(ptr noundef %128, ptr noundef %9)
  %130 = call ptr @psetq(ptr noundef %13, ptr noundef %129)
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = sub i32 %131, %132
  store i32 %133, ptr %9, align 4, !tbaa !5
  %134 = load i32, ptr @verbose, align 4, !tbaa !5
  %135 = icmp ne i32 %134, 0
  br i1 %135, label %136, label %157

136:                                              ; preds = %122
  %137 = load ptr, ptr @stdout, align 8, !tbaa !9
  %138 = call i32 @putc(i32 noundef 10, ptr noundef %137)
  %139 = load ptr, ptr @stdout, align 8, !tbaa !9
  %140 = load i32, ptr %9, align 4, !tbaa !5
  %141 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %139, ptr noundef @.str.12, i32 noundef %140) #5
  %142 = load ptr, ptr @stdout, align 8, !tbaa !9
  %143 = load i32, ptr @cfracNabort, align 4, !tbaa !5
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef @.str.13, i32 noundef %143) #5
  %145 = load ptr, ptr @stdout, align 8, !tbaa !9
  %146 = load i32, ptr @cfracTsolns, align 4, !tbaa !5
  %147 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.14, i32 noundef %146) #5
  %148 = load ptr, ptr @stdout, align 8, !tbaa !9
  %149 = load i32, ptr @cfracT2solns, align 4, !tbaa !5
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef @.str.15, i32 noundef %149) #5
  %151 = load ptr, ptr @stdout, align 8, !tbaa !9
  %152 = load i32, ptr @cfracPsolns, align 4, !tbaa !5
  %153 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef @.str.16, i32 noundef %152) #5
  %154 = load ptr, ptr @stdout, align 8, !tbaa !9
  %155 = load i32, ptr @cfracFsolns, align 4, !tbaa !5
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %154, ptr noundef @.str.17, i32 noundef %155) #5
  br label %157

157:                                              ; preds = %136, %122
  %158 = load ptr, ptr %13, align 8, !tbaa !9
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %179

160:                                              ; preds = %157
  %161 = load ptr, ptr @stdout, align 8, !tbaa !9
  %162 = load ptr, ptr %12, align 8, !tbaa !9
  %163 = call i32 @fputp(ptr noundef %161, ptr noundef %162)
  %164 = load ptr, ptr @stdout, align 8, !tbaa !9
  %165 = call i32 @fputs(ptr noundef @.str.18, ptr noundef %164)
  %166 = load ptr, ptr @stdout, align 8, !tbaa !9
  %167 = load ptr, ptr %13, align 8, !tbaa !9
  %168 = call i32 @fputp(ptr noundef %166, ptr noundef %167)
  %169 = load ptr, ptr @stdout, align 8, !tbaa !9
  %170 = call i32 @fputs(ptr noundef @.str.19, ptr noundef %169)
  %171 = load ptr, ptr %12, align 8, !tbaa !9
  %172 = load ptr, ptr %13, align 8, !tbaa !9
  %173 = call ptr @pdivmod(ptr noundef %171, ptr noundef %172, ptr noundef %12, ptr noundef null)
  %174 = load ptr, ptr @stdout, align 8, !tbaa !9
  %175 = load ptr, ptr %12, align 8, !tbaa !9
  %176 = call i32 @fputp(ptr noundef %174, ptr noundef %175)
  %177 = load ptr, ptr @stdout, align 8, !tbaa !9
  %178 = call i32 @putc(i32 noundef 10, ptr noundef %177)
  br label %179

179:                                              ; preds = %160, %157
  %180 = load ptr, ptr %13, align 8, !tbaa !9
  call void @pdestroy(ptr noundef %180)
  %181 = load ptr, ptr %12, align 8, !tbaa !9
  call void @pdestroy(ptr noundef %181)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %17, align 4
  br label %182

182:                                              ; preds = %179, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %183 = load i32, ptr %3, align 4
  ret i32 %183
}

declare i32 @getopt(...) #4

declare i32 @atoi(ptr noundef) #4

declare ptr @atop(ptr noundef) #4

declare i32 @pcfracInit(i32 noundef, i32 noundef, i32 noundef) #4

declare ptr @pcfrac(ptr noundef, ptr noundef) #4

declare ptr @pdivmod(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 = { 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 = { "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 }

!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"}


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

@verbose = external dso_local local_unnamed_addr global i32, align 4
@debug = external dso_local local_unnamed_addr global i32, align 4
@stdout = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@progName = external dso_local local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [9 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [69 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@main.argvx = external hidden local_unnamed_addr global [2 x ptr], align 16
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracNabort = external local_unnamed_addr global i32, align 4
@.str.14 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracTsolns = external local_unnamed_addr global i32, align 4
@.str.15 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracT2solns = external local_unnamed_addr global i32, align 4
@.str.16 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracPsolns = external local_unnamed_addr global i32, align 4
@.str.17 = external hidden unnamed_addr constant [21 x i8], align 1
@cfracFsolns = external local_unnamed_addr global i32, align 4
@.str.18 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @psetq(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @pdestroy(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress 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 @findk(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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

declare i32 @fputp(ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  store ptr null, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store ptr null, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr %1, align 8, !tbaa !9
  store ptr %7, ptr @progName, align 8, !tbaa !9
  br label %.outer

.outer:                                           ; preds = %16, %2
  %.035.ph = phi i32 [ %18, %16 ], [ 1073741824, %2 ]
  %.033.ph = phi i32 [ %.033.ph67, %16 ], [ 0, %2 ]
  %.029.ph = phi i32 [ %.029.ph70, %16 ], [ 3, %2 ]
  br label %.outer66

.outer66:                                         ; preds = %.outer, %13
  %.033.ph67 = phi i32 [ %.033.ph, %.outer ], [ %15, %13 ]
  %.029.ph68 = phi i32 [ %.029.ph, %.outer ], [ %.029.ph70, %13 ]
  br label %.outer69

.outer69:                                         ; preds = %.outer66, %10
  %.029.ph70 = phi i32 [ %.029.ph68, %.outer66 ], [ %12, %10 ]
  br label %8

8:                                                ; preds = %.backedge, %.outer69
  %9 = tail call i32 (i32, ptr, ptr, ...) @getopt(i32 noundef %0, ptr noundef nonnull %1, ptr noundef nonnull @.str.7) #6
  switch i32 %9, label %.loopexit [
    i32 -1, label %28
    i32 97, label %10
    i32 107, label %13
    i32 105, label %16
    i32 100, label %19
    i32 118, label %22
  ]

10:                                               ; preds = %8
  %11 = load ptr, ptr @optarg, align 8, !tbaa !9
  %12 = tail call i32 @atoi(ptr nocapture noundef %11)
  br label %.outer69, !llvm.loop !11

13:                                               ; preds = %8
  %14 = load ptr, ptr @optarg, align 8, !tbaa !9
  %15 = tail call i32 @atoi(ptr nocapture noundef %14)
  br label %.outer66, !llvm.loop !11

16:                                               ; preds = %8
  %17 = load ptr, ptr @optarg, align 8, !tbaa !9
  %18 = tail call i32 @atoi(ptr nocapture noundef %17)
  br label %.outer, !llvm.loop !11

19:                                               ; preds = %8
  %20 = load i32, ptr @debug, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr @debug, align 4, !tbaa !5
  br label %.backedge

22:                                               ; preds = %8
  %23 = load i32, ptr @verbose, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @verbose, align 4, !tbaa !5
  br label %.backedge

.backedge:                                        ; preds = %22, %19
  br label %8, !llvm.loop !11

.loopexit:                                        ; preds = %8, %28
  %25 = load ptr, ptr @stderr, align 8, !tbaa !9
  %26 = load ptr, ptr @progName, align 8, !tbaa !9
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.8, ptr noundef %26) #7
  br label %119

28:                                               ; preds = %8
  %29 = load i32, ptr @optind, align 4, !tbaa !5
  %30 = sub nsw i32 %0, %29
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds ptr, ptr %1, i64 %31
  %33 = icmp eq i32 %29, %0
  %spec.select = select i1 %33, ptr @main.argvx, ptr %32
  %spec.select49 = select i1 %33, i32 1, i32 %30
  %34 = add i32 %spec.select49, -4
  %or.cond = icmp ult i32 %34, -3
  br i1 %or.cond, label %.loopexit, label %35

35:                                               ; preds = %28
  %36 = load ptr, ptr %spec.select, align 8, !tbaa !9
  %37 = tail call ptr @atop(ptr noundef %36) #6
  %38 = call ptr @psetq(ptr noundef nonnull %5, ptr noundef %37)
  %.not43 = icmp eq i32 %spec.select49, 1
  br i1 %.not43, label %.thread52, label %39

39:                                               ; preds = %35
  %40 = getelementptr inbounds i8, ptr %spec.select, i64 8
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = call i32 @atoi(ptr nocapture noundef %41)
  store i32 %42, ptr %3, align 4, !tbaa !5
  %43 = icmp eq i32 %spec.select49, 2
  br i1 %43, label %.thread52, label %44

44:                                               ; preds = %39
  %45 = getelementptr inbounds i8, ptr %spec.select, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = call i32 @atoi(ptr nocapture noundef %46)
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %.thread52, label %65

.thread52:                                        ; preds = %35, %39, %44
  %49 = phi i32 [ 0, %35 ], [ %42, %39 ], [ %42, %44 ]
  %50 = icmp eq i32 %.033.ph67, 0
  br i1 %50, label %51, label %58

51:                                               ; preds = %.thread52
  %52 = lshr i32 %49, 1
  %53 = add nuw i32 %52, 5
  %54 = load i32, ptr @verbose, align 4, !tbaa !5
  %.not45 = icmp eq i32 %54, 0
  br i1 %.not45, label %58, label %55

55:                                               ; preds = %51
  %56 = load ptr, ptr @stdout, align 8, !tbaa !9
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef nonnull @.str.10, i32 noundef %53) #6
  br label %58

58:                                               ; preds = %51, %55, %.thread52
  %.2 = phi i32 [ %53, %55 ], [ %53, %51 ], [ %.033.ph67, %.thread52 ]
  %59 = load ptr, ptr %5, align 8, !tbaa !9
  %60 = call i32 @findk(ptr noundef %59, ptr noundef nonnull %3, i32 noundef %.029.ph70, i32 noundef %.2)
  %61 = load i32, ptr @verbose, align 4, !tbaa !5
  %.not46 = icmp eq i32 %61, 0
  br i1 %.not46, label %65, label %62

62:                                               ; preds = %58
  %63 = load ptr, ptr @stdout, align 8, !tbaa !9
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.11, i32 noundef %60) #6
  br label %65

65:                                               ; preds = %58, %62, %44
  %.138 = phi i32 [ %60, %62 ], [ %60, %58 ], [ %47, %44 ]
  store i32 %.035.ph, ptr %4, align 4, !tbaa !5
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = call i32 @pcfracInit(i32 noundef %66, i32 noundef %.138, i32 noundef %.029.ph70) #6
  %68 = load ptr, ptr %5, align 8, !tbaa !9
  %69 = call ptr @pcfrac(ptr noundef %68, ptr noundef nonnull %4) #6
  %70 = call ptr @psetq(ptr noundef nonnull %6, ptr noundef %69)
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sub i32 %.035.ph, %71
  store i32 %72, ptr %4, align 4, !tbaa !5
  %73 = load i32, ptr @verbose, align 4, !tbaa !5
  %.not47 = icmp eq i32 %73, 0
  br i1 %.not47, label %95, label %74

74:                                               ; preds = %65
  %75 = load ptr, ptr @stdout, align 8, !tbaa !9
  %76 = call i32 @putc(i32 noundef 10, ptr noundef %75)
  %77 = load ptr, ptr @stdout, align 8, !tbaa !9
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.12, i32 noundef %78) #6
  %80 = load ptr, ptr @stdout, align 8, !tbaa !9
  %81 = load i32, ptr @cfracNabort, align 4, !tbaa !5
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %80, ptr noundef nonnull @.str.13, i32 noundef %81) #6
  %83 = load ptr, ptr @stdout, align 8, !tbaa !9
  %84 = load i32, ptr @cfracTsolns, align 4, !tbaa !5
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %83, ptr noundef nonnull @.str.14, i32 noundef %84) #6
  %86 = load ptr, ptr @stdout, align 8, !tbaa !9
  %87 = load i32, ptr @cfracT2solns, align 4, !tbaa !5
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.15, i32 noundef %87) #6
  %89 = load ptr, ptr @stdout, align 8, !tbaa !9
  %90 = load i32, ptr @cfracPsolns, align 4, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.16, i32 noundef %90) #6
  %92 = load ptr, ptr @stdout, align 8, !tbaa !9
  %93 = load i32, ptr @cfracFsolns, align 4, !tbaa !5
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef nonnull @.str.17, i32 noundef %93) #6
  br label %95

95:                                               ; preds = %74, %65
  %96 = load ptr, ptr %6, align 8, !tbaa !9
  %.not48 = icmp eq ptr %96, null
  br i1 %.not48, label %116, label %97

97:                                               ; preds = %95
  %98 = load ptr, ptr @stdout, align 8, !tbaa !9
  %99 = load ptr, ptr %5, align 8, !tbaa !9
  %100 = call i32 @fputp(ptr noundef %98, ptr noundef %99) #6
  %101 = load ptr, ptr @stdout, align 8, !tbaa !9
  %102 = call i32 @fputs(ptr noundef nonnull @.str.18, ptr noundef %101)
  %103 = load ptr, ptr @stdout, align 8, !tbaa !9
  %104 = load ptr, ptr %6, align 8, !tbaa !9
  %105 = call i32 @fputp(ptr noundef %103, ptr noundef %104) #6
  %106 = load ptr, ptr @stdout, align 8, !tbaa !9
  %107 = call i32 @fputs(ptr noundef nonnull @.str.19, ptr noundef %106)
  %108 = load ptr, ptr %5, align 8, !tbaa !9
  %109 = load ptr, ptr %6, align 8, !tbaa !9
  %110 = call ptr @pdivmod(ptr noundef %108, ptr noundef %109, ptr noundef nonnull %5, ptr noundef null) #6
  %111 = load ptr, ptr @stdout, align 8, !tbaa !9
  %112 = load ptr, ptr %5, align 8, !tbaa !9
  %113 = call i32 @fputp(ptr noundef %111, ptr noundef %112) #6
  %114 = load ptr, ptr @stdout, align 8, !tbaa !9
  %115 = call i32 @putc(i32 noundef 10, ptr noundef %114)
  %.pre = load ptr, ptr %6, align 8, !tbaa !9
  br label %116

116:                                              ; preds = %97, %95
  %117 = phi ptr [ %.pre, %97 ], [ null, %95 ]
  call void @pdestroy(ptr noundef %117)
  %118 = load ptr, ptr %5, align 8, !tbaa !9
  call void @pdestroy(ptr noundef %118)
  br label %119

119:                                              ; preds = %116, %.loopexit
  %.0 = phi i32 [ 1, %.loopexit ], [ 0, %116 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 %.0
}

declare i32 @getopt(...) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare i32 @atoi(ptr nocapture noundef) local_unnamed_addr #5

declare ptr @atop(ptr noundef) local_unnamed_addr #4

declare i32 @pcfracInit(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare ptr @pcfrac(ptr noundef, ptr noundef) local_unnamed_addr #4

declare ptr @pdivmod(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #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 = { 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 = { "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 = { mustprogress nofree 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 #6 = { nounwind }
attributes #7 = { cold 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, !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"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass