; LLVM IR from jgaeddert/liquid-dsp :: src/fft/src (spgramcf)

; 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.spgramcf_s = type { i32, i32, i32, i32, float, float, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i64, i64, i64, i64, float, float }

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [22 x i8], align 1
@__const.spgramcf_export_gnuplot.plot_with = external hidden unnamed_addr constant [6 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @spgramcf_get_psd(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @spgramcf_export_gnuplot(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [6 x i8], align 1
  %9 = alloca i8, align 1
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noalias ptr @fopen(ptr noundef %16, ptr noundef @.str.20)
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %23

20:                                               ; preds = %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 10, ptr noundef @.str.8, i32 noundef 492, ptr noundef @.str.21, ptr noundef @.str.2, ptr noundef %21)
  store i32 %22, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %184

23:                                               ; preds = %2
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef @.str.22, ptr noundef %25) #7
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.23) #7
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef @.str.24) #7
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.25, ptr noundef %32) #7
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.26) #7
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str.27) #7
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef @.str.28) #7
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.29) #7
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.30) #7
  call void @llvm.lifetime.start.p0(i64 6, ptr %8) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %8, ptr align 1 @__const.spgramcf_export_gnuplot.plot_with, i64 6, i1 false)
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.31) #7
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.spgramcf_s, ptr %46, i32 0, i32 19
  %48 = load float, ptr %47, align 4, !tbaa !9
  %49 = fcmp olt float %48, 0.000000e+00
  br i1 %49, label %50, label %58

50:                                               ; preds = %23
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.32) #7
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.33) #7
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds [6 x i8], ptr %8, i64 0, i64 0
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.34, ptr noundef %56) #7
  br label %141

58:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #7
  store i8 32, ptr %9, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store float 1.000000e+00, ptr %10, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.spgramcf_s, ptr %59, i32 0, i32 18
  %61 = load float, ptr %60, align 8, !tbaa !16
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.spgramcf_s, ptr %62, i32 0, i32 19
  %64 = load float, ptr %63, align 4, !tbaa !9
  %65 = fdiv float %64, 2.000000e+00
  %66 = fsub float %61, %65
  %67 = call float @llvm.fabs.f32(float %66)
  store float %67, ptr %11, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.spgramcf_s, ptr %68, i32 0, i32 18
  %70 = load float, ptr %69, align 8, !tbaa !16
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.spgramcf_s, ptr %71, i32 0, i32 19
  %73 = load float, ptr %72, align 4, !tbaa !9
  %74 = fdiv float %73, 2.000000e+00
  %75 = fadd float %70, %74
  %76 = call float @llvm.fabs.f32(float %75)
  store float %76, ptr %12, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %77 = load float, ptr %11, align 4, !tbaa !15
  %78 = load float, ptr %12, align 4, !tbaa !15
  %79 = fcmp ogt float %77, %78
  br i1 %79, label %80, label %82

80:                                               ; preds = %58
  %81 = load float, ptr %11, align 4, !tbaa !15
  br label %84

82:                                               ; preds = %58
  %83 = load float, ptr %12, align 4, !tbaa !15
  br label %84

84:                                               ; preds = %82, %80
  %85 = phi float [ %81, %80 ], [ %83, %82 ]
  store float %85, ptr %13, align 4, !tbaa !15
  %86 = load float, ptr %13, align 4, !tbaa !15
  %87 = call i32 @liquid_get_scale(float noundef %86, ptr noundef %9, ptr noundef %10)
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load i8, ptr %9, align 1, !tbaa !14
  %90 = sext i8 %89 to i32
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %88, ptr noundef @.str.35, i32 noundef %90) #7
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load float, ptr %10, align 4, !tbaa !15
  %94 = fpext float %93 to double
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.spgramcf_s, ptr %95, i32 0, i32 18
  %97 = load float, ptr %96, align 8, !tbaa !16
  %98 = fpext float %97 to double
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.spgramcf_s, ptr %99, i32 0, i32 19
  %101 = load float, ptr %100, align 4, !tbaa !9
  %102 = fpext float %101 to double
  %103 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %102, double %98)
  %104 = fmul double %94, %103
  %105 = load float, ptr %10, align 4, !tbaa !15
  %106 = fpext float %105 to double
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.spgramcf_s, ptr %107, i32 0, i32 18
  %109 = load float, ptr %108, align 8, !tbaa !16
  %110 = fpext float %109 to double
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.spgramcf_s, ptr %111, i32 0, i32 19
  %113 = load float, ptr %112, align 4, !tbaa !9
  %114 = fpext float %113 to double
  %115 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %114, double %110)
  %116 = fmul double %106, %115
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.36, double noundef %104, double noundef %116) #7
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = load float, ptr %10, align 4, !tbaa !15
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.spgramcf_s, ptr %120, i32 0, i32 19
  %122 = load float, ptr %121, align 4, !tbaa !9
  %123 = fcmp olt float %122, 0.000000e+00
  br i1 %123, label %124, label %125

124:                                              ; preds = %84
  br label %129

125:                                              ; preds = %84
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.spgramcf_s, ptr %126, i32 0, i32 19
  %128 = load float, ptr %127, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %125, %124
  %130 = phi float [ 1.000000e+00, %124 ], [ %128, %125 ]
  %131 = fmul float %119, %130
  %132 = fpext float %131 to double
  %133 = load float, ptr %10, align 4, !tbaa !15
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.spgramcf_s, ptr %134, i32 0, i32 18
  %136 = load float, ptr %135, align 8, !tbaa !16
  %137 = fmul float %133, %136
  %138 = fpext float %137 to double
  %139 = getelementptr inbounds [6 x i8], ptr %8, i64 0, i64 0
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.37, double noundef %132, double noundef %138, ptr noundef %139) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #7
  br label %141

141:                                              ; preds = %129, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.spgramcf_s, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 8, !tbaa !17
  %145 = zext i32 %144 to i64
  %146 = mul i64 %145, 4
  %147 = call noalias ptr @malloc(i64 noundef %146) #8
  store ptr %147, ptr %14, align 8, !tbaa !5
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  %150 = call i32 @spgramcf_get_psd(ptr noundef %148, ptr noundef %149)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !18
  br label %151

151:                                              ; preds = %175, %141
  %152 = load i32, ptr %15, align 4, !tbaa !18
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.spgramcf_s, ptr %153, i32 0, i32 0
  %155 = load i32, ptr %154, align 8, !tbaa !17
  %156 = icmp ult i32 %152, %155
  br i1 %156, label %157, label %178

157:                                              ; preds = %151
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = load i32, ptr %15, align 4, !tbaa !18
  %160 = uitofp i32 %159 to float
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.spgramcf_s, ptr %161, i32 0, i32 0
  %163 = load i32, ptr %162, align 8, !tbaa !17
  %164 = uitofp i32 %163 to float
  %165 = fdiv float %160, %164
  %166 = fsub float %165, 5.000000e-01
  %167 = fpext float %166 to double
  %168 = load ptr, ptr %14, align 8, !tbaa !5
  %169 = load i32, ptr %15, align 4, !tbaa !18
  %170 = zext i32 %169 to i64
  %171 = getelementptr inbounds float, ptr %168, i64 %170
  %172 = load float, ptr %171, align 4, !tbaa !15
  %173 = fpext float %172 to double
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %158, ptr noundef @.str.38, double noundef %167, double noundef %173) #7
  br label %175

175:                                              ; preds = %157
  %176 = load i32, ptr %15, align 4, !tbaa !18
  %177 = add i32 %176, 1
  store i32 %177, ptr %15, align 4, !tbaa !18
  br label %151, !llvm.loop !19

178:                                              ; preds = %151
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %179) #7
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %180, ptr noundef @.str.39) #7
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = call i32 @fclose(ptr noundef %182)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  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 6, ptr %8) #7
  br label %184

184:                                              ; preds = %178, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %185 = load i32, ptr %3, align 4
  ret i32 %185
}

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

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

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

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

declare i32 @liquid_get_scale(float noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

declare i32 @fclose(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

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

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


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

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [22 x i8], align 1
@__const.spgramcf_export_gnuplot.plot_with = external hidden unnamed_addr constant [6 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @spgramcf_get_psd(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local i32 @spgramcf_export_gnuplot(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca [6 x i8], align 1
  %4 = alloca i8, align 1
  %5 = alloca float, align 4
  %6 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.20)
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %10

8:                                                ; preds = %2
  %9 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 10, ptr noundef nonnull @.str.8, i32 noundef 492, ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.2, ptr noundef %1) #8
  br label %86

10:                                               ; preds = %2
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.22, ptr noundef %1) #8
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.23) #8
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.24) #8
  %14 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.25, ptr noundef %1) #8
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.26) #8
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.27) #8
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.28) #8
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.29) #8
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.30) #8
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %3) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(6) %3, ptr noundef nonnull align 1 dereferenceable(6) @__const.spgramcf_export_gnuplot.plot_with, i64 6, i1 false)
  %20 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.31) #8
  %21 = getelementptr inbounds i8, ptr %0, i64 124
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = fcmp olt float %22, 0.000000e+00
  br i1 %23, label %24, label %28

24:                                               ; preds = %10
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.32) #8
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.33) #8
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.34, ptr noundef nonnull %3) #8
  br label %63

28:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #8
  store i8 32, ptr %4, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  store float 1.000000e+00, ptr %5, align 4, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %0, i64 120
  %30 = load float, ptr %29, align 8, !tbaa !15
  %31 = fmul float %22, 5.000000e-01
  %32 = fsub float %30, %31
  %33 = tail call float @llvm.fabs.f32(float %32)
  %34 = fadd float %31, %30
  %35 = tail call float @llvm.fabs.f32(float %34)
  %36 = fcmp ogt float %33, %35
  %37 = select i1 %36, float %33, float %35
  %38 = call i32 @liquid_get_scale(float noundef %37, ptr noundef nonnull %4, ptr noundef nonnull %5) #8
  %39 = load i8, ptr %4, align 1, !tbaa !13
  %40 = sext i8 %39 to i32
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.35, i32 noundef %40) #8
  %42 = load float, ptr %5, align 4, !tbaa !14
  %43 = fpext float %42 to double
  %44 = load float, ptr %29, align 8, !tbaa !15
  %45 = fpext float %44 to double
  %46 = load float, ptr %21, align 4, !tbaa !5
  %47 = fpext float %46 to double
  %48 = call double @llvm.fmuladd.f64(double %47, double -5.000000e-01, double %45)
  %49 = fmul double %48, %43
  %50 = call double @llvm.fmuladd.f64(double %47, double 5.000000e-01, double %45)
  %51 = fmul double %50, %43
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.36, double noundef %49, double noundef %51) #8
  %53 = load float, ptr %5, align 4, !tbaa !14
  %54 = load float, ptr %21, align 4, !tbaa !5
  %55 = fcmp olt float %54, 0.000000e+00
  %56 = select i1 %55, float 1.000000e+00, float %54
  %57 = fmul float %53, %56
  %58 = fpext float %57 to double
  %59 = load float, ptr %29, align 8, !tbaa !15
  %60 = fmul float %53, %59
  %61 = fpext float %60 to double
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.37, double noundef %58, double noundef %61, ptr noundef nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #8
  br label %63

63:                                               ; preds = %28, %24
  %64 = load i32, ptr %0, align 8, !tbaa !16
  %65 = zext i32 %64 to i64
  %66 = shl nuw nsw i64 %65, 2
  %67 = call noalias ptr @malloc(i64 noundef %66) #9
  %68 = call i32 @spgramcf_get_psd(ptr noundef nonnull %0, ptr noundef %67)
  %69 = load i32, ptr %0, align 8, !tbaa !16
  %.not = icmp eq i32 %69, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %63, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %63 ]
  %70 = phi i32 [ %81, %.lr.ph ], [ %69, %63 ]
  %71 = trunc nuw i64 %indvars.iv to i32
  %72 = uitofp i32 %71 to float
  %73 = uitofp i32 %70 to float
  %74 = fdiv float %72, %73
  %75 = fadd float %74, -5.000000e-01
  %76 = fpext float %75 to double
  %77 = getelementptr inbounds float, ptr %67, i64 %indvars.iv
  %78 = load float, ptr %77, align 4, !tbaa !14
  %79 = fpext float %78 to double
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.38, double noundef %76, double noundef %79) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %81 = load i32, ptr %0, align 8, !tbaa !16
  %82 = zext i32 %81 to i64
  %83 = icmp ult i64 %indvars.iv.next, %82
  br i1 %83, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph, %63
  call void @free(ptr noundef %67) #8
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.39) #8
  %85 = call i32 @fclose(ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %3) #8
  br label %86

86:                                               ; preds = %._crit_edge, %8
  %.052 = phi i32 [ %9, %8 ], [ 0, %._crit_edge ]
  ret i32 %.052
}

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

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

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

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

declare i32 @liquid_get_scale(float noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind 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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }

!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, !10, i64 124}
!6 = !{!"spgramcf_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 20, !7, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !7, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !10, i64 120, !10, i64 124}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long long", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = !{!10, !10, i64 0}
!15 = !{!6, !10, i64 120}
!16 = !{!6, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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