; LLVM IR from chkn/logdb :: stress (stress)

; 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 [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [125 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@count = external hidden global i32, align 4
@.str.8 = external hidden unnamed_addr constant [32 x i8], align 1
@threads = external hidden global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@conn = external hidden global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 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 ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = 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
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = icmp ne i32 %16, 5
  br i1 %17, label %18, label %29

18:                                               ; preds = %2
  %19 = load ptr, ptr %5, align 8, !tbaa !9
  %20 = getelementptr inbounds ptr, ptr %19, i64 0
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = call ptr @__xpg_basename(ptr noundef %21) #7
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %22)
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  br label %170

29:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 1
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  store ptr %32, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %33 = call ptr @getenv(ptr noundef @.str.6) #7
  store ptr %33, ptr %7, align 8, !tbaa !9
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = icmp ne ptr %34, null
  br i1 %35, label %40, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %5, align 8, !tbaa !9
  %38 = getelementptr inbounds ptr, ptr %37, i64 2
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  store ptr %39, ptr %7, align 8, !tbaa !9
  br label %40

40:                                               ; preds = %36, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 3
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call i32 @atoi(ptr noundef %43) #8
  store i32 %44, ptr %8, align 4, !tbaa !5
  %45 = load i32, ptr %8, align 4, !tbaa !5
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %49, label %47

47:                                               ; preds = %40
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  store i32 2, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %169

49:                                               ; preds = %40
  %50 = load ptr, ptr %5, align 8, !tbaa !9
  %51 = getelementptr inbounds ptr, ptr %50, i64 4
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = call i32 @atoi(ptr noundef %52) #8
  store i32 %53, ptr @count, align 4, !tbaa !5
  %54 = load i32, ptr @count, align 4, !tbaa !5
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %58, label %56

56:                                               ; preds = %49
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 2, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %169

58:                                               ; preds = %49
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = mul i64 %60, 8
  %62 = call noalias ptr @malloc(i64 noundef %61) #9
  store ptr %62, ptr @threads, align 8, !tbaa !9
  %63 = load ptr, ptr @threads, align 8, !tbaa !9
  %64 = icmp ne ptr %63, null
  br i1 %64, label %66, label %65

65:                                               ; preds = %58
  call void @perror(ptr noundef @.str.9)
  store i32 3, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %169

66:                                               ; preds = %58
  %67 = load ptr, ptr %6, align 8, !tbaa !9
  %68 = call ptr @logdb_open(ptr noundef %67, i32 noundef 1)
  store ptr %68, ptr @conn, align 8, !tbaa !9
  %69 = load ptr, ptr @conn, align 8, !tbaa !9
  %70 = icmp ne ptr %69, null
  br i1 %70, label %73, label %71

71:                                               ; preds = %66
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  store i32 4, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %169

73:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %131, %73
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  store i32 2, ptr %9, align 4
  br label %134

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %80 = call ptr @getenv(ptr noundef @.str.11) #7
  store ptr %80, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %81 = load ptr, ptr %7, align 8, !tbaa !9
  %82 = call i64 @strlen(ptr noundef %81) #8
  %83 = load ptr, ptr %11, align 8, !tbaa !9
  %84 = icmp ne ptr %83, null
  br i1 %84, label %85, label %88

85:                                               ; preds = %79
  %86 = load ptr, ptr %11, align 8, !tbaa !9
  %87 = call i64 @strlen(ptr noundef %86) #8
  br label %89

88:                                               ; preds = %79
  br label %89

89:                                               ; preds = %88, %85
  %90 = phi i64 [ %87, %85 ], [ 10, %88 ]
  %91 = add i64 %82, %90
  %92 = call noalias ptr @malloc(i64 noundef %91) #9
  store ptr %92, ptr %12, align 8, !tbaa !9
  %93 = load ptr, ptr %12, align 8, !tbaa !9
  %94 = icmp ne ptr %93, null
  br i1 %94, label %98, label %95

95:                                               ; preds = %89
  call void @perror(ptr noundef @.str.12)
  %96 = load ptr, ptr @conn, align 8, !tbaa !9
  %97 = call i32 @logdb_close(ptr noundef %96)
  store i32 5, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %128

98:                                               ; preds = %89
  %99 = load ptr, ptr %11, align 8, !tbaa !9
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %106

101:                                              ; preds = %98
  %102 = load ptr, ptr %12, align 8, !tbaa !9
  %103 = load ptr, ptr %7, align 8, !tbaa !9
  %104 = load ptr, ptr %11, align 8, !tbaa !9
  %105 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %102, ptr noundef @.str.13, ptr noundef %103, ptr noundef %104) #7
  br label %111

106:                                              ; preds = %98
  %107 = load ptr, ptr %12, align 8, !tbaa !9
  %108 = load ptr, ptr %7, align 8, !tbaa !9
  %109 = load i32, ptr %10, align 4, !tbaa !5
  %110 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %107, ptr noundef @.str.14, ptr noundef %108, i32 noundef %109) #7
  br label %111

111:                                              ; preds = %106, %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %112 = load ptr, ptr @threads, align 8, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i64, ptr %112, i64 %114
  %116 = load ptr, ptr %12, align 8, !tbaa !9
  %117 = call i32 @pthread_create(ptr noundef %115, ptr noundef null, ptr noundef @thread_func, ptr noundef %116) #7
  store i32 %117, ptr %13, align 4, !tbaa !5
  %118 = load i32, ptr %13, align 4, !tbaa !5
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %126

120:                                              ; preds = %111
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = call ptr @strerror(i32 noundef %121) #7
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %122)
  %124 = load ptr, ptr @conn, align 8, !tbaa !9
  %125 = call i32 @logdb_close(ptr noundef %124)
  store i32 6, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %127

126:                                              ; preds = %111
  store i32 0, ptr %9, align 4
  br label %127

127:                                              ; preds = %126, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %128

128:                                              ; preds = %127, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %129 = load i32, ptr %9, align 4
  switch i32 %129, label %134 [
    i32 0, label %130
  ]

130:                                              ; preds = %128
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %10, align 4, !tbaa !5
  br label %74, !llvm.loop !11

134:                                              ; preds = %128, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %135 = load i32, ptr %9, align 4
  switch i32 %135, label %169 [
    i32 2, label %136
  ]

136:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %161, %136
  %138 = load i32, ptr %14, align 4, !tbaa !5
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %142, label %141

141:                                              ; preds = %137
  store i32 5, ptr %9, align 4
  br label %164

142:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %143 = load ptr, ptr @threads, align 8, !tbaa !9
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i64, ptr %143, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !13
  %148 = call i32 @pthread_join(i64 noundef %147, ptr noundef null)
  store i32 %148, ptr %15, align 4, !tbaa !5
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %157

151:                                              ; preds = %142
  %152 = load i32, ptr %15, align 4, !tbaa !5
  %153 = call ptr @strerror(i32 noundef %152) #7
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, ptr noundef %153)
  %155 = load ptr, ptr @conn, align 8, !tbaa !9
  %156 = call i32 @logdb_close(ptr noundef %155)
  store i32 7, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %158

157:                                              ; preds = %142
  store i32 0, ptr %9, align 4
  br label %158

158:                                              ; preds = %157, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %159 = load i32, ptr %9, align 4
  switch i32 %159, label %164 [
    i32 0, label %160
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160
  %162 = load i32, ptr %14, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %14, align 4, !tbaa !5
  br label %137, !llvm.loop !15

164:                                              ; preds = %158, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  %165 = load i32, ptr %9, align 4
  switch i32 %165, label %169 [
    i32 5, label %166
  ]

166:                                              ; preds = %164
  %167 = load ptr, ptr @conn, align 8, !tbaa !9
  %168 = call i32 @logdb_close(ptr noundef %167)
  store i32 %168, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %169

169:                                              ; preds = %166, %164, %134, %71, %65, %56, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %170

170:                                              ; preds = %169, %18
  %171 = load i32, ptr %3, align 4
  ret i32 %171
}

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

; Function Attrs: nounwind
declare ptr @__xpg_basename(ptr noundef) #2

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

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #2

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

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

declare void @perror(ptr noundef) #1

declare ptr @logdb_open(ptr noundef, i32 noundef) #1

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

declare i32 @logdb_close(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden ptr @thread_func(ptr noundef) #0

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #2

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

declare i32 @pthread_join(i64 noundef, ptr noundef) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint nounwind willreturn memory(read) 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 #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }

!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 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !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 [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [125 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@count = external hidden local_unnamed_addr global i32, align 4
@.str.8 = external hidden unnamed_addr constant [32 x i8], align 1
@threads = external hidden local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@conn = external hidden local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %.not = icmp eq i32 %0, 5
  br i1 %.not, label %12, label %3

3:                                                ; preds = %2
  %4 = load ptr, ptr %1, align 8, !tbaa !5
  %5 = tail call ptr @__xpg_basename(ptr noundef %4) #8
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %5)
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %.thread73

12:                                               ; preds = %2
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = tail call ptr @getenv(ptr noundef nonnull @.str.6) #8
  %.not56 = icmp eq ptr %15, null
  br i1 %.not56, label %16, label %19

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %16, %12
  %.042 = phi ptr [ %15, %12 ], [ %18, %16 ]
  %20 = getelementptr inbounds i8, ptr %1, i64 24
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = tail call i32 @atoi(ptr nocapture noundef %21) #9
  %.not57 = icmp eq i32 %22, 0
  br i1 %.not57, label %23, label %25

23:                                               ; preds = %19
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %.thread73

25:                                               ; preds = %19
  %26 = getelementptr inbounds i8, ptr %1, i64 32
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = tail call i32 @atoi(ptr nocapture noundef %27) #9
  store i32 %28, ptr @count, align 4, !tbaa !9
  %.not58 = icmp eq i32 %28, 0
  br i1 %.not58, label %29, label %31

29:                                               ; preds = %25
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %.thread73

31:                                               ; preds = %25
  %32 = sext i32 %22 to i64
  %33 = shl nsw i64 %32, 3
  %34 = tail call noalias ptr @malloc(i64 noundef %33) #10
  store ptr %34, ptr @threads, align 8, !tbaa !5
  %.not59 = icmp eq ptr %34, null
  br i1 %.not59, label %35, label %36

35:                                               ; preds = %31
  tail call void @perror(ptr noundef nonnull @.str.9) #11
  br label %.thread73

36:                                               ; preds = %31
  %37 = tail call ptr @logdb_open(ptr noundef %14, i32 noundef 1) #8
  store ptr %37, ptr @conn, align 8, !tbaa !5
  %.not60 = icmp eq ptr %37, null
  br i1 %.not60, label %38, label %.preheader80

.preheader80:                                     ; preds = %36
  %.not6482 = icmp sgt i32 %22, 0
  br i1 %.not6482, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader80
  %wide.trip.count = zext nneg i32 %22 to i64
  br label %.lr.ph

38:                                               ; preds = %36
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  br label %.thread73

40:                                               ; preds = %57
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !11

.preheader:                                       ; preds = %40
  br i1 %.not6482, label %.lr.ph86.preheader, label %._crit_edge

.lr.ph86.preheader:                               ; preds = %.preheader
  %wide.trip.count94 = zext nneg i32 %22 to i64
  br label %.lr.ph86

.lr.ph:                                           ; preds = %.lr.ph.preheader, %40
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %40 ]
  %41 = tail call ptr @getenv(ptr noundef nonnull @.str.11) #8
  %42 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.042) #9
  %.not61 = icmp eq ptr %41, null
  br i1 %.not61, label %43, label %.thread

43:                                               ; preds = %.lr.ph
  %44 = add i64 %42, 10
  %45 = tail call noalias ptr @malloc(i64 noundef %44) #10
  %.not62 = icmp eq ptr %45, null
  br i1 %.not62, label %49, label %54

.thread:                                          ; preds = %.lr.ph
  %46 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %41) #9
  %47 = add i64 %46, %42
  %48 = tail call noalias ptr @malloc(i64 noundef %47) #10
  %.not6267 = icmp eq ptr %48, null
  br i1 %.not6267, label %49, label %52

49:                                               ; preds = %.thread, %43
  tail call void @perror(ptr noundef nonnull @.str.12) #11
  %50 = load ptr, ptr @conn, align 8, !tbaa !5
  %51 = tail call i32 @logdb_close(ptr noundef %50) #8
  br label %.thread73

52:                                               ; preds = %.thread
  %53 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %48, ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %.042, ptr noundef nonnull %41) #8
  br label %57

54:                                               ; preds = %43
  %55 = trunc nuw nsw i64 %indvars.iv to i32
  %56 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %45, ptr noundef nonnull dereferenceable(1) @.str.14, ptr noundef %.042, i32 noundef %55) #8
  br label %57

57:                                               ; preds = %54, %52
  %58 = phi ptr [ %45, %54 ], [ %48, %52 ]
  %59 = load ptr, ptr @threads, align 8, !tbaa !5
  %60 = getelementptr inbounds i64, ptr %59, i64 %indvars.iv
  %61 = tail call i32 @pthread_create(ptr noundef %60, ptr noundef null, ptr noundef nonnull @thread_func, ptr noundef nonnull %58) #8
  %.not63 = icmp eq i32 %61, 0
  br i1 %.not63, label %40, label %62

62:                                               ; preds = %57
  %63 = tail call ptr @strerror(i32 noundef %61) #8
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef %63)
  %65 = load ptr, ptr @conn, align 8, !tbaa !5
  %66 = tail call i32 @logdb_close(ptr noundef %65) #8
  br label %.thread73

67:                                               ; preds = %.lr.ph86
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %exitcond95.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count94
  br i1 %exitcond95.not, label %._crit_edge, label %.lr.ph86, !llvm.loop !13

.lr.ph86:                                         ; preds = %.lr.ph86.preheader, %67
  %indvars.iv91 = phi i64 [ 0, %.lr.ph86.preheader ], [ %indvars.iv.next92, %67 ]
  %68 = load ptr, ptr @threads, align 8, !tbaa !5
  %69 = getelementptr inbounds i64, ptr %68, i64 %indvars.iv91
  %70 = load i64, ptr %69, align 8, !tbaa !14
  %71 = tail call i32 @pthread_join(i64 noundef %70, ptr noundef null) #8
  %.not65 = icmp eq i32 %71, 0
  br i1 %.not65, label %67, label %.thread78

.thread78:                                        ; preds = %.lr.ph86
  %72 = tail call ptr @strerror(i32 noundef %71) #8
  %73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef %72)
  %74 = load ptr, ptr @conn, align 8, !tbaa !5
  %75 = tail call i32 @logdb_close(ptr noundef %74) #8
  br label %.thread73

._crit_edge:                                      ; preds = %67, %.preheader80, %.preheader
  %76 = load ptr, ptr @conn, align 8, !tbaa !5
  %77 = tail call i32 @logdb_close(ptr noundef %76) #8
  br label %.thread73

.thread73:                                        ; preds = %49, %62, %.thread78, %23, %29, %35, %38, %._crit_edge, %3
  %.8 = phi i32 [ 1, %3 ], [ %77, %._crit_edge ], [ 4, %38 ], [ 3, %35 ], [ 2, %29 ], [ 2, %23 ], [ 7, %.thread78 ], [ 6, %62 ], [ 5, %49 ]
  ret i32 %.8
}

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

; Function Attrs: nounwind
declare ptr @__xpg_basename(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #3

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

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #1

declare ptr @logdb_open(ptr noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7

declare i32 @logdb_close(ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden ptr @thread_func(ptr noundef) #0

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #2

declare i32 @pthread_join(i64 noundef, ptr noundef) local_unnamed_addr #6

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 = { 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 #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 = { nofree nounwind 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 #4 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #5 = { 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 #6 = { "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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { cold }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}


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