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

; 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.fsm = type { [25 x i32], [25 x ptr], [25 x ptr] }
%struct.samplestate = type { ptr, ptr, ptr, i64, i32, %union.pthread_mutex_t, i64, i64, i64, i64, double, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@fsm_simple = external constant %struct.fsm, align 8
@.str = external hidden unnamed_addr constant [17 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 [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@optind = external global i32, align 4
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 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 %struct.samplestate, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = 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 128, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr @fsm_simple, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store ptr null, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 1000, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store i64 -1, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store ptr null, ptr %18, align 8, !tbaa !9
  br label %20

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

26:                                               ; preds = %20
  %27 = load i32, ptr %14, align 4, !tbaa !5
  switch i32 %27, label %77 [
    i32 100, label %28
    i32 106, label %30
    i32 109, label %42
    i32 110, label %58
    i32 78, label %61
    i32 111, label %64
    i32 114, label %72
    i32 115, label %73
    i32 118, label %76
  ]

28:                                               ; preds = %26
  %29 = load ptr, ptr @optarg, align 8, !tbaa !9
  store ptr %29, ptr %18, align 8, !tbaa !9
  br label %81

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

35:                                               ; preds = %30
  %36 = load i32, ptr @pdb_jobs, align 4, !tbaa !5
  %37 = icmp sgt i32 %36, 256
  br i1 %37, label %38, label %41

38:                                               ; preds = %35, %30
  %39 = load ptr, ptr @stderr, align 8, !tbaa !9
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.1, i32 noundef 256) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

41:                                               ; preds = %35
  br label %81

42:                                               ; preds = %26
  %43 = load ptr, ptr @optarg, align 8, !tbaa !9
  %44 = call noalias ptr @fopen(ptr noundef %43, ptr noundef @.str.2)
  store ptr %44, ptr %9, align 8, !tbaa !9
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = load ptr, ptr @optarg, align 8, !tbaa !9
  call void @perror(ptr noundef %48)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

49:                                               ; preds = %42
  %50 = load ptr, ptr %9, align 8, !tbaa !9
  %51 = call ptr @fsm_load(ptr noundef %50)
  store ptr %51, ptr %7, align 8, !tbaa !9
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  call void @perror(ptr noundef @.str.3)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

55:                                               ; preds = %49
  %56 = load ptr, ptr %9, align 8, !tbaa !9
  %57 = call i32 @fclose(ptr noundef %56)
  br label %81

58:                                               ; preds = %26
  %59 = load ptr, ptr @optarg, align 8, !tbaa !9
  %60 = call i64 @strtol(ptr noundef %59, ptr noundef null, i32 noundef 0) #5
  store i64 %60, ptr %12, align 8, !tbaa !11
  br label %81

61:                                               ; preds = %26
  %62 = load ptr, ptr @optarg, align 8, !tbaa !9
  %63 = call i64 @strtol(ptr noundef %62, ptr noundef null, i32 noundef 0) #5
  store i64 %63, ptr %13, align 8, !tbaa !11
  br label %81

64:                                               ; preds = %26
  %65 = load ptr, ptr @optarg, align 8, !tbaa !9
  %66 = call noalias ptr @fopen(ptr noundef %65, ptr noundef @.str.4)
  store ptr %66, ptr %11, align 8, !tbaa !9
  %67 = load ptr, ptr %11, align 8, !tbaa !9
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %71

69:                                               ; preds = %64
  %70 = load ptr, ptr @optarg, align 8, !tbaa !9
  call void @perror(ptr noundef %70)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

71:                                               ; preds = %64
  br label %81

72:                                               ; preds = %26
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %81

73:                                               ; preds = %26
  %74 = load ptr, ptr @optarg, align 8, !tbaa !9
  %75 = call i64 @strtoll(ptr noundef %74, ptr noundef null, i32 noundef 0) #5
  call void @set_seed(i64 noundef %75)
  br label %81

76:                                               ; preds = %26
  store i32 1, ptr %16, align 4, !tbaa !5
  br label %81

77:                                               ; preds = %26
  %78 = load ptr, ptr %5, align 8, !tbaa !9
  %79 = getelementptr inbounds ptr, ptr %78, i64 0
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  call void @usage(ptr noundef %80)
  br label %81

81:                                               ; preds = %77, %76, %73, %72, %71, %61, %58, %55, %41, %28
  br label %20, !llvm.loop !13

82:                                               ; preds = %20
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = load i32, ptr @optind, align 4, !tbaa !5
  %85 = add nsw i32 %84, 2
  %86 = icmp ne i32 %83, %85
  br i1 %86, label %87, label %91

87:                                               ; preds = %82
  %88 = load ptr, ptr %5, align 8, !tbaa !9
  %89 = getelementptr inbounds ptr, ptr %88, i64 0
  %90 = load ptr, ptr %89, align 8, !tbaa !9
  call void @usage(ptr noundef %90)
  br label %91

91:                                               ; preds = %87, %82
  %92 = load ptr, ptr %11, align 8, !tbaa !9
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %100

94:                                               ; preds = %91
  %95 = load ptr, ptr @stderr, align 8, !tbaa !9
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str.5) #5
  %97 = load ptr, ptr %5, align 8, !tbaa !9
  %98 = getelementptr inbounds ptr, ptr %97, i64 0
  %99 = load ptr, ptr %98, align 8, !tbaa !9
  call void @usage(ptr noundef %99)
  br label %100

100:                                              ; preds = %94, %91
  %101 = load ptr, ptr %5, align 8, !tbaa !9
  %102 = load i32, ptr @optind, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds ptr, ptr %101, i64 %103
  %105 = load ptr, ptr %104, align 8, !tbaa !9
  %106 = load ptr, ptr %18, align 8, !tbaa !9
  %107 = load i32, ptr %16, align 4, !tbaa !5
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %111

109:                                              ; preds = %100
  %110 = load ptr, ptr @stderr, align 8, !tbaa !9
  br label %112

111:                                              ; preds = %100
  br label %112

112:                                              ; preds = %111, %109
  %113 = phi ptr [ %110, %109 ], [ null, %111 ]
  %114 = call ptr @catalogue_load(ptr noundef %105, ptr noundef %106, i32 noundef 0, ptr noundef %113)
  store ptr %114, ptr %8, align 8, !tbaa !9
  %115 = load ptr, ptr %8, align 8, !tbaa !9
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %112
  call void @perror(ptr noundef @.str.6)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

118:                                              ; preds = %112
  %119 = call noalias ptr @tmpfile()
  store ptr %119, ptr %10, align 8, !tbaa !9
  %120 = load ptr, ptr %10, align 8, !tbaa !9
  %121 = icmp eq ptr %120, null
  br i1 %121, label %122, label %123

122:                                              ; preds = %118
  call void @perror(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

123:                                              ; preds = %118
  %124 = load ptr, ptr %10, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 0
  store ptr %124, ptr %125, align 8, !tbaa !15
  %126 = load ptr, ptr %7, align 8, !tbaa !9
  %127 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 1
  store ptr %126, ptr %127, align 8, !tbaa !18
  %128 = load ptr, ptr %8, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 2
  store ptr %128, ptr %129, align 8, !tbaa !19
  %130 = load i64, ptr %12, align 8, !tbaa !11
  %131 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 3
  store i64 %130, ptr %131, align 8, !tbaa !20
  %132 = load i32, ptr %16, align 4, !tbaa !5
  %133 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 4
  store i32 %132, ptr %133, align 8, !tbaa !21
  %134 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 5
  %135 = call i32 @pthread_mutex_init(ptr noundef %134, ptr noundef null) #5
  store i32 %135, ptr %17, align 4, !tbaa !5
  %136 = load i32, ptr %17, align 4, !tbaa !5
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %143

138:                                              ; preds = %123
  %139 = load ptr, ptr @stderr, align 8, !tbaa !9
  %140 = load i32, ptr %17, align 4, !tbaa !5
  %141 = call ptr @strerror(i32 noundef %140) #5
  %142 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %139, ptr noundef @.str.8, ptr noundef %141) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

143:                                              ; preds = %123
  %144 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 6
  store i64 0, ptr %144, align 8, !tbaa !22
  %145 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 7
  store i64 0, ptr %145, align 8, !tbaa !23
  %146 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 8
  store i64 0, ptr %146, align 8, !tbaa !24
  %147 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 9
  store i64 0, ptr %147, align 8, !tbaa !25
  %148 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 10
  store double 0.000000e+00, ptr %148, align 8, !tbaa !26
  %149 = load ptr, ptr %5, align 8, !tbaa !9
  %150 = load i32, ptr @optind, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds ptr, ptr %149, i64 %152
  %154 = load ptr, ptr %153, align 8, !tbaa !9
  %155 = call i64 @strtol(ptr noundef %154, ptr noundef null, i32 noundef 0) #5
  %156 = trunc i64 %155 to i32
  %157 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 11
  store i32 %156, ptr %157, align 8, !tbaa !27
  %158 = getelementptr inbounds %struct.samplestate, ptr %6, i32 0, i32 11
  %159 = load i32, ptr %158, align 8, !tbaa !27
  %160 = icmp slt i32 %159, 0
  br i1 %160, label %161, label %173

161:                                              ; preds = %143
  %162 = load ptr, ptr @stderr, align 8, !tbaa !9
  %163 = load ptr, ptr %5, align 8, !tbaa !9
  %164 = load i32, ptr @optind, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds ptr, ptr %163, i64 %166
  %168 = load ptr, ptr %167, align 8, !tbaa !9
  %169 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef @.str.9, ptr noundef %168) #5
  %170 = load ptr, ptr %5, align 8, !tbaa !9
  %171 = getelementptr inbounds ptr, ptr %170, i64 0
  %172 = load ptr, ptr %171, align 8, !tbaa !9
  call void @usage(ptr noundef %172)
  br label %173

173:                                              ; preds = %161, %143
  call void @take_samples_parallel(ptr noundef %6)
  %174 = load i64, ptr %13, align 8, !tbaa !11
  %175 = icmp slt i64 %174, 0
  br i1 %175, label %176, label %178

176:                                              ; preds = %173
  %177 = load i64, ptr %12, align 8, !tbaa !11
  store i64 %177, ptr %13, align 8, !tbaa !11
  br label %178

178:                                              ; preds = %176, %173
  %179 = load ptr, ptr %11, align 8, !tbaa !9
  %180 = load ptr, ptr %10, align 8, !tbaa !9
  %181 = load i64, ptr %13, align 8, !tbaa !11
  %182 = load i32, ptr %15, align 4, !tbaa !5
  %183 = load i32, ptr %16, align 4, !tbaa !5
  call void @fix_up(ptr noundef %179, ptr noundef %180, ptr noundef %6, i64 noundef %181, i32 noundef %182, i32 noundef %183)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %184

184:                                              ; preds = %178, %138, %122, %117, %69, %54, %47, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 128, ptr %6) #5
  %185 = load i32, ptr %3, align 4
  ret i32 %185
}

; 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

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

declare void @perror(ptr noundef) #4

declare ptr @fsm_load(ptr noundef) #4

declare i32 @fclose(ptr noundef) #4

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

declare void @set_seed(i64 noundef) #4

; 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) #4

declare noalias ptr @tmpfile() #4

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @fix_up(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !10, i64 0}
!16 = !{!"samplestate", !10, i64 0, !10, i64 8, !10, i64 16, !12, i64 24, !6, i64 32, !7, i64 40, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !17, i64 112, !6, i64 120}
!17 = !{!"double", !7, i64 0}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !10, i64 16}
!20 = !{!16, !12, i64 24}
!21 = !{!16, !6, i64 32}
!22 = !{!16, !12, i64 80}
!23 = !{!16, !12, i64 88}
!24 = !{!16, !12, i64 96}
!25 = !{!16, !12, i64 104}
!26 = !{!16, !17, i64 112}
!27 = !{!16, !6, i64 120}


; 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.fsm = type { [25 x i32], [25 x ptr], [25 x ptr] }
%struct.samplestate = type { ptr, ptr, ptr, i64, i32, %union.pthread_mutex_t, i64, i64, i64, i64, double, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@fsm_simple = external constant %struct.fsm, align 8
@.str = external hidden unnamed_addr constant [17 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 [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [40 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 %struct.samplestate, align 8
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  br label %4

4:                                                ; preds = %.backedge, %2
  %.048 = phi ptr [ null, %2 ], [ %.048.be, %.backedge ]
  %.046 = phi i64 [ 1000, %2 ], [ %.046.be, %.backedge ]
  %.044 = phi i64 [ -1, %2 ], [ %.044.be, %.backedge ]
  %.042 = phi ptr [ @fsm_simple, %2 ], [ %.042.be, %.backedge ]
  %.040 = phi i32 [ 0, %2 ], [ %.040.be, %.backedge ]
  %.038 = phi i32 [ 0, %2 ], [ %.038.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) #8
  switch i32 %5, label %43 [
    i32 -1, label %45
    i32 100, label %6
    i32 106, label %8
    i32 109, label %15
    i32 110, label %27
    i32 78, label %30
    i32 111, label %33
    i32 114, label %.backedge
    i32 115, label %39
    i32 118, label %42
  ]

.backedge:                                        ; preds = %4, %33, %8, %43, %42, %39, %30, %27, %25, %6
  %.048.be = phi ptr [ %.048, %43 ], [ %.048, %42 ], [ %.048, %39 ], [ %35, %33 ], [ %.048, %30 ], [ %.048, %27 ], [ %.048, %25 ], [ %.048, %8 ], [ %.048, %6 ], [ %.048, %4 ]
  %.046.be = phi i64 [ %.046, %43 ], [ %.046, %42 ], [ %.046, %39 ], [ %.046, %33 ], [ %.046, %30 ], [ %29, %27 ], [ %.046, %25 ], [ %.046, %8 ], [ %.046, %6 ], [ %.046, %4 ]
  %.044.be = phi i64 [ %.044, %43 ], [ %.044, %42 ], [ %.044, %39 ], [ %.044, %33 ], [ %32, %30 ], [ %.044, %27 ], [ %.044, %25 ], [ %.044, %8 ], [ %.044, %6 ], [ %.044, %4 ]
  %.042.be = phi ptr [ %.042, %43 ], [ %.042, %42 ], [ %.042, %39 ], [ %.042, %33 ], [ %.042, %30 ], [ %.042, %27 ], [ %22, %25 ], [ %.042, %8 ], [ %.042, %6 ], [ %.042, %4 ]
  %.040.be = phi i32 [ %.040, %43 ], [ %.040, %42 ], [ %.040, %39 ], [ %.040, %33 ], [ %.040, %30 ], [ %.040, %27 ], [ %.040, %25 ], [ %.040, %8 ], [ %.040, %6 ], [ 1, %4 ]
  %.038.be = phi i32 [ %.038, %43 ], [ 1, %42 ], [ %.038, %39 ], [ %.038, %33 ], [ %.038, %30 ], [ %.038, %27 ], [ %.038, %25 ], [ %.038, %8 ], [ %.038, %6 ], [ %.038, %4 ]
  %.0.be = phi ptr [ %.0, %43 ], [ %.0, %42 ], [ %.0, %39 ], [ %.0, %33 ], [ %.0, %30 ], [ %.0, %27 ], [ %.0, %25 ], [ %.0, %8 ], [ %7, %6 ], [ %.0, %4 ]
  br label %4, !llvm.loop !5

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

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

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

15:                                               ; preds = %4
  %16 = load ptr, ptr @optarg, align 8, !tbaa !7
  %17 = tail call noalias ptr @fopen(ptr noundef %16, ptr noundef nonnull @.str.2)
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %21

19:                                               ; preds = %15
  %20 = load ptr, ptr @optarg, align 8, !tbaa !7
  tail call void @perror(ptr noundef %20) #11
  br label %103

21:                                               ; preds = %15
  %22 = tail call ptr @fsm_load(ptr noundef nonnull %17) #8
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  tail call void @perror(ptr noundef nonnull @.str.3) #11
  br label %103

25:                                               ; preds = %21
  %26 = tail call i32 @fclose(ptr noundef nonnull %17)
  br label %.backedge

27:                                               ; preds = %4
  %28 = load ptr, ptr @optarg, align 8, !tbaa !7
  %29 = tail call i64 @strtol(ptr nocapture noundef %28, ptr noundef null, i32 noundef 0) #8
  br label %.backedge

30:                                               ; preds = %4
  %31 = load ptr, ptr @optarg, align 8, !tbaa !7
  %32 = tail call i64 @strtol(ptr nocapture noundef %31, ptr noundef null, i32 noundef 0) #8
  br label %.backedge

33:                                               ; preds = %4
  %34 = load ptr, ptr @optarg, align 8, !tbaa !7
  %35 = tail call noalias ptr @fopen(ptr noundef %34, ptr noundef nonnull @.str.4)
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %.backedge

37:                                               ; preds = %33
  %38 = load ptr, ptr @optarg, align 8, !tbaa !7
  tail call void @perror(ptr noundef %38) #11
  br label %103

39:                                               ; preds = %4
  %40 = load ptr, ptr @optarg, align 8, !tbaa !7
  %41 = tail call i64 @strtoll(ptr nocapture noundef %40, ptr noundef null, i32 noundef 0) #8
  tail call void @set_seed(i64 noundef %41) #8
  br label %.backedge

42:                                               ; preds = %4
  br label %.backedge

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

45:                                               ; preds = %4
  %46 = load i32, ptr @optind, align 4, !tbaa !11
  %47 = add nsw i32 %46, 2
  %.not57 = icmp eq i32 %47, %0
  br i1 %.not57, label %50, label %48

48:                                               ; preds = %45
  %49 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %49)
  br label %50

50:                                               ; preds = %48, %45
  %51 = icmp eq ptr %.048, null
  br i1 %51, label %52, label %56

52:                                               ; preds = %50
  %53 = load ptr, ptr @stderr, align 8, !tbaa !7
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.5) #10
  %55 = load ptr, ptr %1, align 8, !tbaa !7
  tail call void @usage(ptr noundef %55)
  br label %56

56:                                               ; preds = %52, %50
  %57 = load i32, ptr @optind, align 4, !tbaa !11
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds ptr, ptr %1, i64 %58
  %60 = load ptr, ptr %59, align 8, !tbaa !7
  %.not58 = icmp eq i32 %.038, 0
  %61 = load ptr, ptr @stderr, align 8
  %62 = select i1 %.not58, ptr null, ptr %61
  %63 = tail call ptr @catalogue_load(ptr noundef %60, ptr noundef %.0, i32 noundef 0, ptr noundef %62) #8
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %66

65:                                               ; preds = %56
  tail call void @perror(ptr noundef nonnull @.str.6) #11
  br label %103

66:                                               ; preds = %56
  %67 = tail call noalias ptr @tmpfile()
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  tail call void @perror(ptr noundef nonnull @.str.7) #11
  br label %103

70:                                               ; preds = %66
  store ptr %67, ptr %3, align 8, !tbaa !13
  %71 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %.042, ptr %71, align 8, !tbaa !17
  %72 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %63, ptr %72, align 8, !tbaa !18
  %73 = getelementptr inbounds i8, ptr %3, i64 24
  store i64 %.046, ptr %73, align 8, !tbaa !19
  %74 = getelementptr inbounds i8, ptr %3, i64 32
  store i32 %.038, ptr %74, align 8, !tbaa !20
  %75 = getelementptr inbounds i8, ptr %3, i64 40
  %76 = call i32 @pthread_mutex_init(ptr noundef nonnull %75, ptr noundef null) #8
  %.not59 = icmp eq i32 %76, 0
  br i1 %.not59, label %81, label %77

77:                                               ; preds = %70
  %78 = load ptr, ptr @stderr, align 8, !tbaa !7
  %79 = call ptr @strerror(i32 noundef %76) #8
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %78, ptr noundef nonnull @.str.8, ptr noundef %79) #10
  br label %103

81:                                               ; preds = %70
  %82 = getelementptr inbounds i8, ptr %3, i64 80
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %82, i8 0, i64 40, i1 false)
  %83 = load i32, ptr @optind, align 4, !tbaa !11
  %84 = sext i32 %83 to i64
  %85 = getelementptr ptr, ptr %1, i64 %84
  %86 = getelementptr i8, ptr %85, i64 8
  %87 = load ptr, ptr %86, align 8, !tbaa !7
  %88 = call i64 @strtol(ptr nocapture noundef %87, ptr noundef null, i32 noundef 0) #8
  %89 = trunc i64 %88 to i32
  %90 = getelementptr inbounds i8, ptr %3, i64 120
  store i32 %89, ptr %90, align 8, !tbaa !21
  %91 = icmp slt i32 %89, 0
  br i1 %91, label %92, label %101

92:                                               ; preds = %81
  %93 = load ptr, ptr @stderr, align 8, !tbaa !7
  %94 = load i32, ptr @optind, align 4, !tbaa !11
  %95 = sext i32 %94 to i64
  %96 = getelementptr ptr, ptr %1, i64 %95
  %97 = getelementptr i8, ptr %96, i64 8
  %98 = load ptr, ptr %97, align 8, !tbaa !7
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.9, ptr noundef %98) #10
  %100 = load ptr, ptr %1, align 8, !tbaa !7
  call void @usage(ptr noundef %100)
  br label %101

101:                                              ; preds = %92, %81
  call void @take_samples_parallel(ptr noundef nonnull %3)
  %102 = icmp slt i64 %.044, 0
  %spec.select = select i1 %102, i64 %.046, i64 %.044
  call void @fix_up(ptr noundef %.048, ptr noundef nonnull %67, ptr noundef nonnull %3, i64 noundef %spec.select, i32 noundef %.040, i32 noundef %.038)
  br label %103

103:                                              ; preds = %101, %77, %69, %65, %37, %24, %19, %12
  %.037 = phi i32 [ 1, %37 ], [ 1, %19 ], [ 1, %24 ], [ 1, %12 ], [ 1, %65 ], [ 1, %69 ], [ 1, %77 ], [ 0, %101 ]
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  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

; 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: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

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

declare ptr @fsm_load(ptr noundef) local_unnamed_addr #5

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

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

declare void @set_seed(i64 noundef) local_unnamed_addr #5

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

; 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 #5

; Function Attrs: nofree nounwind
declare noalias noundef ptr @tmpfile() local_unnamed_addr #4

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @fix_up(ptr noundef, ptr noundef, ptr noundef, i64 noundef, i32 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

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 = { "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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { cold nounwind }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!14, !8, i64 0}
!14 = !{!"samplestate", !8, i64 0, !8, i64 8, !8, i64 16, !15, i64 24, !12, i64 32, !9, i64 40, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !16, i64 112, !12, i64 120}
!15 = !{!"long long", !9, i64 0}
!16 = !{!"double", !9, i64 0}
!17 = !{!14, !8, i64 8}
!18 = !{!14, !8, i64 16}
!19 = !{!14, !15, i64 24}
!20 = !{!14, !12, i64 32}
!21 = !{!14, !12, i64 120}


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