; LLVM IR from Wilson-ZheLin/Introduction-to-Digital-Image-Processing :: 5. Fourier Transform and Reconstruction/src/main.ll (Z22Reconstruct_phaseAngleP5ImagePfS1_)

; 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.Image = type { i32, i32, i32, ptr, [15 x [100 x i8]], i32 }

@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [38 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z22Reconstruct_phaseAngleP5ImagePfS1_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca float, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Image, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Image, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !12
  %31 = mul nsw i32 %27, %30
  %32 = sitofp i32 %31 to float
  store float %32, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 10000, ptr %14, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %33, ptr noundef @.str.6)
  store ptr %34, ptr %15, align 8, !tbaa !5
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.Image, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  store ptr %37, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %15, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Image, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  store ptr %40, ptr %8, align 8, !tbaa !5
  %41 = load float, ptr %12, align 4, !tbaa !13
  %42 = fmul float %41, 4.000000e+00
  %43 = fptoui float %42 to i64
  %44 = call noalias ptr @malloc(i64 noundef %43) #9
  store ptr %44, ptr %9, align 8, !tbaa !5
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !15
  br label %46

46:                                               ; preds = %187, %3
  %47 = load i32, ptr %16, align 4, !tbaa !15
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.Image, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !12
  %51 = icmp slt i32 %47, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %46
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %190

53:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !15
  br label %54

54:                                               ; preds = %183, %53
  %55 = load i32, ptr %18, align 4, !tbaa !15
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Image, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !9
  %59 = icmp slt i32 %55, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %54
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %186

61:                                               ; preds = %54
  store float 0.000000e+00, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !15
  br label %62

62:                                               ; preds = %151, %61
  %63 = load i32, ptr %19, align 4, !tbaa !15
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.Image, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !12
  %67 = icmp slt i32 %63, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %62
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %154

69:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !15
  br label %70

70:                                               ; preds = %147, %69
  %71 = load i32, ptr %20, align 4, !tbaa !15
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.Image, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 8, !tbaa !9
  %75 = icmp slt i32 %71, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %70
  store i32 11, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %150

77:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  %78 = load i32, ptr %16, align 4, !tbaa !15
  %79 = sitofp i32 %78 to float
  %80 = load i32, ptr %19, align 4, !tbaa !15
  %81 = sitofp i32 %80 to float
  %82 = fmul float %79, %81
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.Image, ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !12
  %86 = sitofp i32 %85 to float
  %87 = fdiv float %82, %86
  %88 = load i32, ptr %18, align 4, !tbaa !15
  %89 = sitofp i32 %88 to float
  %90 = load i32, ptr %20, align 4, !tbaa !15
  %91 = sitofp i32 %90 to float
  %92 = fmul float %89, %91
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.Image, ptr %93, i32 0, i32 0
  %95 = load i32, ptr %94, align 8, !tbaa !9
  %96 = sitofp i32 %95 to float
  %97 = fdiv float %92, %96
  %98 = fadd float %87, %97
  store float %98, ptr %21, align 4, !tbaa !13
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.Image, ptr %100, i32 0, i32 0
  %102 = load i32, ptr %101, align 8, !tbaa !9
  %103 = load i32, ptr %19, align 4, !tbaa !15
  %104 = mul nsw i32 %102, %103
  %105 = load i32, ptr %20, align 4, !tbaa !15
  %106 = add nsw i32 %104, %105
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds float, ptr %99, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !13
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.Image, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !9
  %114 = load i32, ptr %19, align 4, !tbaa !15
  %115 = mul nsw i32 %113, %114
  %116 = load i32, ptr %20, align 4, !tbaa !15
  %117 = add nsw i32 %115, %116
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds float, ptr %110, i64 %118
  %120 = load float, ptr %119, align 4, !tbaa !13
  %121 = call noundef float @_ZSt5atan2ff(float noundef %109, float noundef %120)
  store float %121, ptr %11, align 4, !tbaa !13
  %122 = load float, ptr %11, align 4, !tbaa !13
  %123 = call noundef float @_ZSt3cosf(float noundef %122)
  %124 = fpext float %123 to double
  %125 = call noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef -1)
  %126 = fmul double 2.000000e+00, %125
  %127 = load float, ptr %21, align 4, !tbaa !13
  %128 = fpext float %127 to double
  %129 = fmul double %126, %128
  %130 = call double @cos(double noundef %129) #8
  %131 = load float, ptr %11, align 4, !tbaa !13
  %132 = call noundef float @_ZSt3sinf(float noundef %131)
  %133 = fpext float %132 to double
  %134 = call noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef -1)
  %135 = fmul double 2.000000e+00, %134
  %136 = load float, ptr %21, align 4, !tbaa !13
  %137 = fpext float %136 to double
  %138 = fmul double %135, %137
  %139 = call double @sin(double noundef %138) #8
  %140 = fmul double %133, %139
  %141 = fneg double %140
  %142 = call double @llvm.fmuladd.f64(double %124, double %130, double %141)
  %143 = load float, ptr %10, align 4, !tbaa !13
  %144 = fpext float %143 to double
  %145 = fadd double %144, %142
  %146 = fptrunc double %145 to float
  store float %146, ptr %10, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %147

147:                                              ; preds = %77
  %148 = load i32, ptr %20, align 4, !tbaa !15
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %20, align 4, !tbaa !15
  br label %70, !llvm.loop !17

150:                                              ; preds = %76
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %19, align 4, !tbaa !15
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %19, align 4, !tbaa !15
  br label %62, !llvm.loop !19

154:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  %155 = load float, ptr %10, align 4, !tbaa !13
  %156 = call noundef float @_ZSt4fabsf(float noundef %155)
  %157 = call noundef float @_ZSt5roundf(float noundef %156)
  %158 = fptosi float %157 to i32
  store i32 %158, ptr %22, align 4, !tbaa !15
  %159 = load i32, ptr %22, align 4, !tbaa !15
  %160 = sitofp i32 %159 to float
  %161 = load ptr, ptr %9, align 8, !tbaa !5
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.Image, ptr %162, i32 0, i32 0
  %164 = load i32, ptr %163, align 8, !tbaa !9
  %165 = load i32, ptr %16, align 4, !tbaa !15
  %166 = mul nsw i32 %164, %165
  %167 = load i32, ptr %18, align 4, !tbaa !15
  %168 = add nsw i32 %166, %167
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds float, ptr %161, i64 %169
  store float %160, ptr %170, align 4, !tbaa !13
  %171 = load i32, ptr %22, align 4, !tbaa !15
  %172 = load i32, ptr %13, align 4, !tbaa !15
  %173 = icmp sgt i32 %171, %172
  br i1 %173, label %174, label %176

174:                                              ; preds = %154
  %175 = load i32, ptr %22, align 4, !tbaa !15
  store i32 %175, ptr %13, align 4, !tbaa !15
  br label %176

176:                                              ; preds = %174, %154
  %177 = load i32, ptr %22, align 4, !tbaa !15
  %178 = load i32, ptr %14, align 4, !tbaa !15
  %179 = icmp slt i32 %177, %178
  br i1 %179, label %180, label %182

180:                                              ; preds = %176
  %181 = load i32, ptr %22, align 4, !tbaa !15
  store i32 %181, ptr %14, align 4, !tbaa !15
  br label %182

182:                                              ; preds = %180, %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %183

183:                                              ; preds = %182
  %184 = load i32, ptr %18, align 4, !tbaa !15
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %18, align 4, !tbaa !15
  br label %54, !llvm.loop !20

186:                                              ; preds = %60
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %16, align 4, !tbaa !15
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %16, align 4, !tbaa !15
  br label %46, !llvm.loop !21

190:                                              ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !15
  br label %191

191:                                              ; preds = %220, %190
  %192 = load i32, ptr %23, align 4, !tbaa !15
  %193 = sitofp i32 %192 to float
  %194 = load float, ptr %12, align 4, !tbaa !13
  %195 = fcmp olt float %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %191
  store i32 14, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %223

197:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %198 = load ptr, ptr %9, align 8, !tbaa !5
  %199 = load i32, ptr %23, align 4, !tbaa !15
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds float, ptr %198, i64 %200
  %202 = load float, ptr %201, align 4, !tbaa !13
  %203 = load i32, ptr %14, align 4, !tbaa !15
  %204 = sitofp i32 %203 to float
  %205 = fsub float %202, %204
  %206 = load i32, ptr %13, align 4, !tbaa !15
  %207 = sitofp i32 %206 to float
  %208 = load i32, ptr %14, align 4, !tbaa !15
  %209 = sitofp i32 %208 to float
  %210 = fsub float %207, %209
  %211 = fdiv float %205, %210
  store float %211, ptr %24, align 4, !tbaa !13
  %212 = load float, ptr %24, align 4, !tbaa !13
  %213 = fmul float %212, 2.560000e+02
  %214 = fptosi float %213 to i32
  %215 = trunc i32 %214 to i8
  %216 = load ptr, ptr %8, align 8, !tbaa !5
  %217 = load i32, ptr %23, align 4, !tbaa !15
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds i8, ptr %216, i64 %218
  store i8 %215, ptr %219, align 1, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %220

220:                                              ; preds = %197
  %221 = load i32, ptr %23, align 4, !tbaa !15
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %23, align 4, !tbaa !15
  br label %191, !llvm.loop !23

223:                                              ; preds = %196
  %224 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %225 = load ptr, ptr %15, align 8, !tbaa !5
  store i32 1, ptr %17, align 4
  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
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  ret ptr %225
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) #4

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

; Function Attrs: nounwind
declare double @sin(double noundef) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5atan2ff(float noundef, float noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4fabsf(float noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #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 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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { mustprogress 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS5Image", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !7, i64 24, !11, i64 1524}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !18}


; 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 [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z22Reconstruct_phaseAngleP5ImagePfS1_(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = load i32, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  %6 = load i32, ptr %5, align 4, !tbaa !11
  %7 = mul nsw i32 %6, %4
  %8 = sitofp i32 %7 to float
  %9 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef nonnull %0, ptr noundef nonnull @.str.6)
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = fmul float %8, 4.000000e+00
  %13 = fptoui float %12 to i64
  %14 = tail call noalias ptr @malloc(i64 noundef %13) #8
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %16 = load i32, ptr %5, align 4, !tbaa !11
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader75.lr.ph, label %.preheader

.preheader75.lr.ph:                               ; preds = %3
  %18 = load i32, ptr %0, align 8, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.preheader75, label %.preheader

.preheader75:                                     ; preds = %.preheader75.lr.ph, %._crit_edge85
  %20 = phi i32 [ %33, %._crit_edge85 ], [ %16, %.preheader75.lr.ph ]
  %21 = phi i32 [ %34, %._crit_edge85 ], [ %18, %.preheader75.lr.ph ]
  %.06190 = phi i32 [ %.162.lcssa, %._crit_edge85 ], [ 0, %.preheader75.lr.ph ]
  %.06389 = phi i32 [ %.164.lcssa, %._crit_edge85 ], [ 10000, %.preheader75.lr.ph ]
  %.06988 = phi i32 [ %35, %._crit_edge85 ], [ 0, %.preheader75.lr.ph ]
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.preheader74.lr.ph, label %._crit_edge85

.preheader74.lr.ph:                               ; preds = %.preheader75
  %23 = uitofp nneg i32 %.06988 to float
  br label %.preheader74

.preheader.loopexit:                              ; preds = %._crit_edge85
  %24 = sitofp i32 %.164.lcssa to float
  %25 = uitofp nneg i32 %.162.lcssa to float
  br label %.preheader

.preheader:                                       ; preds = %.preheader75.lr.ph, %.preheader.loopexit, %3
  %.063.lcssa = phi float [ 1.000000e+04, %3 ], [ %24, %.preheader.loopexit ], [ 1.000000e+04, %.preheader75.lr.ph ]
  %.061.lcssa = phi float [ 0.000000e+00, %3 ], [ %25, %.preheader.loopexit ], [ 0.000000e+00, %.preheader75.lr.ph ]
  %26 = icmp sgt i32 %7, 0
  br i1 %26, label %.lr.ph96, label %._crit_edge97

.lr.ph96:                                         ; preds = %.preheader
  %27 = fsub float %.061.lcssa, %.063.lcssa
  br label %101

.preheader74:                                     ; preds = %.preheader74.lr.ph, %._crit_edge80
  %28 = phi i32 [ %21, %.preheader74.lr.ph ], [ %46, %._crit_edge80 ]
  %.16284 = phi i32 [ %.06190, %.preheader74.lr.ph ], [ %spec.select, %._crit_edge80 ]
  %.16483 = phi i32 [ %.06389, %.preheader74.lr.ph ], [ %.265, %._crit_edge80 ]
  %.06882 = phi i32 [ 0, %.preheader74.lr.ph ], [ %51, %._crit_edge80 ]
  %29 = load i32, ptr %5, align 4, !tbaa !11
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.preheader73.lr.ph, label %._crit_edge80

.preheader73.lr.ph:                               ; preds = %.preheader74
  %31 = uitofp nneg i32 %.06882 to float
  %32 = icmp sgt i32 %28, 0
  br i1 %32, label %.preheader73, label %._crit_edge80

._crit_edge85.loopexit:                           ; preds = %._crit_edge80
  %.pre101 = load i32, ptr %5, align 4, !tbaa !11
  br label %._crit_edge85

._crit_edge85:                                    ; preds = %._crit_edge85.loopexit, %.preheader75
  %33 = phi i32 [ %20, %.preheader75 ], [ %.pre101, %._crit_edge85.loopexit ]
  %34 = phi i32 [ %21, %.preheader75 ], [ %46, %._crit_edge85.loopexit ]
  %.164.lcssa = phi i32 [ %.06389, %.preheader75 ], [ %.265, %._crit_edge85.loopexit ]
  %.162.lcssa = phi i32 [ %.06190, %.preheader75 ], [ %spec.select, %._crit_edge85.loopexit ]
  %35 = add nuw nsw i32 %.06988, 1
  %36 = icmp slt i32 %35, %33
  br i1 %36, label %.preheader75, label %.preheader.loopexit, !llvm.loop !13

.preheader73:                                     ; preds = %.preheader73.lr.ph, %._crit_edge
  %37 = phi i32 [ %53, %._crit_edge ], [ %29, %.preheader73.lr.ph ]
  %38 = phi i32 [ %54, %._crit_edge ], [ %28, %.preheader73.lr.ph ]
  %.079 = phi float [ %.1.lcssa, %._crit_edge ], [ 0.000000e+00, %.preheader73.lr.ph ]
  %.06778 = phi i32 [ %55, %._crit_edge ], [ 0, %.preheader73.lr.ph ]
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader73
  %40 = uitofp nneg i32 %.06778 to float
  %41 = fmul float %23, %40
  br label %57

._crit_edge80:                                    ; preds = %._crit_edge, %.preheader73.lr.ph, %.preheader74
  %.0.lcssa = phi float [ 0.000000e+00, %.preheader74 ], [ 0.000000e+00, %.preheader73.lr.ph ], [ %.1.lcssa, %._crit_edge ]
  %42 = tail call noundef float @_ZSt4fabsf(float noundef %.0.lcssa)
  %43 = tail call noundef float @_ZSt5roundf(float noundef %42)
  %44 = fptosi float %43 to i32
  %45 = sitofp i32 %44 to float
  %46 = load i32, ptr %0, align 8, !tbaa !5
  %47 = mul nsw i32 %46, %.06988
  %48 = add nsw i32 %47, %.06882
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds float, ptr %14, i64 %49
  store float %45, ptr %50, align 4, !tbaa !16
  %spec.select = tail call i32 @llvm.smax.i32(i32 %.16284, i32 %44)
  %.265 = tail call i32 @llvm.smin.i32(i32 %.16483, i32 %44)
  %51 = add nuw nsw i32 %.06882, 1
  %52 = icmp slt i32 %51, %46
  br i1 %52, label %.preheader74, label %._crit_edge85.loopexit, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %57
  %.pre = load i32, ptr %5, align 4, !tbaa !11
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader73
  %53 = phi i32 [ %37, %.preheader73 ], [ %.pre, %._crit_edge.loopexit ]
  %54 = phi i32 [ %38, %.preheader73 ], [ %98, %._crit_edge.loopexit ]
  %.1.lcssa = phi float [ %.079, %.preheader73 ], [ %96, %._crit_edge.loopexit ]
  %55 = add nuw nsw i32 %.06778, 1
  %56 = icmp slt i32 %55, %53
  br i1 %56, label %.preheader73, label %._crit_edge80, !llvm.loop !19

57:                                               ; preds = %.lr.ph, %57
  %58 = phi i32 [ %38, %.lr.ph ], [ %98, %57 ]
  %.177 = phi float [ %.079, %.lr.ph ], [ %96, %57 ]
  %.06676 = phi i32 [ 0, %.lr.ph ], [ %97, %57 ]
  %59 = load i32, ptr %5, align 4, !tbaa !11
  %60 = uitofp nneg i32 %.06676 to float
  %61 = fmul float %31, %60
  %62 = insertelement <2 x i32> poison, i32 %58, i64 0
  %63 = insertelement <2 x i32> %62, i32 %59, i64 1
  %64 = sitofp <2 x i32> %63 to <2 x float>
  %65 = insertelement <2 x float> poison, float %61, i64 0
  %66 = insertelement <2 x float> %65, float %41, i64 1
  %67 = fdiv <2 x float> %66, %64
  %shift = shufflevector <2 x float> %67, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %68 = fadd <2 x float> %67, %shift
  %69 = extractelement <2 x float> %68, i64 0
  %70 = mul nsw i32 %58, %.06778
  %71 = add nsw i32 %70, %.06676
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %2, i64 %72
  %74 = load float, ptr %73, align 4, !tbaa !16
  %75 = getelementptr inbounds float, ptr %1, i64 %72
  %76 = load float, ptr %75, align 4, !tbaa !16
  %77 = tail call noundef float @_ZSt5atan2ff(float noundef %74, float noundef %76)
  %78 = tail call noundef float @_ZSt3cosf(float noundef %77)
  %79 = fpext float %78 to double
  %80 = tail call noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef -1)
  %81 = fmul double %80, 2.000000e+00
  %82 = fpext float %69 to double
  %83 = fmul double %81, %82
  %84 = tail call double @cos(double noundef %83) #9
  %85 = tail call noundef float @_ZSt3sinf(float noundef %77)
  %86 = fpext float %85 to double
  %87 = tail call noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef -1)
  %88 = fmul double %87, 2.000000e+00
  %89 = fmul double %88, %82
  %90 = tail call double @sin(double noundef %89) #9
  %91 = fneg double %90
  %92 = fmul double %86, %91
  %93 = tail call double @llvm.fmuladd.f64(double %79, double %84, double %92)
  %94 = fpext float %.177 to double
  %95 = fadd double %93, %94
  %96 = fptrunc double %95 to float
  %97 = add nuw nsw i32 %.06676, 1
  %98 = load i32, ptr %0, align 8, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %57, label %._crit_edge.loopexit, !llvm.loop !20

._crit_edge97:                                    ; preds = %101, %.preheader
  %100 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  ret ptr %9

101:                                              ; preds = %.lr.ph96, %101
  %indvars.iv = phi i64 [ 0, %.lr.ph96 ], [ %indvars.iv.next, %101 ]
  %102 = getelementptr inbounds float, ptr %14, i64 %indvars.iv
  %103 = load float, ptr %102, align 4, !tbaa !16
  %104 = fsub float %103, %.063.lcssa
  %105 = fdiv float %104, %27
  %106 = fmul float %105, 2.560000e+02
  %107 = fptosi float %106 to i32
  %108 = trunc i32 %107 to i8
  %109 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv
  store i8 %108, ptr %109, align 1, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %110 = trunc nuw nsw i64 %indvars.iv.next to i32
  %111 = uitofp nneg i32 %110 to float
  %112 = fcmp olt float %111, %8
  br i1 %112, label %101, label %._crit_edge97, !llvm.loop !22
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4acosIiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5atan2ff(float noundef, float noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3cosf(float noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3sinf(float noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5roundf(float noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt4fabsf(float noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #7

attributes #0 = { mustprogress 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 = { mustprogress nofree nounwind willreturn memory(write) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress 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 #4 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { mustprogress 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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, !7, i64 0}
!6 = !{!"_ZTS5Image", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !8, i64 24, !7, i64 1524}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !10, i64 16}
!13 = distinct !{!13, !14, !15}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = !{!17, !17, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14, !15}
!20 = distinct !{!20, !14}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !14}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass,VectorCombinePass