; LLVM IR from golems/ach :: src/test (achtest)

; 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.ach_channel = type { %union.anon }
%union.anon = type { [16 x i64] }
%struct.timespec = type { i64, i64 }

@opt_channel_name = external dso_local global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test_basic() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.ach_channel, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca %struct.timespec, align 8
  %9 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %10 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %11 = call i32 @ach_unlink(ptr noundef %10)
  store i32 %11, ptr %2, align 4, !tbaa !9
  %12 = load i32, ptr %2, align 4, !tbaa !9
  %13 = call i32 @ach_status_match(i32 noundef %12, i32 noundef 513)
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %20, label %15

15:                                               ; preds = %0
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !9
  %18 = call ptr @ach_result_to_string(i32 noundef %17)
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef @.str.1, ptr noundef %18) #6
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %3, align 4
  br label %163

20:                                               ; preds = %0
  %21 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %22 = call i32 @ach_create(ptr noundef %21, i64 noundef 32, i64 noundef 64, ptr noundef null)
  store i32 %22, ptr %2, align 4, !tbaa !9
  %23 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %23, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 128, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %24 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %25 = call i32 @ach_open(ptr noundef %4, ptr noundef %24, ptr noundef null)
  store i32 %25, ptr %2, align 4, !tbaa !9
  %26 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 2)
  store i32 %26, ptr %2, align 4, !tbaa !9
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = icmp ne i32 5, %27
  br i1 %28, label %29, label %33

29:                                               ; preds = %20
  %30 = load i32, ptr %2, align 4, !tbaa !9
  %31 = call ptr @ach_result_to_string(i32 noundef %30)
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %31)
  call void @exit(i32 noundef -1) #7
  unreachable

33:                                               ; preds = %20
  %34 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 0)
  store i32 %34, ptr %2, align 4, !tbaa !9
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = icmp ne i32 5, %35
  br i1 %36, label %37, label %41

37:                                               ; preds = %33
  %38 = load i32, ptr %2, align 4, !tbaa !9
  %39 = call ptr @ach_result_to_string(i32 noundef %38)
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %39)
  call void @exit(i32 noundef -1) #7
  unreachable

41:                                               ; preds = %33
  store i32 42, ptr %6, align 4, !tbaa !9
  %42 = call i32 @ach_put(ptr noundef %4, ptr noundef %6, i64 noundef 4)
  store i32 %42, ptr %2, align 4, !tbaa !9
  %43 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %43, ptr noundef @.str.4)
  %44 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 0)
  store i32 %44, ptr %2, align 4, !tbaa !9
  %45 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %45, ptr noundef @.str.5)
  %46 = load i64, ptr %7, align 8, !tbaa !11
  %47 = icmp ne i64 %46, 4
  br i1 %47, label %51, label %48

48:                                               ; preds = %41
  %49 = load i32, ptr %5, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 42
  br i1 %50, label %51, label %52

51:                                               ; preds = %48, %41
  call void @exit(i32 noundef -1) #7
  unreachable

52:                                               ; preds = %48
  store i32 43, ptr %6, align 4, !tbaa !9
  %53 = call i32 @ach_put(ptr noundef %4, ptr noundef %6, i64 noundef 4)
  store i32 %53, ptr %2, align 4, !tbaa !9
  %54 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %54, ptr noundef @.str.4)
  store i32 44, ptr %6, align 4, !tbaa !9
  %55 = call i32 @ach_put(ptr noundef %4, ptr noundef %6, i64 noundef 4)
  store i32 %55, ptr %2, align 4, !tbaa !9
  %56 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %56, ptr noundef @.str.4)
  %57 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 2)
  store i32 %57, ptr %2, align 4, !tbaa !9
  %58 = load i32, ptr %2, align 4, !tbaa !9
  %59 = icmp ne i32 6, %58
  br i1 %59, label %60, label %64

60:                                               ; preds = %52
  %61 = load i32, ptr %2, align 4, !tbaa !9
  %62 = call ptr @ach_result_to_string(i32 noundef %61)
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %62)
  call void @exit(i32 noundef -1) #7
  unreachable

64:                                               ; preds = %52
  %65 = load i64, ptr %7, align 8, !tbaa !11
  %66 = icmp ne i64 %65, 4
  br i1 %66, label %70, label %67

67:                                               ; preds = %64
  %68 = load i32, ptr %5, align 4, !tbaa !9
  %69 = icmp ne i32 %68, 44
  br i1 %69, label %70, label %71

70:                                               ; preds = %67, %64
  call void @exit(i32 noundef -1) #7
  unreachable

71:                                               ; preds = %67
  store i32 45, ptr %6, align 4, !tbaa !9
  %72 = call i32 @ach_put(ptr noundef %4, ptr noundef %6, i64 noundef 4)
  store i32 %72, ptr %2, align 4, !tbaa !9
  %73 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %73, ptr noundef @.str.4)
  %74 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %8) #6
  %75 = getelementptr inbounds %struct.timespec, ptr %8, i32 0, i32 0
  %76 = load i64, ptr %75, align 8, !tbaa !13
  %77 = add nsw i64 %76, 30
  store i64 %77, ptr %75, align 8, !tbaa !13
  %78 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef %8, i32 noundef 3)
  store i32 %78, ptr %2, align 4, !tbaa !9
  %79 = load i32, ptr %2, align 4, !tbaa !9
  %80 = icmp ne i32 0, %79
  br i1 %80, label %81, label %85

81:                                               ; preds = %71
  %82 = load i32, ptr %2, align 4, !tbaa !9
  %83 = call ptr @ach_result_to_string(i32 noundef %82)
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %83)
  call void @exit(i32 noundef -1) #7
  unreachable

85:                                               ; preds = %71
  %86 = load i64, ptr %7, align 8, !tbaa !11
  %87 = icmp ne i64 %86, 4
  br i1 %87, label %91, label %88

88:                                               ; preds = %85
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = icmp ne i32 %89, 45
  br i1 %90, label %91, label %92

91:                                               ; preds = %88, %85
  call void @exit(i32 noundef -1) #7
  unreachable

92:                                               ; preds = %88
  %93 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 2)
  store i32 %93, ptr %2, align 4, !tbaa !9
  %94 = load i32, ptr %2, align 4, !tbaa !9
  %95 = icmp ne i32 5, %94
  br i1 %95, label %96, label %100

96:                                               ; preds = %92
  %97 = load i32, ptr %2, align 4, !tbaa !9
  %98 = call ptr @ach_result_to_string(i32 noundef %97)
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %98)
  call void @exit(i32 noundef -1) #7
  unreachable

100:                                              ; preds = %92
  %101 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %8) #6
  %102 = getelementptr inbounds %struct.timespec, ptr %8, i32 0, i32 0
  %103 = load i64, ptr %102, align 8, !tbaa !13
  %104 = sub nsw i64 %103, 10
  store i64 %104, ptr %102, align 8, !tbaa !13
  %105 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef %8, i32 noundef 3)
  store i32 %105, ptr %2, align 4, !tbaa !9
  %106 = load i32, ptr %2, align 4, !tbaa !9
  %107 = icmp ne i32 7, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %100
  %109 = load i32, ptr %2, align 4, !tbaa !9
  %110 = call ptr @ach_result_to_string(i32 noundef %109)
  %111 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %110)
  call void @exit(i32 noundef -1) #7
  unreachable

112:                                              ; preds = %100
  %113 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %114 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 6)
  store i32 %114, ptr %2, align 4, !tbaa !9
  %115 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %116 = load i32, ptr %2, align 4, !tbaa !9
  %117 = icmp ne i32 0, %116
  br i1 %117, label %118, label %122

118:                                              ; preds = %112
  %119 = load i32, ptr %2, align 4, !tbaa !9
  %120 = call ptr @ach_result_to_string(i32 noundef %119)
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef %120)
  call void @exit(i32 noundef -1) #7
  unreachable

122:                                              ; preds = %112
  %123 = load i32, ptr %6, align 4, !tbaa !9
  %124 = load i32, ptr %5, align 4, !tbaa !9
  %125 = icmp ne i32 %123, %124
  br i1 %125, label %126, label %129

126:                                              ; preds = %122
  %127 = load i32, ptr %5, align 4, !tbaa !9
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %127)
  call void @exit(i32 noundef -1) #7
  unreachable

129:                                              ; preds = %122
  %130 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 4)
  store i32 %130, ptr %2, align 4, !tbaa !9
  %131 = load i32, ptr %2, align 4, !tbaa !9
  %132 = icmp ne i32 0, %131
  br i1 %132, label %133, label %137

133:                                              ; preds = %129
  %134 = load i32, ptr %2, align 4, !tbaa !9
  %135 = call ptr @ach_result_to_string(i32 noundef %134)
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef %135)
  call void @exit(i32 noundef -1) #7
  unreachable

137:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %138

138:                                              ; preds = %144, %137
  %139 = load i64, ptr %9, align 8, !tbaa !11
  %140 = icmp ult i64 %139, 100
  br i1 %140, label %141, label %147

141:                                              ; preds = %138
  %142 = call i32 @ach_put(ptr noundef %4, ptr noundef %6, i64 noundef 4)
  store i32 %142, ptr %2, align 4, !tbaa !9
  %143 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %143, ptr noundef @.str.4)
  br label %144

144:                                              ; preds = %141
  %145 = load i64, ptr %9, align 8, !tbaa !11
  %146 = add i64 %145, 1
  store i64 %146, ptr %9, align 8, !tbaa !11
  br label %138, !llvm.loop !15

147:                                              ; preds = %138
  %148 = call i32 @ach_get(ptr noundef %4, ptr noundef %5, i64 noundef 4, ptr noundef %7, ptr noundef null, i32 noundef 2)
  store i32 %148, ptr %2, align 4, !tbaa !9
  %149 = load i32, ptr %2, align 4, !tbaa !9
  %150 = icmp ne i32 6, %149
  br i1 %150, label %151, label %155

151:                                              ; preds = %147
  %152 = load i32, ptr %2, align 4, !tbaa !9
  %153 = call ptr @ach_result_to_string(i32 noundef %152)
  %154 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, ptr noundef %153)
  call void @exit(i32 noundef -1) #7
  unreachable

155:                                              ; preds = %147
  %156 = call i32 @ach_close(ptr noundef %4)
  store i32 %156, ptr %2, align 4, !tbaa !9
  %157 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %157, ptr noundef @.str.14)
  %158 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %159 = call i32 @ach_unlink(ptr noundef %158)
  store i32 %159, ptr %2, align 4, !tbaa !9
  %160 = load i32, ptr %2, align 4, !tbaa !9
  call void @test(i32 noundef %160, ptr noundef @.str.15)
  %161 = load ptr, ptr @stderr, align 8, !tbaa !5
  %162 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef @.str.16) #6
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %4) #6
  br label %163

163:                                              ; preds = %155, %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %164 = load i32, ptr %1, align 4
  ret i32 %164
}

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

declare i32 @ach_unlink(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ach_status_match(i32 noundef, i32 noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare ptr @ach_result_to_string(i32 noundef) #2

declare i32 @ach_create(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @test(i32 noundef, ptr noundef) #0

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

declare i32 @ach_get(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) #2

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

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

declare i32 @ach_put(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) #4

declare i32 @ach_close(ptr noundef) #2

; 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 = { 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 #4 = { 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 #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 = { 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, !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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"timespec", !12, i64 0, !12, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"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"

%struct.ach_channel = type { %union.anon }
%union.anon = type { [16 x i64] }
%struct.timespec = type { i64, i64 }

@opt_channel_name = external dso_local local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @test_basic() local_unnamed_addr #0 {
  %1 = alloca %struct.ach_channel, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %struct.timespec, align 8
  %6 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %7 = tail call i32 @ach_unlink(ptr noundef %6) #7
  %8 = tail call i32 @ach_status_match(i32 noundef %7, i32 noundef 513)
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %13

9:                                                ; preds = %0
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = tail call ptr @ach_result_to_string(i32 noundef %7) #7
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str.1, ptr noundef %11) #8
  br label %106

13:                                               ; preds = %0
  %14 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %15 = tail call i32 @ach_create(ptr noundef %14, i64 noundef 32, i64 noundef 64, ptr noundef null) #7
  tail call void @test(i32 noundef %15, ptr noundef nonnull @.str.2)
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %16 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %17 = call i32 @ach_open(ptr noundef nonnull %1, ptr noundef %16, ptr noundef null) #7
  %18 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 2) #7
  %.not48 = icmp eq i32 %18, 5
  br i1 %.not48, label %22, label %19

19:                                               ; preds = %13
  %20 = call ptr @ach_result_to_string(i32 noundef %18) #7
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %20)
  call void @exit(i32 noundef -1) #9
  unreachable

22:                                               ; preds = %13
  %23 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 0) #7
  %.not49 = icmp eq i32 %23, 5
  br i1 %.not49, label %27, label %24

24:                                               ; preds = %22
  %25 = call ptr @ach_result_to_string(i32 noundef %23) #7
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %25)
  call void @exit(i32 noundef -1) #9
  unreachable

27:                                               ; preds = %22
  store i32 42, ptr %3, align 4, !tbaa !9
  %28 = call i32 @ach_put(ptr noundef nonnull %1, ptr noundef nonnull %3, i64 noundef 4) #7
  call void @test(i32 noundef %28, ptr noundef nonnull @.str.4)
  %29 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 0) #7
  call void @test(i32 noundef %29, ptr noundef nonnull @.str.5)
  %30 = load i64, ptr %4, align 8, !tbaa !11
  %31 = icmp ne i64 %30, 4
  %32 = load i32, ptr %2, align 4
  %33 = icmp ne i32 %32, 42
  %or.cond = select i1 %31, i1 true, i1 %33
  br i1 %or.cond, label %34, label %35

34:                                               ; preds = %27
  call void @exit(i32 noundef -1) #9
  unreachable

35:                                               ; preds = %27
  store i32 43, ptr %3, align 4, !tbaa !9
  %36 = call i32 @ach_put(ptr noundef nonnull %1, ptr noundef nonnull %3, i64 noundef 4) #7
  call void @test(i32 noundef %36, ptr noundef nonnull @.str.4)
  store i32 44, ptr %3, align 4, !tbaa !9
  %37 = call i32 @ach_put(ptr noundef nonnull %1, ptr noundef nonnull %3, i64 noundef 4) #7
  call void @test(i32 noundef %37, ptr noundef nonnull @.str.4)
  %38 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 2) #7
  %.not50 = icmp eq i32 %38, 6
  br i1 %.not50, label %42, label %39

39:                                               ; preds = %35
  %40 = call ptr @ach_result_to_string(i32 noundef %38) #7
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef %40)
  call void @exit(i32 noundef -1) #9
  unreachable

42:                                               ; preds = %35
  %43 = load i64, ptr %4, align 8, !tbaa !11
  %44 = icmp ne i64 %43, 4
  %45 = load i32, ptr %2, align 4
  %46 = icmp ne i32 %45, 44
  %or.cond3 = select i1 %44, i1 true, i1 %46
  br i1 %or.cond3, label %47, label %48

47:                                               ; preds = %42
  call void @exit(i32 noundef -1) #9
  unreachable

48:                                               ; preds = %42
  store i32 45, ptr %3, align 4, !tbaa !9
  %49 = call i32 @ach_put(ptr noundef nonnull %1, ptr noundef nonnull %3, i64 noundef 4) #7
  call void @test(i32 noundef %49, ptr noundef nonnull @.str.4)
  %50 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %5) #7
  %51 = load i64, ptr %5, align 8, !tbaa !13
  %52 = add nsw i64 %51, 30
  store i64 %52, ptr %5, align 8, !tbaa !13
  %53 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 3) #7
  %.not51 = icmp eq i32 %53, 0
  br i1 %.not51, label %57, label %54

54:                                               ; preds = %48
  %55 = call ptr @ach_result_to_string(i32 noundef %53) #7
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %55)
  call void @exit(i32 noundef -1) #9
  unreachable

57:                                               ; preds = %48
  %58 = load i64, ptr %4, align 8, !tbaa !11
  %59 = icmp ne i64 %58, 4
  %60 = load i32, ptr %2, align 4
  %61 = icmp ne i32 %60, 45
  %or.cond5 = select i1 %59, i1 true, i1 %61
  br i1 %or.cond5, label %62, label %63

62:                                               ; preds = %57
  call void @exit(i32 noundef -1) #9
  unreachable

63:                                               ; preds = %57
  %64 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 2) #7
  %.not52 = icmp eq i32 %64, 5
  br i1 %.not52, label %68, label %65

65:                                               ; preds = %63
  %66 = call ptr @ach_result_to_string(i32 noundef %64) #7
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef %66)
  call void @exit(i32 noundef -1) #9
  unreachable

68:                                               ; preds = %63
  %69 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %5) #7
  %70 = load i64, ptr %5, align 8, !tbaa !13
  %71 = add nsw i64 %70, -10
  store i64 %71, ptr %5, align 8, !tbaa !13
  %72 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 3) #7
  %.not53 = icmp eq i32 %72, 7
  br i1 %.not53, label %76, label %73

73:                                               ; preds = %68
  %74 = call ptr @ach_result_to_string(i32 noundef %72) #7
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %74)
  call void @exit(i32 noundef -1) #9
  unreachable

76:                                               ; preds = %68
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %78 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 6) #7
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %.not54 = icmp eq i32 %78, 0
  br i1 %.not54, label %83, label %80

80:                                               ; preds = %76
  %81 = call ptr @ach_result_to_string(i32 noundef %78) #7
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef %81)
  call void @exit(i32 noundef -1) #9
  unreachable

83:                                               ; preds = %76
  %84 = load i32, ptr %3, align 4, !tbaa !9
  %85 = load i32, ptr %2, align 4, !tbaa !9
  %.not55 = icmp eq i32 %84, %85
  br i1 %.not55, label %88, label %86

86:                                               ; preds = %83
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %85)
  call void @exit(i32 noundef -1) #9
  unreachable

88:                                               ; preds = %83
  %89 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 4) #7
  %.not56 = icmp eq i32 %89, 0
  br i1 %.not56, label %.preheader, label %90

90:                                               ; preds = %88
  %91 = call ptr @ach_result_to_string(i32 noundef %89) #7
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef %91)
  call void @exit(i32 noundef -1) #9
  unreachable

.preheader:                                       ; preds = %88, %.preheader
  %.058 = phi i64 [ %94, %.preheader ], [ 0, %88 ]
  %93 = call i32 @ach_put(ptr noundef nonnull %1, ptr noundef nonnull %3, i64 noundef 4) #7
  call void @test(i32 noundef %93, ptr noundef nonnull @.str.4)
  %94 = add nuw nsw i64 %.058, 1
  %exitcond.not = icmp eq i64 %94, 100
  br i1 %exitcond.not, label %95, label %.preheader, !llvm.loop !15

95:                                               ; preds = %.preheader
  %96 = call i32 @ach_get(ptr noundef nonnull %1, ptr noundef nonnull %2, i64 noundef 4, ptr noundef nonnull %4, ptr noundef null, i32 noundef 2) #7
  %.not57 = icmp eq i32 %96, 6
  br i1 %.not57, label %100, label %97

97:                                               ; preds = %95
  %98 = call ptr @ach_result_to_string(i32 noundef %96) #7
  %99 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %98)
  call void @exit(i32 noundef -1) #9
  unreachable

100:                                              ; preds = %95
  %101 = call i32 @ach_close(ptr noundef nonnull %1) #7
  call void @test(i32 noundef %101, ptr noundef nonnull @.str.14)
  %102 = load ptr, ptr @opt_channel_name, align 8, !tbaa !5
  %103 = call i32 @ach_unlink(ptr noundef %102) #7
  call void @test(i32 noundef %103, ptr noundef nonnull @.str.15)
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef nonnull @.str.16) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #7
  br label %106

106:                                              ; preds = %100, %9
  %.037 = phi i32 [ 0, %100 ], [ -1, %9 ]
  ret i32 %.037
}

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

declare i32 @ach_unlink(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @ach_status_match(i32 noundef, i32 noundef) local_unnamed_addr #3

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

declare ptr @ach_result_to_string(i32 noundef) local_unnamed_addr #2

declare i32 @ach_create(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @test(i32 noundef, ptr noundef) local_unnamed_addr #0

declare i32 @ach_open(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @ach_get(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

declare i32 @ach_put(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #6

declare i32 @ach_close(ptr noundef) 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) #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 = { "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 = { 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 #4 = { 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 #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 "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 = { cold nounwind }
attributes #9 = { 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, !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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"timespec", !12, i64 0, !12, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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