; LLVM IR from jgaeddert/liquid-dsp :: examples (gradsearch_example)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@optarg = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() #0

declare i32 @printf(ptr noundef, ...) #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 6, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 2000, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store ptr @liquid_rosenbrock, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  br label %18

18:                                               ; preds = %64, %2
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = call i32 @getopt(i32 noundef %19, ptr noundef %20, ptr noundef @.str.6) #8
  store i32 %21, ptr %9, align 4, !tbaa !5
  %22 = icmp ne i32 %21, -1
  br i1 %22, label %23, label %65

23:                                               ; preds = %18
  %24 = load i32, ptr %9, align 4, !tbaa !5
  switch i32 %24, label %63 [
    i32 104, label %25
    i32 110, label %26
    i32 116, label %29
    i32 117, label %32
  ]

25:                                               ; preds = %23
  call void @usage()
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %162

26:                                               ; preds = %23
  %27 = load ptr, ptr @optarg, align 8, !tbaa !9
  %28 = call i32 @atoi(ptr noundef %27) #9
  store i32 %28, ptr %6, align 4, !tbaa !5
  br label %64

29:                                               ; preds = %23
  %30 = load ptr, ptr @optarg, align 8, !tbaa !9
  %31 = call i32 @atoi(ptr noundef %30) #9
  store i32 %31, ptr %7, align 4, !tbaa !5
  br label %64

32:                                               ; preds = %23
  %33 = load ptr, ptr @optarg, align 8, !tbaa !9
  %34 = call i32 @strcmp(ptr noundef %33, ptr noundef @.str.7) #9
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store ptr @liquid_rosenbrock, ptr %8, align 8, !tbaa !9
  br label %62

37:                                               ; preds = %32
  %38 = load ptr, ptr @optarg, align 8, !tbaa !9
  %39 = call i32 @strcmp(ptr noundef %38, ptr noundef @.str.8) #9
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  store ptr @liquid_invgauss, ptr %8, align 8, !tbaa !9
  br label %61

42:                                               ; preds = %37
  %43 = load ptr, ptr @optarg, align 8, !tbaa !9
  %44 = call i32 @strcmp(ptr noundef %43, ptr noundef @.str.9) #9
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %42
  store ptr @liquid_multimodal, ptr %8, align 8, !tbaa !9
  br label %60

47:                                               ; preds = %42
  %48 = load ptr, ptr @optarg, align 8, !tbaa !9
  %49 = call i32 @strcmp(ptr noundef %48, ptr noundef @.str.10) #9
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  store ptr @liquid_spiral, ptr %8, align 8, !tbaa !9
  br label %59

52:                                               ; preds = %47
  %53 = load ptr, ptr @stderr, align 8, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = getelementptr inbounds ptr, ptr %54, i64 0
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = load ptr, ptr @optarg, align 8, !tbaa !9
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.11, ptr noundef %56, ptr noundef %57) #8
  call void @exit(i32 noundef 1) #10
  unreachable

59:                                               ; preds = %51
  br label %60

60:                                               ; preds = %59, %46
  br label %61

61:                                               ; preds = %60, %41
  br label %62

62:                                               ; preds = %61, %36
  br label %64

63:                                               ; preds = %23
  call void @exit(i32 noundef 1) #10
  unreachable

64:                                               ; preds = %62, %29, %26
  br label %18, !llvm.loop !11

65:                                               ; preds = %18
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = call ptr @llvm.stacksave.p0()
  store ptr %68, ptr %11, align 8
  %69 = alloca float, i64 %67, align 16
  store i64 %67, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %81, %65
  %71 = load i32, ptr %13, align 4, !tbaa !5
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = icmp ult i32 %71, %72
  br i1 %73, label %74, label %84

74:                                               ; preds = %70
  %75 = load i32, ptr %13, align 4, !tbaa !5
  %76 = uitofp i32 %75 to float
  %77 = fmul float 0x3FB99999A0000000, %76
  %78 = load i32, ptr %13, align 4, !tbaa !5
  %79 = zext i32 %78 to i64
  %80 = getelementptr inbounds float, ptr %69, i64 %79
  store float %77, ptr %80, align 4, !tbaa !13
  br label %81

81:                                               ; preds = %74
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = add i32 %82, 1
  store i32 %83, ptr %13, align 4, !tbaa !5
  br label %70, !llvm.loop !15

84:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %85 = call noalias ptr @fopen(ptr noundef @.str.12, ptr noundef @.str.13)
  store ptr %85, ptr %15, align 8, !tbaa !9
  %86 = load ptr, ptr %15, align 8, !tbaa !9
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.14, ptr noundef @.str.12) #8
  %88 = load ptr, ptr %15, align 8, !tbaa !9
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.15) #8
  %90 = load ptr, ptr %15, align 8, !tbaa !9
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %90, ptr noundef @.str.16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = load ptr, ptr %8, align 8, !tbaa !9
  %94 = call ptr @gradsearch_create(ptr noundef null, ptr noundef %69, i32 noundef %92, ptr noundef %93, i32 noundef 0)
  store ptr %94, ptr %16, align 8, !tbaa !9
  %95 = load ptr, ptr %15, align 8, !tbaa !9
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef @.str.17, i32 noundef %96) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 1, ptr %17, align 4, !tbaa !5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %137, %84
  %99 = load i32, ptr %13, align 4, !tbaa !5
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = icmp ult i32 %99, %100
  br i1 %101, label %102, label %140

102:                                              ; preds = %98
  %103 = load ptr, ptr %8, align 8, !tbaa !9
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = call float %103(ptr noundef null, ptr noundef %69, i32 noundef %104)
  store float %105, ptr %14, align 4, !tbaa !13
  %106 = load ptr, ptr %15, align 8, !tbaa !9
  %107 = load i32, ptr %13, align 4, !tbaa !5
  %108 = add i32 %107, 1
  %109 = load float, ptr %14, align 4, !tbaa !13
  %110 = fpext float %109 to double
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.18, i32 noundef %108, double noundef %110) #8
  %112 = load ptr, ptr %16, align 8, !tbaa !9
  %113 = call float @gradsearch_step(ptr noundef %112)
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = add i32 %114, 1
  %116 = load i32, ptr %17, align 4, !tbaa !5
  %117 = urem i32 %115, %116
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %122, label %119

119:                                              ; preds = %102
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = icmp eq i32 %120, 0
  br i1 %121, label %122, label %136

122:                                              ; preds = %119, %102
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = add i32 %123, 1
  %125 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %124)
  %126 = load ptr, ptr %16, align 8, !tbaa !9
  call void @gradsearch_print(ptr noundef %126)
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = add i32 %127, 1
  %129 = load i32, ptr %17, align 4, !tbaa !5
  %130 = mul i32 10, %129
  %131 = icmp eq i32 %128, %130
  br i1 %131, label %132, label %135

132:                                              ; preds = %122
  %133 = load i32, ptr %17, align 4, !tbaa !5
  %134 = mul i32 %133, 10
  store i32 %134, ptr %17, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %132, %122
  br label %136

136:                                              ; preds = %135, %119
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %13, align 4, !tbaa !5
  %139 = add i32 %138, 1
  store i32 %139, ptr %13, align 4, !tbaa !5
  br label %98, !llvm.loop !16

140:                                              ; preds = %98
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %142)
  %144 = load ptr, ptr %16, align 8, !tbaa !9
  call void @gradsearch_print(ptr noundef %144)
  %145 = load ptr, ptr %15, align 8, !tbaa !9
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.21) #8
  %147 = load ptr, ptr %15, align 8, !tbaa !9
  %148 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef @.str.22) #8
  %149 = load ptr, ptr %15, align 8, !tbaa !9
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %149, ptr noundef @.str.23) #8
  %151 = load ptr, ptr %15, align 8, !tbaa !9
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef @.str.24) #8
  %153 = load ptr, ptr %15, align 8, !tbaa !9
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef @.str.25) #8
  %155 = load ptr, ptr %15, align 8, !tbaa !9
  %156 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %155, ptr noundef @.str.26) #8
  %157 = load ptr, ptr %15, align 8, !tbaa !9
  %158 = call i32 @fclose(ptr noundef %157)
  %159 = call i32 (ptr, ...) @printf(ptr noundef @.str.27, ptr noundef @.str.12)
  %160 = load ptr, ptr %16, align 8, !tbaa !9
  call void @gradsearch_destroy(ptr noundef %160)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, 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
  %161 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %161)
  br label %162

162:                                              ; preds = %140, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %163 = load i32, ptr %3, align 4
  ret i32 %163
}

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

declare float @liquid_rosenbrock(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

declare float @liquid_invgauss(ptr noundef, ptr noundef, i32 noundef) #1

declare float @liquid_multimodal(ptr noundef, ptr noundef, i32 noundef) #1

declare float @liquid_spiral(ptr noundef, ptr noundef, i32 noundef) #1

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #7

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

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

declare float @gradsearch_step(ptr noundef) #1

declare void @gradsearch_print(ptr noundef) #1

declare i32 @fclose(ptr noundef) #1

declare void @gradsearch_destroy(ptr noundef) #1

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nocallback nofree nosync nounwind willreturn }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  br label %.outer

.outer:                                           ; preds = %.outer.backedge, %2
  %.053.ph = phi ptr [ @liquid_rosenbrock, %2 ], [ %.053.ph.be, %.outer.backedge ]
  %.049.ph = phi i32 [ 2000, %2 ], [ %.049.ph106, %.outer.backedge ]
  %.047.ph = phi i32 [ 6, %2 ], [ %.047, %.outer.backedge ]
  br label %.outer105

.outer105:                                        ; preds = %.outer, %9
  %.049.ph106 = phi i32 [ %.049.ph, %.outer ], [ %11, %9 ]
  %.047.ph107 = phi i32 [ %.047.ph, %.outer ], [ %.047, %9 ]
  br label %3

3:                                                ; preds = %.outer105, %6
  %.047 = phi i32 [ %8, %6 ], [ %.047.ph107, %.outer105 ]
  %4 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str.6) #8
  switch i32 %4, label %29 [
    i32 -1, label %30
    i32 104, label %5
    i32 110, label %6
    i32 116, label %9
    i32 117, label %12
  ]

5:                                                ; preds = %3
  tail call void @usage()
  br label %79

6:                                                ; preds = %3
  %7 = load ptr, ptr @optarg, align 8, !tbaa !5
  %8 = tail call i32 @atoi(ptr nocapture noundef %7) #9
  br label %3, !llvm.loop !9

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

12:                                               ; preds = %3
  %13 = load ptr, ptr @optarg, align 8, !tbaa !5
  %14 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.7) #9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %.outer.backedge, label %16

.outer.backedge:                                  ; preds = %12, %16, %19, %22
  %.053.ph.be = phi ptr [ @liquid_spiral, %22 ], [ @liquid_multimodal, %19 ], [ @liquid_invgauss, %16 ], [ @liquid_rosenbrock, %12 ]
  br label %.outer, !llvm.loop !9

16:                                               ; preds = %12
  %17 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.8) #9
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %.outer.backedge, label %19

19:                                               ; preds = %16
  %20 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.9) #9
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %.outer.backedge, label %22

22:                                               ; preds = %19
  %23 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.10) #9
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %.outer.backedge, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str.11, ptr noundef %27, ptr noundef %13) #10
  tail call void @exit(i32 noundef 1) #11
  unreachable

29:                                               ; preds = %3
  tail call void @exit(i32 noundef 1) #11
  unreachable

30:                                               ; preds = %3
  %31 = zext i32 %.047 to i64
  %32 = tail call ptr @llvm.stacksave.p0()
  %33 = alloca float, i64 %31, align 16
  %.not = icmp eq i32 %.047, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %30
  %min.iters.check = icmp ult i32 %.047, 8
  br i1 %min.iters.check, label %.lr.ph.preheader104, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %31, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %34 = uitofp <4 x i32> %vec.ind to <4 x float>
  %35 = uitofp <4 x i32> %step.add to <4 x float>
  %36 = fmul <4 x float> %34, <float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000>
  %37 = fmul <4 x float> %35, <float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000, float 0x3FB99999A0000000>
  %38 = getelementptr inbounds float, ptr %33, i64 %index
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  store <4 x float> %36, ptr %38, align 16, !tbaa !11
  store <4 x float> %37, ptr %39, align 16, !tbaa !11
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %40 = icmp eq i64 %index.next, %n.vec
  br i1 %40, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %31
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader104

.lr.ph.preheader104:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader104, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader104 ]
  %41 = trunc nuw i64 %indvars.iv to i32
  %42 = uitofp i32 %41 to float
  %43 = fmul float %42, 0x3FB99999A0000000
  %44 = getelementptr inbounds float, ptr %33, i64 %indvars.iv
  store float %43, ptr %44, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %31
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %30
  %45 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13)
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.12) #8
  %47 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.15) #8
  %48 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.16) #8
  %49 = call ptr @gradsearch_create(ptr noundef null, ptr noundef nonnull %33, i32 noundef %.047, ptr noundef nonnull %.053.ph, i32 noundef 0) #8
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.17, i32 noundef %.049.ph106) #8
  %.not72 = icmp eq i32 %.049.ph106, 0
  br i1 %.not72, label %._crit_edge71, label %51

51:                                               ; preds = %._crit_edge
  %52 = call float %.053.ph(ptr noundef null, ptr noundef nonnull %33, i32 noundef %.047) #8, !callees !17
  %53 = fpext float %52 to double
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.18, i32 noundef 1, double noundef %53) #8
  %55 = call float @gradsearch_step(ptr noundef %49) #8
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef 1)
  call void @gradsearch_print(ptr noundef %49) #8
  %exitcond83.peel.not = icmp eq i32 %.049.ph106, 1
  br i1 %exitcond83.peel.not, label %._crit_edge71, label %.lr.ph70

.lr.ph70:                                         ; preds = %51, %68
  %.068 = phi i32 [ %.1, %68 ], [ 1, %51 ]
  %.15267 = phi i32 [ %58, %68 ], [ 1, %51 ]
  %57 = call float %.053.ph(ptr noundef null, ptr noundef nonnull %33, i32 noundef %.047) #8, !callees !17
  %58 = add nuw i32 %.15267, 1
  %59 = fpext float %57 to double
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.18, i32 noundef %58, double noundef %59) #8
  %61 = call float @gradsearch_step(ptr noundef %49) #8
  %62 = urem i32 %58, %.068
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %64, label %68

64:                                               ; preds = %.lr.ph70
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %58)
  call void @gradsearch_print(ptr noundef %49) #8
  %66 = mul i32 %.068, 10
  %67 = icmp eq i32 %58, %66
  %spec.select = select i1 %67, i32 %66, i32 %.068
  br label %68

68:                                               ; preds = %64, %.lr.ph70
  %.1 = phi i32 [ %.068, %.lr.ph70 ], [ %spec.select, %64 ]
  %exitcond83.not = icmp eq i32 %58, %.049.ph106
  br i1 %exitcond83.not, label %._crit_edge71, label %.lr.ph70, !llvm.loop !18

._crit_edge71:                                    ; preds = %68, %51, %._crit_edge
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20)
  %70 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %.049.ph106)
  call void @gradsearch_print(ptr noundef %49) #8
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.21) #8
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.22) #8
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.23) #8
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.24) #8
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.25) #8
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef nonnull @.str.26) #8
  %77 = call i32 @fclose(ptr noundef %45)
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.27, ptr noundef nonnull @.str.12)
  call void @gradsearch_destroy(ptr noundef %49) #8
  call void @llvm.stackrestore.p0(ptr %32)
  br label %79

79:                                               ; preds = %._crit_edge71, %5
  ret i32 0
}

declare float @liquid_rosenbrock(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

declare float @liquid_invgauss(ptr noundef, ptr noundef, i32 noundef) #2

declare float @liquid_multimodal(ptr noundef, ptr noundef, i32 noundef) #2

declare float @liquid_spiral(ptr noundef, ptr noundef, i32 noundef) #2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #7

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

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

declare float @gradsearch_step(ptr noundef) local_unnamed_addr #2

declare void @gradsearch_print(ptr noundef) local_unnamed_addr #2

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

declare void @gradsearch_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { cold nounwind }
attributes #11 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = !{ptr @liquid_invgauss, ptr @liquid_multimodal, ptr @liquid_rosenbrock, ptr @liquid_spiral}
!18 = distinct !{!18, !10, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CalledValuePropagationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass