; LLVM IR from clausecker/24puzzle :: cmd (sampleeta)

; 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.stratum = type { i64, double, double, double }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@optarg = external global ptr, align 8
@pdb_jobs = external global i32, align 4
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@optind = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 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 ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca [4096 x i8], align 16
  %20 = 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 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 9223372036854775807, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 1000000, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 64, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store ptr null, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  store ptr null, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  store ptr null, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %19) #8
  br label %21

21:                                               ; preds = %87, %2
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !9
  %24 = call i32 @__posix_getopt(i32 noundef %22, ptr noundef %23, ptr noundef @.str) #8
  store i32 %24, ptr %13, align 4, !tbaa !5
  %25 = load i32, ptr %13, align 4, !tbaa !5
  %26 = icmp ne i32 %25, -1
  br i1 %26, label %27, label %88

27:                                               ; preds = %21
  %28 = load i32, ptr %13, align 4, !tbaa !5
  switch i32 %28, label %83 [
    i32 99, label %29
    i32 100, label %31
    i32 106, label %33
    i32 108, label %46
    i32 110, label %49
    i32 112, label %59
    i32 114, label %61
    i32 115, label %71
    i32 116, label %74
    i32 118, label %77
    i32 86, label %80
  ]

29:                                               ; preds = %27
  %30 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %30, ptr %18, align 8, !tbaa !9
  br label %87

31:                                               ; preds = %27
  %32 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %32, ptr %17, align 8, !tbaa !9
  br label %87

33:                                               ; preds = %27
  %34 = load ptr, ptr @optarg, align 8, !tbaa !9
  %35 = call i32 @atoi(ptr noundef %34) #9
  store i32 %35, ptr @pdb_jobs, align 4, !tbaa !5
  %36 = load i32, ptr @pdb_jobs, align 4, !tbaa !5
  %37 = icmp slt i32 %36, 1
  br i1 %37, label %41, label %38

38:                                               ; preds = %33
  %39 = load i32, ptr @pdb_jobs, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 256
  br i1 %40, label %41, label %45

41:                                               ; preds = %38, %33
  %42 = load ptr, ptr @stderr, align 8, !tbaa !9
  %43 = load ptr, ptr @optarg, align 8, !tbaa !9
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.1, i32 noundef 256, ptr noundef %43) #8
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

45:                                               ; preds = %38
  br label %87

46:                                               ; preds = %27
  %47 = load ptr, ptr @optarg, align 8, !tbaa !9
  %48 = call i32 @atoi(ptr noundef %47) #9
  store i32 %48, ptr %15, align 4, !tbaa !5
  br label %87

49:                                               ; preds = %27
  %50 = load ptr, ptr @optarg, align 8, !tbaa !9
  %51 = call i64 @atoll(ptr noundef %50) #9
  store i64 %51, ptr %10, align 8, !tbaa !11
  %52 = load i64, ptr %10, align 8, !tbaa !11
  %53 = icmp sle i64 %52, 0
  br i1 %53, label %54, label %58

54:                                               ; preds = %49
  %55 = load ptr, ptr @stderr, align 8, !tbaa !9
  %56 = load ptr, ptr @optarg, align 8, !tbaa !9
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.2, ptr noundef %56) #8
  call void @exit(i32 noundef 1) #10
  unreachable

58:                                               ; preds = %49
  br label %87

59:                                               ; preds = %27
  %60 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %60, ptr %16, align 8, !tbaa !9
  br label %87

61:                                               ; preds = %27
  %62 = load ptr, ptr @optarg, align 8, !tbaa !9
  %63 = call i64 @atoll(ptr noundef %62) #9
  store i64 %63, ptr %11, align 8, !tbaa !11
  %64 = load i64, ptr %11, align 8, !tbaa !11
  %65 = icmp slt i64 %64, 0
  br i1 %65, label %66, label %70

66:                                               ; preds = %61
  %67 = load ptr, ptr @stderr, align 8, !tbaa !9
  %68 = load ptr, ptr @optarg, align 8, !tbaa !9
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.3, ptr noundef %68) #8
  call void @exit(i32 noundef 1) #10
  unreachable

70:                                               ; preds = %61
  br label %87

71:                                               ; preds = %27
  %72 = load ptr, ptr @optarg, align 8, !tbaa !9
  %73 = call i64 @strtoll(ptr noundef %72, ptr noundef null, i32 noundef 0) #8
  call void @set_seed(i64 noundef %73)
  br label %87

74:                                               ; preds = %27
  %75 = load i32, ptr %14, align 4, !tbaa !5
  %76 = or i32 %75, 4
  store i32 %76, ptr %14, align 4, !tbaa !5
  br label %87

77:                                               ; preds = %27
  %78 = load i32, ptr %14, align 4, !tbaa !5
  %79 = or i32 %78, 1
  store i32 %79, ptr %14, align 4, !tbaa !5
  br label %87

80:                                               ; preds = %27
  %81 = load i32, ptr %14, align 4, !tbaa !5
  %82 = or i32 %81, 2
  store i32 %82, ptr %14, align 4, !tbaa !5
  br label %87

83:                                               ; preds = %27
  %84 = load ptr, ptr %5, align 8, !tbaa !9
  %85 = getelementptr inbounds ptr, ptr %84, i64 0
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  call void @usage(ptr noundef %86)
  br label %87

87:                                               ; preds = %83, %80, %77, %74, %71, %70, %59, %58, %46, %45, %31, %29
  br label %21, !llvm.loop !13

88:                                               ; preds = %21
  %89 = load i32, ptr %15, align 4, !tbaa !5
  %90 = icmp slt i32 %89, -1
  br i1 %90, label %94, label %91

91:                                               ; preds = %88
  %92 = load i32, ptr %15, align 4, !tbaa !5
  %93 = icmp sgt i32 %92, 64
  br i1 %93, label %94, label %95

94:                                               ; preds = %91, %88
  store i32 64, ptr %15, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %94, %91
  %96 = load ptr, ptr %16, align 8, !tbaa !9
  %97 = icmp eq ptr %96, null
  br i1 %97, label %98, label %99

98:                                               ; preds = %95
  store i32 -1, ptr %15, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %98, %95
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = load i32, ptr @optind, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  %103 = icmp ne i32 %100, %102
  br i1 %103, label %104, label %108

104:                                              ; preds = %99
  %105 = load ptr, ptr %5, align 8, !tbaa !9
  %106 = getelementptr inbounds ptr, ptr %105, i64 0
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  call void @usage(ptr noundef %107)
  br label %108

108:                                              ; preds = %104, %99
  %109 = load ptr, ptr %5, align 8, !tbaa !9
  %110 = load i32, ptr @optind, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds ptr, ptr %109, i64 %111
  %113 = load ptr, ptr %112, align 8, !tbaa !9
  %114 = load ptr, ptr %17, align 8, !tbaa !9
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = and i32 %115, 1
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %120

118:                                              ; preds = %108
  %119 = load ptr, ptr @stderr, align 8, !tbaa !9
  br label %121

120:                                              ; preds = %108
  br label %121

121:                                              ; preds = %120, %118
  %122 = phi ptr [ %119, %118 ], [ null, %120 ]
  %123 = call ptr @catalogue_load(ptr noundef %113, ptr noundef %114, i32 noundef 0, ptr noundef %122)
  store ptr %123, ptr %6, align 8, !tbaa !9
  %124 = load ptr, ptr %6, align 8, !tbaa !9
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %127

126:                                              ; preds = %121
  call void @perror(ptr noundef @.str.4)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

127:                                              ; preds = %121
  %128 = load ptr, ptr %18, align 8, !tbaa !9
  %129 = icmp eq ptr %128, null
  br i1 %129, label %130, label %132

130:                                              ; preds = %127
  %131 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %131, ptr %7, align 8, !tbaa !9
  br label %148

132:                                              ; preds = %127
  %133 = load ptr, ptr %18, align 8, !tbaa !9
  %134 = load ptr, ptr %17, align 8, !tbaa !9
  %135 = load i32, ptr %14, align 4, !tbaa !5
  %136 = and i32 %135, 1
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %140

138:                                              ; preds = %132
  %139 = load ptr, ptr @stderr, align 8, !tbaa !9
  br label %141

140:                                              ; preds = %132
  br label %141

141:                                              ; preds = %140, %138
  %142 = phi ptr [ %139, %138 ], [ null, %140 ]
  %143 = call ptr @catalogue_load(ptr noundef %133, ptr noundef %134, i32 noundef 0, ptr noundef %142)
  store ptr %143, ptr %7, align 8, !tbaa !9
  %144 = load ptr, ptr %7, align 8, !tbaa !9
  %145 = icmp eq ptr %144, null
  br i1 %145, label %146, label %147

146:                                              ; preds = %141
  call void @perror(ptr noundef @.str.4)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

147:                                              ; preds = %141
  br label %148

148:                                              ; preds = %147, %130
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = add nsw i32 %149, 2
  %151 = sext i32 %150 to i64
  %152 = call noalias ptr @calloc(i64 noundef 32, i64 noundef %151) #11
  store ptr %152, ptr %8, align 8, !tbaa !9
  %153 = load ptr, ptr %8, align 8, !tbaa !9
  %154 = icmp eq ptr %153, null
  br i1 %154, label %155, label %156

155:                                              ; preds = %148
  call void @perror(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

156:                                              ; preds = %148
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %195, %156
  %158 = load i32, ptr %12, align 4, !tbaa !5
  %159 = load i32, ptr %15, align 4, !tbaa !5
  %160 = icmp sle i32 %158, %159
  br i1 %160, label %161, label %198

161:                                              ; preds = %157
  %162 = getelementptr inbounds [4096 x i8], ptr %19, i64 0, i64 0
  %163 = load ptr, ptr %16, align 8, !tbaa !9
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %162, i64 noundef 4096, ptr noundef @.str.6, ptr noundef %163, i32 noundef %164) #8
  %166 = getelementptr inbounds [4096 x i8], ptr %19, i64 0, i64 0
  %167 = call noalias ptr @fopen(ptr noundef %166, ptr noundef @.str.7)
  store ptr %167, ptr %9, align 8, !tbaa !9
  %168 = load ptr, ptr %9, align 8, !tbaa !9
  %169 = icmp eq ptr %168, null
  br i1 %169, label %170, label %179

170:                                              ; preds = %161
  %171 = call ptr @__errno_location() #12
  %172 = load i32, ptr %171, align 4, !tbaa !5
  %173 = icmp eq i32 %172, 2
  br i1 %173, label %174, label %177

174:                                              ; preds = %170
  %175 = load i32, ptr %12, align 4, !tbaa !5
  %176 = sub nsw i32 %175, 1
  store i32 %176, ptr %15, align 4, !tbaa !5
  br label %198

177:                                              ; preds = %170
  %178 = getelementptr inbounds [4096 x i8], ptr %19, i64 0, i64 0
  call void @perror(ptr noundef %178)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

179:                                              ; preds = %161
  %180 = load i32, ptr %12, align 4, !tbaa !5
  %181 = load ptr, ptr %8, align 8, !tbaa !9
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds %struct.stratum, ptr %181, i64 %183
  %185 = load ptr, ptr %6, align 8, !tbaa !9
  %186 = load ptr, ptr %9, align 8, !tbaa !9
  %187 = load i64, ptr %10, align 8, !tbaa !11
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = call i32 @sample_sphere(i32 noundef %180, ptr noundef %184, ptr noundef %185, ptr noundef %186, i64 noundef %187, i32 noundef %188)
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %192

191:                                              ; preds = %179
  call void @perror(ptr noundef @.str.8)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

192:                                              ; preds = %179
  %193 = load ptr, ptr %9, align 8, !tbaa !9
  %194 = call i32 @fclose(ptr noundef %193)
  br label %195

195:                                              ; preds = %192
  %196 = load i32, ptr %12, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %12, align 4, !tbaa !5
  br label %157, !llvm.loop !15

198:                                              ; preds = %174, %157
  %199 = load i32, ptr %15, align 4, !tbaa !5
  %200 = load ptr, ptr %8, align 8, !tbaa !9
  %201 = load i32, ptr %15, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds %struct.stratum, ptr %200, i64 %202
  %204 = getelementptr inbounds %struct.stratum, ptr %203, i64 1
  %205 = load ptr, ptr %6, align 8, !tbaa !9
  %206 = load ptr, ptr %7, align 8, !tbaa !9
  %207 = load i64, ptr %11, align 8, !tbaa !11
  %208 = load i32, ptr %14, align 4, !tbaa !5
  %209 = call i32 @sample_rest(i32 noundef %199, ptr noundef %204, ptr noundef %205, ptr noundef %206, i64 noundef %207, i32 noundef %208)
  %210 = icmp ne i32 %209, 0
  br i1 %210, label %211, label %212

211:                                              ; preds = %198
  call void @perror(ptr noundef @.str.9)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

212:                                              ; preds = %198
  %213 = load ptr, ptr %8, align 8, !tbaa !9
  %214 = load i32, ptr %15, align 4, !tbaa !5
  call void @join_strata(ptr noundef %213, i32 noundef %214)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %20, align 4
  br label %215

215:                                              ; preds = %212, %211, %191, %177, %155, %146, %126, %41
  call void @llvm.lifetime.end.p0(i64 4096, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %216 = load i32, ptr %3, align 4
  ret i32 %216
}

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

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

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i64 @atoll(ptr noundef nonnull) #3

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

declare void @set_seed(i64 noundef) #5

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

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

declare ptr @catalogue_load(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

declare void @perror(ptr noundef) #5

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #6

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #7

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

declare i32 @fclose(ptr noundef) #5

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

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

; 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 = { 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 = { 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 #4 = { 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 #5 = { "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 allocsize(0,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 #7 = { nounwind willreturn memory(none) "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 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0,1) }
attributes #12 = { nounwind willreturn memory(none) }

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


; 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.stratum = type { i64, double, double, double }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@pdb_jobs = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1

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

4:                                                ; preds = %.backedge, %2
  %.067 = phi i64 [ 9223372036854775807, %2 ], [ %.067.be, %.backedge ]
  %.065 = phi i64 [ 1000000, %2 ], [ %.065.be, %.backedge ]
  %.061 = phi i32 [ 0, %2 ], [ %.061.be, %.backedge ]
  %.059 = phi i32 [ 64, %2 ], [ %.059.be, %.backedge ]
  %.057 = phi ptr [ null, %2 ], [ %.057.be, %.backedge ]
  %.055 = phi ptr [ null, %2 ], [ %.055.be, %.backedge ]
  %.0 = phi ptr [ null, %2 ], [ %.0.be, %.backedge ]
  %5 = tail call i32 @__posix_getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #10
  switch i32 %5, label %45 [
    i32 -1, label %47
    i32 99, label %6
    i32 100, label %8
    i32 106, label %10
    i32 108, label %17
    i32 110, label %20
    i32 112, label %27
    i32 114, label %29
    i32 115, label %36
    i32 116, label %39
    i32 118, label %41
    i32 86, label %43
  ]

6:                                                ; preds = %4
  %7 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.backedge

8:                                                ; preds = %4
  %9 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.backedge

10:                                               ; preds = %4
  %11 = load ptr, ptr @optarg, align 8, !tbaa !5
  %12 = tail call i32 @atoi(ptr nocapture noundef %11) #11
  store i32 %12, ptr @pdb_jobs, align 4, !tbaa !9
  %13 = add i32 %12, -257
  %or.cond = icmp ult i32 %13, -256
  br i1 %or.cond, label %14, label %.backedge

14:                                               ; preds = %10
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.1, i32 noundef 256, ptr noundef nonnull %11) #12
  br label %103

17:                                               ; preds = %4
  %18 = load ptr, ptr @optarg, align 8, !tbaa !5
  %19 = tail call i32 @atoi(ptr nocapture noundef %18) #11
  br label %.backedge

20:                                               ; preds = %4
  %21 = load ptr, ptr @optarg, align 8, !tbaa !5
  %22 = tail call i64 @atoll(ptr nocapture noundef %21) #11
  %23 = icmp slt i64 %22, 1
  br i1 %23, label %24, label %.backedge

24:                                               ; preds = %20
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.2, ptr noundef nonnull %21) #12
  tail call void @exit(i32 noundef 1) #13
  unreachable

27:                                               ; preds = %4
  %28 = load ptr, ptr @optarg, align 8, !tbaa !5
  br label %.backedge

29:                                               ; preds = %4
  %30 = load ptr, ptr @optarg, align 8, !tbaa !5
  %31 = tail call i64 @atoll(ptr nocapture noundef %30) #11
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %33, label %.backedge

.backedge:                                        ; preds = %29, %20, %10, %45, %43, %41, %39, %36, %27, %17, %8, %6
  %.067.be = phi i64 [ %.067, %45 ], [ %.067, %43 ], [ %.067, %41 ], [ %.067, %39 ], [ %.067, %36 ], [ %.067, %29 ], [ %.067, %27 ], [ %22, %20 ], [ %.067, %17 ], [ %.067, %10 ], [ %.067, %8 ], [ %.067, %6 ]
  %.065.be = phi i64 [ %.065, %45 ], [ %.065, %43 ], [ %.065, %41 ], [ %.065, %39 ], [ %.065, %36 ], [ %31, %29 ], [ %.065, %27 ], [ %.065, %20 ], [ %.065, %17 ], [ %.065, %10 ], [ %.065, %8 ], [ %.065, %6 ]
  %.061.be = phi i32 [ %.061, %45 ], [ %44, %43 ], [ %42, %41 ], [ %40, %39 ], [ %.061, %36 ], [ %.061, %29 ], [ %.061, %27 ], [ %.061, %20 ], [ %.061, %17 ], [ %.061, %10 ], [ %.061, %8 ], [ %.061, %6 ]
  %.059.be = phi i32 [ %.059, %45 ], [ %.059, %43 ], [ %.059, %41 ], [ %.059, %39 ], [ %.059, %36 ], [ %.059, %29 ], [ %.059, %27 ], [ %.059, %20 ], [ %19, %17 ], [ %.059, %10 ], [ %.059, %8 ], [ %.059, %6 ]
  %.057.be = phi ptr [ %.057, %45 ], [ %.057, %43 ], [ %.057, %41 ], [ %.057, %39 ], [ %.057, %36 ], [ %.057, %29 ], [ %28, %27 ], [ %.057, %20 ], [ %.057, %17 ], [ %.057, %10 ], [ %.057, %8 ], [ %.057, %6 ]
  %.055.be = phi ptr [ %.055, %45 ], [ %.055, %43 ], [ %.055, %41 ], [ %.055, %39 ], [ %.055, %36 ], [ %.055, %29 ], [ %.055, %27 ], [ %.055, %20 ], [ %.055, %17 ], [ %.055, %10 ], [ %9, %8 ], [ %.055, %6 ]
  %.0.be = phi ptr [ %.0, %45 ], [ %.0, %43 ], [ %.0, %41 ], [ %.0, %39 ], [ %.0, %36 ], [ %.0, %29 ], [ %.0, %27 ], [ %.0, %20 ], [ %.0, %17 ], [ %.0, %10 ], [ %.0, %8 ], [ %7, %6 ]
  br label %4, !llvm.loop !11

33:                                               ; preds = %29
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.3, ptr noundef nonnull %30) #12
  tail call void @exit(i32 noundef 1) #13
  unreachable

36:                                               ; preds = %4
  %37 = load ptr, ptr @optarg, align 8, !tbaa !5
  %38 = tail call i64 @strtoll(ptr nocapture noundef %37, ptr noundef null, i32 noundef 0) #10
  tail call void @set_seed(i64 noundef %38) #10
  br label %.backedge

39:                                               ; preds = %4
  %40 = or i32 %.061, 4
  br label %.backedge

41:                                               ; preds = %4
  %42 = or i32 %.061, 1
  br label %.backedge

43:                                               ; preds = %4
  %44 = or i32 %.061, 2
  br label %.backedge

45:                                               ; preds = %4
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %46)
  br label %.backedge

47:                                               ; preds = %4
  %48 = add i32 %.059, -65
  %or.cond3 = icmp ult i32 %48, -66
  %spec.store.select = select i1 %or.cond3, i32 64, i32 %.059
  %49 = icmp eq ptr %.057, null
  %spec.store.select4 = select i1 %49, i32 -1, i32 %spec.store.select
  %50 = load i32, ptr @optind, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  %.not77 = icmp eq i32 %51, %0
  br i1 %.not77, label %54, label %52

52:                                               ; preds = %47
  %53 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @usage(ptr noundef %53)
  %.pre = load i32, ptr @optind, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %52, %47
  %55 = phi i32 [ %.pre, %52 ], [ %50, %47 ]
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %1, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = and i32 %.061, 1
  %.not78 = icmp eq i32 %59, 0
  %60 = load ptr, ptr @stderr, align 8
  %61 = select i1 %.not78, ptr null, ptr %60
  %62 = tail call ptr @catalogue_load(ptr noundef %58, ptr noundef %.055, i32 noundef 0, ptr noundef %61) #10
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %65

64:                                               ; preds = %54
  tail call void @perror(ptr noundef nonnull @.str.4) #14
  br label %103

65:                                               ; preds = %54
  %66 = icmp eq ptr %.0, null
  br i1 %66, label %73, label %67

67:                                               ; preds = %65
  %68 = load ptr, ptr @stderr, align 8
  %69 = select i1 %.not78, ptr null, ptr %68
  %70 = tail call ptr @catalogue_load(ptr noundef nonnull %.0, ptr noundef %.055, i32 noundef 0, ptr noundef %69) #10
  %71 = icmp eq ptr %70, null
  br i1 %71, label %72, label %73

72:                                               ; preds = %67
  tail call void @perror(ptr noundef nonnull @.str.4) #14
  br label %103

73:                                               ; preds = %65, %67
  %.069 = phi ptr [ %70, %67 ], [ %62, %65 ]
  %74 = add nsw i32 %spec.store.select4, 2
  %75 = sext i32 %74 to i64
  %76 = tail call noalias ptr @calloc(i64 noundef 32, i64 noundef %75) #15
  %77 = icmp eq ptr %76, null
  br i1 %77, label %79, label %.preheader

.preheader:                                       ; preds = %73
  %.not79107 = icmp slt i32 %spec.store.select4, 0
  br i1 %.not79107, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %78 = add nuw i32 %spec.store.select4, 1
  %wide.trip.count = zext i32 %78 to i64
  br label %.lr.ph

79:                                               ; preds = %73
  tail call void @perror(ptr noundef nonnull @.str.5) #14
  br label %103

.lr.ph:                                           ; preds = %.lr.ph.preheader, %95
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %95 ]
  %80 = trunc nuw nsw i64 %indvars.iv to i32
  %81 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 4096, ptr noundef nonnull @.str.6, ptr noundef %.057, i32 noundef %80) #10
  %82 = call noalias ptr @fopen(ptr noundef nonnull %3, ptr noundef nonnull @.str.7)
  %83 = icmp eq ptr %82, null
  br i1 %83, label %84, label %91

84:                                               ; preds = %.lr.ph
  %85 = tail call ptr @__errno_location() #16
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 2
  br i1 %87, label %88, label %90

88:                                               ; preds = %84
  %89 = add nsw i32 %80, -1
  br label %.loopexit

90:                                               ; preds = %84
  call void @perror(ptr noundef nonnull %3) #14
  br label %103

91:                                               ; preds = %.lr.ph
  %92 = getelementptr inbounds %struct.stratum, ptr %76, i64 %indvars.iv
  %93 = tail call i32 @sample_sphere(i32 noundef %80, ptr noundef nonnull %92, ptr noundef nonnull %62, ptr noundef nonnull %82, i64 noundef %.067, i32 noundef %.061)
  %.not80 = icmp eq i32 %93, 0
  br i1 %.not80, label %95, label %94

94:                                               ; preds = %91
  tail call void @perror(ptr noundef nonnull @.str.8) #14
  br label %103

95:                                               ; preds = %91
  %96 = tail call i32 @fclose(ptr noundef nonnull %82)
  %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 %.loopexit, label %.lr.ph, !llvm.loop !13

.loopexit:                                        ; preds = %95, %.preheader, %88
  %.2 = phi i32 [ %89, %88 ], [ %spec.store.select4, %.preheader ], [ %spec.store.select4, %95 ]
  %97 = sext i32 %.2 to i64
  %98 = getelementptr inbounds %struct.stratum, ptr %76, i64 %97
  %99 = getelementptr inbounds i8, ptr %98, i64 32
  %100 = tail call i32 @sample_rest(i32 noundef %.2, ptr noundef nonnull %99, ptr noundef nonnull %62, ptr noundef nonnull %.069, i64 noundef %.065, i32 noundef %.061)
  %.not81 = icmp eq i32 %100, 0
  br i1 %.not81, label %102, label %101

101:                                              ; preds = %.loopexit
  tail call void @perror(ptr noundef nonnull @.str.9) #14
  br label %103

102:                                              ; preds = %.loopexit
  tail call void @join_strata(ptr noundef nonnull %76, i32 noundef %.2)
  br label %103

103:                                              ; preds = %102, %101, %94, %90, %79, %72, %64, %14
  %.063 = phi i32 [ 1, %14 ], [ 1, %64 ], [ 1, %79 ], [ 1, %101 ], [ 0, %102 ], [ 1, %90 ], [ 1, %94 ], [ 1, %72 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #10
  ret i32 %.063
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i64 @atoll(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

declare void @set_seed(i64 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoll(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #7

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

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

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

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

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #9

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

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

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

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

; 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 = { 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 = { 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 #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 = { "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 "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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #9 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { cold nounwind }
attributes #13 = { noreturn nounwind }
attributes #14 = { cold }
attributes #15 = { nounwind allocsize(0,1) }
attributes #16 = { nounwind willreturn memory(none) }

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


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