; LLVM IR from jgaeddert/liquid-dsp :: examples (gradsearch_datafit_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"

%struct.gsdataset = type { ptr, ptr, i32 }

@__const.main.v = external hidden unnamed_addr constant [3 x float], align 4
@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local float @gsfunc(float noundef, ptr noundef) #0

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

declare float @sincf(float noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca float, align 4
  %4 = alloca i32, align 4
  %5 = alloca [3 x float], align 4
  %6 = alloca i32, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca %struct.gsdataset, align 8
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 400, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store float 0x3FB99999A0000000, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 1000, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 @__const.main.v, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store float 0.000000e+00, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store float 6.000000e+00, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %17 = load float, ptr %8, align 4, !tbaa !9
  %18 = load float, ptr %7, align 4, !tbaa !9
  %19 = fsub float %17, %18
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sub i32 %20, 1
  %22 = uitofp i32 %21 to float
  %23 = fdiv float %19, %22
  store float %23, ptr %9, align 4, !tbaa !9
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %10, align 8
  %27 = alloca float, i64 %25, align 16
  store i64 %25, ptr %11, align 8
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = zext i32 %28 to i64
  %30 = alloca float, i64 %29, align 16
  store i64 %29, ptr %12, align 8
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %55, %0
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp ult i32 %32, %33
  br i1 %34, label %35, label %58

35:                                               ; preds = %31
  %36 = load float, ptr %7, align 4, !tbaa !9
  %37 = load i32, ptr %6, align 4, !tbaa !5
  %38 = uitofp i32 %37 to float
  %39 = load float, ptr %9, align 4, !tbaa !9
  %40 = call float @llvm.fmuladd.f32(float %38, float %39, float %36)
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds float, ptr %27, i64 %42
  store float %40, ptr %43, align 4, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = getelementptr inbounds float, ptr %27, i64 %45
  %47 = load float, ptr %46, align 4, !tbaa !9
  %48 = call float @sincf(float noundef %47)
  %49 = call float (...) @randnf()
  %50 = load float, ptr %3, align 4, !tbaa !9
  %51 = call float @llvm.fmuladd.f32(float %49, float %50, float %48)
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds float, ptr %30, i64 %53
  store float %51, ptr %54, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %35
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = add i32 %56, 1
  store i32 %57, ptr %6, align 4, !tbaa !5
  br label %31, !llvm.loop !11

58:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  %59 = getelementptr inbounds %struct.gsdataset, ptr %13, i32 0, i32 0
  store ptr %27, ptr %59, align 8, !tbaa !13
  %60 = getelementptr inbounds %struct.gsdataset, ptr %13, i32 0, i32 1
  store ptr %30, ptr %60, align 8, !tbaa !16
  %61 = getelementptr inbounds %struct.gsdataset, ptr %13, i32 0, i32 2
  %62 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %62, ptr %61, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %63 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 0
  %64 = call ptr @gradsearch_create(ptr noundef %13, ptr noundef %63, i32 noundef 3, ptr noundef @gserror, i32 noundef 0)
  store ptr %64, ptr %14, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %65 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.1)
  store ptr %65, ptr %16, align 8, !tbaa !18
  %66 = load ptr, ptr %16, align 8, !tbaa !18
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str.2, ptr noundef @.str) #7
  %68 = load ptr, ptr %16, align 8, !tbaa !18
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.3) #7
  %70 = load ptr, ptr %16, align 8, !tbaa !18
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.4) #7
  %72 = load ptr, ptr %16, align 8, !tbaa !18
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.5, i32 noundef %73) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %97, %58
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr %4, align 4, !tbaa !5
  %78 = icmp ult i32 %76, %77
  br i1 %78, label %79, label %100

79:                                               ; preds = %75
  %80 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 0
  %81 = call float @gserror(ptr noundef %13, ptr noundef %80, i32 noundef 3)
  store float %81, ptr %15, align 4, !tbaa !9
  %82 = load ptr, ptr %16, align 8, !tbaa !18
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = add i32 %83, 1
  %85 = load float, ptr %15, align 4, !tbaa !9
  %86 = fpext float %85 to double
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.6, i32 noundef %84, double noundef %86) #7
  %88 = load ptr, ptr %14, align 8, !tbaa !18
  %89 = call float @gradsearch_step(ptr noundef %88)
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = add i32 %90, 1
  %92 = urem i32 %91, 100
  %93 = icmp eq i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %79
  %95 = load ptr, ptr %14, align 8, !tbaa !18
  call void @gradsearch_print(ptr noundef %95)
  br label %96

96:                                               ; preds = %94, %79
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = add i32 %98, 1
  store i32 %99, ptr %6, align 4, !tbaa !5
  br label %75, !llvm.loop !19

100:                                              ; preds = %75
  %101 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %102 = load ptr, ptr %14, align 8, !tbaa !18
  call void @gradsearch_print(ptr noundef %102)
  %103 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 0
  %104 = load float, ptr %103, align 4, !tbaa !9
  %105 = fpext float %104 to double
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, double noundef %105)
  %107 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 1
  %108 = load float, ptr %107, align 4, !tbaa !9
  %109 = fpext float %108 to double
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, double noundef %109)
  %111 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 2
  %112 = load float, ptr %111, align 4, !tbaa !9
  %113 = fpext float %112 to double
  %114 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, double noundef %113)
  %115 = load float, ptr %15, align 4, !tbaa !9
  %116 = fpext float %115 to double
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, double noundef %116)
  %118 = load ptr, ptr %16, align 8, !tbaa !18
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.12) #7
  %120 = load ptr, ptr %16, align 8, !tbaa !18
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str.13) #7
  %122 = load ptr, ptr %16, align 8, !tbaa !18
  %123 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str.14) #7
  %124 = load ptr, ptr %16, align 8, !tbaa !18
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %124, ptr noundef @.str.15) #7
  %126 = load ptr, ptr %16, align 8, !tbaa !18
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.16) #7
  %128 = load ptr, ptr %16, align 8, !tbaa !18
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.17) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %164, %100
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = load i32, ptr %2, align 4, !tbaa !5
  %133 = icmp ult i32 %131, %132
  br i1 %133, label %134, label %167

134:                                              ; preds = %130
  %135 = load ptr, ptr %16, align 8, !tbaa !18
  %136 = load i32, ptr %6, align 4, !tbaa !5
  %137 = add i32 %136, 1
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = zext i32 %138 to i64
  %140 = getelementptr inbounds float, ptr %27, i64 %139
  %141 = load float, ptr %140, align 4, !tbaa !9
  %142 = fpext float %141 to double
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.18, i32 noundef %137, double noundef %142) #7
  %144 = load ptr, ptr %16, align 8, !tbaa !18
  %145 = load i32, ptr %6, align 4, !tbaa !5
  %146 = add i32 %145, 1
  %147 = load i32, ptr %6, align 4, !tbaa !5
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds float, ptr %30, i64 %148
  %150 = load float, ptr %149, align 4, !tbaa !9
  %151 = fpext float %150 to double
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %144, ptr noundef @.str.19, i32 noundef %146, double noundef %151) #7
  %153 = load ptr, ptr %16, align 8, !tbaa !18
  %154 = load i32, ptr %6, align 4, !tbaa !5
  %155 = add i32 %154, 1
  %156 = load i32, ptr %6, align 4, !tbaa !5
  %157 = zext i32 %156 to i64
  %158 = getelementptr inbounds float, ptr %27, i64 %157
  %159 = load float, ptr %158, align 4, !tbaa !9
  %160 = getelementptr inbounds [3 x float], ptr %5, i64 0, i64 0
  %161 = call float @gsfunc(float noundef %159, ptr noundef %160)
  %162 = fpext float %161 to double
  %163 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef @.str.20, i32 noundef %155, double noundef %162) #7
  br label %164

164:                                              ; preds = %134
  %165 = load i32, ptr %6, align 4, !tbaa !5
  %166 = add i32 %165, 1
  store i32 %166, ptr %6, align 4, !tbaa !5
  br label %130, !llvm.loop !20

167:                                              ; preds = %130
  %168 = load ptr, ptr %16, align 8, !tbaa !18
  %169 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef @.str.12) #7
  %170 = load ptr, ptr %16, align 8, !tbaa !18
  %171 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %170, ptr noundef @.str.21) #7
  %172 = load ptr, ptr %16, align 8, !tbaa !18
  %173 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %172, ptr noundef @.str.22) #7
  %174 = load ptr, ptr %16, align 8, !tbaa !18
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.23) #7
  %176 = load ptr, ptr %16, align 8, !tbaa !18
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %176, ptr noundef @.str.17) #7
  %178 = load ptr, ptr %16, align 8, !tbaa !18
  %179 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %178, ptr noundef @.str.24) #7
  %180 = load ptr, ptr %16, align 8, !tbaa !18
  %181 = call i32 @fclose(ptr noundef %180)
  %182 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, ptr noundef @.str)
  %183 = load ptr, ptr %14, align 8, !tbaa !18
  call void @gradsearch_destroy(ptr noundef %183)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  %184 = load ptr, ptr %10, align 8
  call void @llvm.stackrestore.p0(ptr %184)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %185 = load i32, ptr %1, align 4
  ret i32 %185
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #5

declare float @randnf(...) #2

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

; Function Attrs: nounwind uwtable
declare dso_local float @gserror(ptr noundef, ptr noundef, i32 noundef) #0

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

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

declare float @gradsearch_step(ptr noundef) #2

declare void @gradsearch_print(ptr noundef) #2

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

declare i32 @fclose(ptr noundef) #2

declare void @gradsearch_destroy(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!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 = !{!"float", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !15, i64 0}
!14 = !{!"gsdataset", !15, i64 0, !15, i64 8, !6, i64 16}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = !{!14, !6, i64 16}
!18 = !{!15, !15, i64 0}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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"

%struct.gsdataset = type { ptr, ptr, i32 }

@__const.main.v = external hidden unnamed_addr constant [3 x float], align 4
@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local float @gsfunc(float noundef, ptr noundef) local_unnamed_addr #0

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

declare float @sincf(float noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [3 x float], align 4
  %2 = alloca %struct.gsdataset, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) @__const.main.v, i64 12, i1 false)
  %3 = tail call ptr @llvm.stacksave.p0()
  %4 = alloca [400 x float], align 16
  %5 = alloca [400 x float], align 16
  br label %6

6:                                                ; preds = %0, %6
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %6 ]
  %7 = trunc nuw nsw i64 %indvars.iv to i32
  %8 = uitofp nneg i32 %7 to float
  %9 = tail call float @llvm.fmuladd.f32(float %8, float 0x3F8ECC07C0000000, float 0.000000e+00)
  %10 = getelementptr inbounds float, ptr %4, i64 %indvars.iv
  store float %9, ptr %10, align 4, !tbaa !5
  %11 = tail call float @sincf(float noundef %9) #7
  %12 = tail call float (...) @randnf() #7
  %13 = tail call float @llvm.fmuladd.f32(float %12, float 0x3FB99999A0000000, float %11)
  %14 = getelementptr inbounds float, ptr %5, i64 %indvars.iv
  store float %13, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 400
  br i1 %exitcond.not, label %15, label %6, !llvm.loop !9

15:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #7
  store ptr %4, ptr %2, align 8, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %2, i64 8
  store ptr %5, ptr %16, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 400, ptr %17, align 8, !tbaa !16
  %18 = call ptr @gradsearch_create(ptr noundef nonnull %2, ptr noundef nonnull %1, i32 noundef 3, ptr noundef nonnull @gserror, i32 noundef 0) #7
  %19 = call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1)
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str) #7
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.3) #7
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.4) #7
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.5, i32 noundef 1000) #7
  br label %24

24:                                               ; preds = %15, %33
  %.161 = phi i32 [ 0, %15 ], [ %26, %33 ]
  %25 = call float @gserror(ptr noundef nonnull %2, ptr noundef nonnull %1, i32 noundef 3)
  %26 = add nuw nsw i32 %.161, 1
  %27 = fpext float %25 to double
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.6, i32 noundef %26, double noundef %27) #7
  %29 = call float @gradsearch_step(ptr noundef %18) #7
  %.lhs.trunc = trunc nuw i32 %26 to i16
  %30 = urem i16 %.lhs.trunc, 100
  %31 = icmp eq i16 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %24
  call void @gradsearch_print(ptr noundef %18) #7
  br label %33

33:                                               ; preds = %24, %32
  %exitcond64.not = icmp eq i32 %26, 1000
  br i1 %exitcond64.not, label %34, label %24, !llvm.loop !17

34:                                               ; preds = %33
  %35 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  call void @gradsearch_print(ptr noundef %18) #7
  %36 = load float, ptr %1, align 4, !tbaa !5
  %37 = fpext float %36 to double
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, double noundef %37)
  %39 = getelementptr inbounds i8, ptr %1, i64 4
  %40 = load float, ptr %39, align 4, !tbaa !5
  %41 = fpext float %40 to double
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, double noundef %41)
  %43 = getelementptr inbounds i8, ptr %1, i64 8
  %44 = load float, ptr %43, align 4, !tbaa !5
  %45 = fpext float %44 to double
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, double noundef %45)
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, double noundef %27)
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.12) #7
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.13) #7
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.14) #7
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.15) #7
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.16) #7
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.17) #7
  br label %54

54:                                               ; preds = %34, %54
  %indvars.iv65 = phi i64 [ 0, %34 ], [ %indvars.iv.next66, %54 ]
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %55 = getelementptr inbounds float, ptr %4, i64 %indvars.iv65
  %56 = load float, ptr %55, align 4, !tbaa !5
  %57 = fpext float %56 to double
  %58 = trunc nuw nsw i64 %indvars.iv.next66 to i32
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.18, i32 noundef %58, double noundef %57) #7
  %60 = getelementptr inbounds float, ptr %5, i64 %indvars.iv65
  %61 = load float, ptr %60, align 4, !tbaa !5
  %62 = fpext float %61 to double
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.19, i32 noundef %58, double noundef %62) #7
  %64 = load float, ptr %55, align 4, !tbaa !5
  %65 = call float @gsfunc(float noundef %64, ptr noundef nonnull %1)
  %66 = fpext float %65 to double
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.20, i32 noundef %58, double noundef %66) #7
  %exitcond68.not = icmp eq i64 %indvars.iv.next66, 400
  br i1 %exitcond68.not, label %68, label %54, !llvm.loop !18

68:                                               ; preds = %54
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.12) #7
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.21) #7
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.22) #7
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.23) #7
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.17) #7
  %74 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.24) #7
  %75 = call i32 @fclose(ptr noundef %19)
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, ptr noundef nonnull @.str)
  call void @gradsearch_destroy(ptr noundef %18) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  call void @llvm.stackrestore.p0(ptr %3)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #7
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #5

declare float @randnf(...) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local float @gserror(ptr noundef, ptr noundef, i32 noundef) #0

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

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

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 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #6

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

declare void @gradsearch_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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


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