; LLVM IR from rflynn/imgmin :: src (dssim)

; 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.dssim_info = type { [3 x %struct.dssim_info_chan], i32 }
%struct.dssim_info_chan = type { i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }

; 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,1)
declare noalias ptr @calloc(i64 noundef, 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

; Function Attrs: nounwind uwtable
define dso_local void @dssim_set_original_float_callback(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %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 ptr, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.dssim_info, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %11, align 8
  %27 = alloca ptr, i64 %25, align 16
  store i64 %25, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %92, %5
  %29 = load i32, ptr %13, align 4, !tbaa !9
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.dssim_info, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = icmp slt i32 %29, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %95

35:                                               ; preds = %28
  %36 = load i32, ptr %13, align 4, !tbaa !9
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = sdiv i32 %39, 2
  br label %43

41:                                               ; preds = %35
  %42 = load i32, ptr %7, align 4, !tbaa !9
  br label %43

43:                                               ; preds = %41, %38
  %44 = phi i32 [ %40, %38 ], [ %42, %41 ]
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.dssim_info, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %13, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %46, i64 0, i64 %48
  %50 = getelementptr inbounds %struct.dssim_info_chan, ptr %49, i32 0, i32 0
  store i32 %44, ptr %50, align 8, !tbaa !13
  %51 = load i32, ptr %13, align 4, !tbaa !9
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %53, label %56

53:                                               ; preds = %43
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = sdiv i32 %54, 2
  br label %58

56:                                               ; preds = %43
  %57 = load i32, ptr %8, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %56, %53
  %59 = phi i32 [ %55, %53 ], [ %57, %56 ]
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.dssim_info, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %13, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %61, i64 0, i64 %63
  %65 = getelementptr inbounds %struct.dssim_info_chan, ptr %64, i32 0, i32 1
  store i32 %59, ptr %65, align 4, !tbaa !15
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.dssim_info, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %13, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %67, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.dssim_info_chan, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !13
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.dssim_info, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %13, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %74, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.dssim_info_chan, ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !15
  %80 = mul nsw i32 %72, %79
  %81 = sext i32 %80 to i64
  %82 = call noalias ptr @calloc(i64 noundef %81, i64 noundef 4) #7
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %27, i64 %84
  store ptr %82, ptr %85, align 8, !tbaa !5
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.dssim_info, ptr %86, i32 0, i32 0
  %88 = load i32, ptr %13, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %87, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.dssim_info_chan, ptr %90, i32 0, i32 2
  store ptr %82, ptr %91, align 8, !tbaa !16
  br label %92

92:                                               ; preds = %58
  %93 = load i32, ptr %13, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %13, align 4, !tbaa !9
  br label %28, !llvm.loop !17

95:                                               ; preds = %34
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  call void @convert_image(ptr noundef %96, ptr noundef %27, ptr noundef %97, ptr noundef %98)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = mul nsw i32 %99, %100
  %102 = sext i32 %101 to i64
  %103 = mul i64 %102, 4
  %104 = call noalias ptr @malloc(i64 noundef %103) #8
  store ptr %104, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %105 = load i32, ptr %7, align 4, !tbaa !9
  %106 = load i32, ptr %8, align 4, !tbaa !9
  %107 = mul nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 4
  %110 = call noalias ptr @malloc(i64 noundef %109) #8
  store ptr %110, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %111

111:                                              ; preds = %228, %95
  %112 = load i32, ptr %16, align 4, !tbaa !9
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.dssim_info, ptr %113, i32 0, i32 1
  %115 = load i32, ptr %114, align 8, !tbaa !11
  %116 = icmp slt i32 %112, %115
  br i1 %116, label %118, label %117

117:                                              ; preds = %111
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %231

118:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.dssim_info, ptr %119, i32 0, i32 0
  %121 = load i32, ptr %16, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %120, i64 0, i64 %122
  %124 = getelementptr inbounds %struct.dssim_info_chan, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !13
  store i32 %125, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.dssim_info, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %16, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %127, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.dssim_info_chan, ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !15
  store i32 %132, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.dssim_info, ptr %133, i32 0, i32 0
  %135 = load i32, ptr %16, align 4, !tbaa !9
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %134, i64 0, i64 %136
  %138 = getelementptr inbounds %struct.dssim_info_chan, ptr %137, i32 0, i32 2
  %139 = load ptr, ptr %138, align 8, !tbaa !16
  store ptr %139, ptr %20, align 8, !tbaa !5
  %140 = load i32, ptr %16, align 4, !tbaa !9
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %142, label %148

142:                                              ; preds = %118
  %143 = load ptr, ptr %20, align 8, !tbaa !5
  %144 = load ptr, ptr %15, align 8, !tbaa !5
  %145 = load ptr, ptr %20, align 8, !tbaa !5
  %146 = load i32, ptr %18, align 4, !tbaa !9
  %147 = load i32, ptr %19, align 4, !tbaa !9
  call void @blur(ptr noundef %143, ptr noundef %144, ptr noundef %145, i32 noundef %146, i32 noundef %147, ptr noundef null, i32 noundef 0)
  br label %148

148:                                              ; preds = %142, %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %172, %148
  %150 = load i32, ptr %21, align 4, !tbaa !9
  %151 = load i32, ptr %18, align 4, !tbaa !9
  %152 = load i32, ptr %19, align 4, !tbaa !9
  %153 = mul nsw i32 %151, %152
  %154 = icmp slt i32 %150, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %149
  store i32 8, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %175

156:                                              ; preds = %149
  %157 = load ptr, ptr %20, align 8, !tbaa !5
  %158 = load i32, ptr %21, align 4, !tbaa !9
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds float, ptr %157, i64 %159
  %161 = load float, ptr %160, align 4, !tbaa !19
  %162 = load ptr, ptr %20, align 8, !tbaa !5
  %163 = load i32, ptr %21, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds float, ptr %162, i64 %164
  %166 = load float, ptr %165, align 4, !tbaa !19
  %167 = fmul float %161, %166
  %168 = load ptr, ptr %14, align 8, !tbaa !5
  %169 = load i32, ptr %21, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds float, ptr %168, i64 %170
  store float %167, ptr %171, align 4, !tbaa !19
  br label %172

172:                                              ; preds = %156
  %173 = load i32, ptr %21, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %21, align 4, !tbaa !9
  br label %149, !llvm.loop !21

175:                                              ; preds = %155
  %176 = load i32, ptr %18, align 4, !tbaa !9
  %177 = load i32, ptr %19, align 4, !tbaa !9
  %178 = mul nsw i32 %176, %177
  %179 = sext i32 %178 to i64
  %180 = mul i64 %179, 4
  %181 = call noalias ptr @malloc(i64 noundef %180) #8
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.dssim_info, ptr %182, i32 0, i32 0
  %184 = load i32, ptr %16, align 4, !tbaa !9
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %183, i64 0, i64 %185
  %187 = getelementptr inbounds %struct.dssim_info_chan, ptr %186, i32 0, i32 3
  store ptr %181, ptr %187, align 8, !tbaa !22
  %188 = load ptr, ptr %20, align 8, !tbaa !5
  %189 = load ptr, ptr %15, align 8, !tbaa !5
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.dssim_info, ptr %190, i32 0, i32 0
  %192 = load i32, ptr %16, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %191, i64 0, i64 %193
  %195 = getelementptr inbounds %struct.dssim_info_chan, ptr %194, i32 0, i32 3
  %196 = load ptr, ptr %195, align 8, !tbaa !22
  %197 = load i32, ptr %18, align 4, !tbaa !9
  %198 = load i32, ptr %19, align 4, !tbaa !9
  %199 = load i32, ptr %16, align 4, !tbaa !9
  %200 = icmp sgt i32 %199, 0
  %201 = zext i1 %200 to i32
  call void @blur(ptr noundef %188, ptr noundef %189, ptr noundef %196, i32 noundef %197, i32 noundef %198, ptr noundef null, i32 noundef %201)
  %202 = load i32, ptr %18, align 4, !tbaa !9
  %203 = load i32, ptr %19, align 4, !tbaa !9
  %204 = mul nsw i32 %202, %203
  %205 = sext i32 %204 to i64
  %206 = mul i64 %205, 4
  %207 = call noalias ptr @malloc(i64 noundef %206) #8
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.dssim_info, ptr %208, i32 0, i32 0
  %210 = load i32, ptr %16, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %209, i64 0, i64 %211
  %213 = getelementptr inbounds %struct.dssim_info_chan, ptr %212, i32 0, i32 4
  store ptr %207, ptr %213, align 8, !tbaa !23
  %214 = load ptr, ptr %14, align 8, !tbaa !5
  %215 = load ptr, ptr %15, align 8, !tbaa !5
  %216 = load ptr, ptr %6, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.dssim_info, ptr %216, i32 0, i32 0
  %218 = load i32, ptr %16, align 4, !tbaa !9
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %217, i64 0, i64 %219
  %221 = getelementptr inbounds %struct.dssim_info_chan, ptr %220, i32 0, i32 4
  %222 = load ptr, ptr %221, align 8, !tbaa !23
  %223 = load i32, ptr %18, align 4, !tbaa !9
  %224 = load i32, ptr %19, align 4, !tbaa !9
  %225 = load i32, ptr %16, align 4, !tbaa !9
  %226 = icmp sgt i32 %225, 0
  %227 = zext i1 %226 to i32
  call void @blur(ptr noundef %214, ptr noundef %215, ptr noundef %222, i32 noundef %223, i32 noundef %224, ptr noundef null, i32 noundef %227)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %228

228:                                              ; preds = %175
  %229 = load i32, ptr %16, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %16, align 4, !tbaa !9
  br label %111, !llvm.loop !24

231:                                              ; preds = %117
  %232 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %232) #6
  %233 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %233) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %234 = load ptr, ptr %11, align 8
  call void @llvm.stackrestore.p0(ptr %234)
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden void @convert_image(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden void @blur(ptr noalias noundef, ptr noalias noundef, ptr noalias noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(0,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 168}
!12 = !{!"dssim_info", !7, i64 0, !10, i64 168}
!13 = !{!14, !10, i64 0}
!14 = !{!"", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!14, !10, i64 4}
!16 = !{!14, !6, i64 8}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = distinct !{!21, !18}
!22 = !{!14, !6, i64 16}
!23 = !{!14, !6, i64 24}
!24 = distinct !{!24, !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"

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @dssim_set_original_float_callback(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 168
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = alloca ptr, i64 %8, align 16
  %10 = icmp sgt i32 %7, 0
  br i1 %10, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %5
  %.pre = mul nsw i32 %2, %1
  %.pre99 = sext i32 %.pre to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %5
  %11 = sdiv i32 %1, 2
  %12 = sdiv i32 %2, 2
  store i32 %1, ptr %0, align 8, !tbaa !10
  %13 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %2, ptr %13, align 4, !tbaa !13
  %14 = mul nsw i32 %1, %2
  %15 = sext i32 %14 to i64
  %16 = tail call noalias ptr @calloc(i64 noundef %15, i64 noundef 4) #4
  store ptr %16, ptr %9, align 16, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %16, ptr %17, align 8, !tbaa !15
  %exitcond.peel.not = icmp eq i32 %7, 1
  br i1 %exitcond.peel.not, label %._crit_edge, label %.peel.next

.peel.next:                                       ; preds = %.lr.ph
  %18 = mul nsw i32 %11, %12
  %19 = sext i32 %18 to i64
  br label %26

._crit_edge:                                      ; preds = %26, %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi100 = phi i64 [ %.pre99, %.._crit_edge_crit_edge ], [ %15, %.lr.ph ], [ %15, %26 ]
  call void @convert_image(ptr noundef nonnull %0, ptr noundef nonnull %9, ptr noundef %3, ptr noundef %4)
  %20 = shl nsw i64 %.pre-phi100, 2
  %21 = call noalias ptr @malloc(i64 noundef %20) #5
  %22 = ptrtoint ptr %21 to i64
  %23 = call noalias ptr @malloc(i64 noundef %20) #5
  %24 = load i32, ptr %6, align 8, !tbaa !5
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph87, label %._crit_edge88

26:                                               ; preds = %.peel.next, %26
  %indvars.iv = phi i64 [ 1, %.peel.next ], [ %indvars.iv.next, %26 ]
  %27 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %0, i64 0, i64 %indvars.iv
  store i32 %11, ptr %27, align 8, !tbaa !10
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  store i32 %12, ptr %28, align 4, !tbaa !13
  %29 = tail call noalias ptr @calloc(i64 noundef %19, i64 noundef 4) #4
  %30 = getelementptr inbounds ptr, ptr %9, i64 %indvars.iv
  store ptr %29, ptr %30, align 8, !tbaa !14
  %31 = getelementptr inbounds i8, ptr %27, i64 8
  store ptr %29, ptr %31, align 8, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %8
  br i1 %exitcond.not, label %._crit_edge, label %26, !llvm.loop !16

._crit_edge88:                                    ; preds = %._crit_edge84, %._crit_edge
  call void @free(ptr noundef %23) #6
  call void @free(ptr noundef %21) #6
  ret void

.lr.ph87:                                         ; preds = %._crit_edge, %._crit_edge84
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %._crit_edge84 ], [ 0, %._crit_edge ]
  %32 = getelementptr inbounds [3 x %struct.dssim_info_chan], ptr %0, i64 0, i64 %indvars.iv96
  %33 = load i32, ptr %32, align 8, !tbaa !10
  %34 = getelementptr inbounds i8, ptr %32, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = getelementptr inbounds i8, ptr %32, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = ptrtoint ptr %37 to i64
  %39 = icmp ne i64 %indvars.iv96, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %.lr.ph87
  call void @blur(ptr noundef %37, ptr noundef %23, ptr noundef %37, i32 noundef %33, i32 noundef %35, ptr noundef null, i32 noundef 0)
  br label %41

41:                                               ; preds = %40, %.lr.ph87
  %42 = mul nsw i32 %35, %33
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph83.preheader, label %._crit_edge84

.lr.ph83.preheader:                               ; preds = %41
  %wide.trip.count94 = zext nneg i32 %42 to i64
  %min.iters.check = icmp ult i32 %42, 8
  %44 = sub i64 %22, %38
  %diff.check = icmp ult i64 %44, 32
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.lr.ph83.preheader102, label %vector.ph

.lr.ph83.preheader102:                            ; preds = %middle.block, %.lr.ph83.preheader
  %indvars.iv91.ph = phi i64 [ 0, %.lr.ph83.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count94, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph83.prol.loopexit, label %.lr.ph83.prol

.lr.ph83.prol:                                    ; preds = %.lr.ph83.preheader102, %.lr.ph83.prol
  %indvars.iv91.prol = phi i64 [ %indvars.iv.next92.prol, %.lr.ph83.prol ], [ %indvars.iv91.ph, %.lr.ph83.preheader102 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph83.prol ], [ 0, %.lr.ph83.preheader102 ]
  %45 = getelementptr inbounds float, ptr %37, i64 %indvars.iv91.prol
  %46 = load float, ptr %45, align 4, !tbaa !19
  %47 = fmul float %46, %46
  %48 = getelementptr inbounds float, ptr %21, i64 %indvars.iv91.prol
  store float %47, ptr %48, align 4, !tbaa !19
  %indvars.iv.next92.prol = add nuw nsw i64 %indvars.iv91.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph83.prol.loopexit, label %.lr.ph83.prol, !llvm.loop !21

.lr.ph83.prol.loopexit:                           ; preds = %.lr.ph83.prol, %.lr.ph83.preheader102
  %indvars.iv91.unr = phi i64 [ %indvars.iv91.ph, %.lr.ph83.preheader102 ], [ %indvars.iv.next92.prol, %.lr.ph83.prol ]
  %49 = sub nsw i64 %indvars.iv91.ph, %wide.trip.count94
  %50 = icmp ugt i64 %49, -4
  br i1 %50, label %._crit_edge84, label %.lr.ph83

vector.ph:                                        ; preds = %.lr.ph83.preheader
  %n.vec = and i64 %wide.trip.count94, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %51 = getelementptr inbounds float, ptr %37, i64 %index
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %wide.load = load <4 x float>, ptr %51, align 4, !tbaa !19
  %wide.load101 = load <4 x float>, ptr %52, align 4, !tbaa !19
  %53 = fmul <4 x float> %wide.load, %wide.load
  %54 = fmul <4 x float> %wide.load101, %wide.load101
  %55 = getelementptr inbounds float, ptr %21, i64 %index
  %56 = getelementptr inbounds i8, ptr %55, i64 16
  store <4 x float> %53, ptr %55, align 4, !tbaa !19
  store <4 x float> %54, ptr %56, align 4, !tbaa !19
  %index.next = add nuw i64 %index, 8
  %57 = icmp eq i64 %index.next, %n.vec
  br i1 %57, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count94
  br i1 %cmp.n, label %._crit_edge84, label %.lr.ph83.preheader102

._crit_edge84:                                    ; preds = %.lr.ph83.prol.loopexit, %.lr.ph83, %middle.block, %41
  %58 = sext i32 %42 to i64
  %59 = shl nsw i64 %58, 2
  %60 = call noalias ptr @malloc(i64 noundef %59) #5
  %61 = getelementptr inbounds i8, ptr %32, i64 16
  store ptr %60, ptr %61, align 8, !tbaa !26
  %62 = zext i1 %39 to i32
  call void @blur(ptr noundef %37, ptr noundef %23, ptr noundef %60, i32 noundef %33, i32 noundef %35, ptr noundef null, i32 noundef %62)
  %63 = call noalias ptr @malloc(i64 noundef %59) #5
  %64 = getelementptr inbounds i8, ptr %32, i64 24
  store ptr %63, ptr %64, align 8, !tbaa !27
  call void @blur(ptr noundef %21, ptr noundef %23, ptr noundef %63, i32 noundef %33, i32 noundef %35, ptr noundef null, i32 noundef %62)
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %65 = load i32, ptr %6, align 8, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next97, %66
  br i1 %67, label %.lr.ph87, label %._crit_edge88, !llvm.loop !28

.lr.ph83:                                         ; preds = %.lr.ph83.prol.loopexit, %.lr.ph83
  %indvars.iv91 = phi i64 [ %indvars.iv.next92.3, %.lr.ph83 ], [ %indvars.iv91.unr, %.lr.ph83.prol.loopexit ]
  %68 = getelementptr inbounds float, ptr %37, i64 %indvars.iv91
  %69 = load float, ptr %68, align 4, !tbaa !19
  %70 = fmul float %69, %69
  %71 = getelementptr inbounds float, ptr %21, i64 %indvars.iv91
  store float %70, ptr %71, align 4, !tbaa !19
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %72 = getelementptr inbounds float, ptr %37, i64 %indvars.iv.next92
  %73 = load float, ptr %72, align 4, !tbaa !19
  %74 = fmul float %73, %73
  %75 = getelementptr inbounds float, ptr %21, i64 %indvars.iv.next92
  store float %74, ptr %75, align 4, !tbaa !19
  %indvars.iv.next92.1 = add nuw nsw i64 %indvars.iv91, 2
  %76 = getelementptr inbounds float, ptr %37, i64 %indvars.iv.next92.1
  %77 = load float, ptr %76, align 4, !tbaa !19
  %78 = fmul float %77, %77
  %79 = getelementptr inbounds float, ptr %21, i64 %indvars.iv.next92.1
  store float %78, ptr %79, align 4, !tbaa !19
  %indvars.iv.next92.2 = add nuw nsw i64 %indvars.iv91, 3
  %80 = getelementptr inbounds float, ptr %37, i64 %indvars.iv.next92.2
  %81 = load float, ptr %80, align 4, !tbaa !19
  %82 = fmul float %81, %81
  %83 = getelementptr inbounds float, ptr %21, i64 %indvars.iv.next92.2
  store float %82, ptr %83, align 4, !tbaa !19
  %indvars.iv.next92.3 = add nuw nsw i64 %indvars.iv91, 4
  %exitcond95.not.3 = icmp eq i64 %indvars.iv.next92.3, %wide.trip.count94
  br i1 %exitcond95.not.3, label %._crit_edge84, label %.lr.ph83, !llvm.loop !29
}

; Function Attrs: nounwind uwtable
declare hidden void @convert_image(ptr noundef, ptr noundef, ptr noundef, ptr 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 #3

; Function Attrs: nounwind uwtable
declare hidden void @blur(ptr noalias noundef, ptr noalias noundef, ptr noalias noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #1 = { 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 #2 = { 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 #3 = { 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 #4 = { nounwind allocsize(0,1) }
attributes #5 = { nounwind allocsize(0) }
attributes #6 = { 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, !9, i64 168}
!6 = !{!"dssim_info", !7, i64 0, !9, i64 168}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!11, !9, i64 0}
!11 = !{!"", !9, i64 0, !9, i64 4, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!11, !9, i64 4}
!14 = !{!12, !12, i64 0}
!15 = !{!11, !12, i64 8}
!16 = distinct !{!16, !17, !18}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.unroll.disable"}
!23 = distinct !{!23, !17, !24, !25}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = !{!11, !12, i64 16}
!27 = !{!11, !12, i64 24}
!28 = distinct !{!28, !17}
!29 = distinct !{!29, !17, !24}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass