; LLVM IR from Wilson-ZheLin/Introduction-to-Digital-Image-Processing :: 4. Edge Detection and Grayscale Transformation/src/main.ll (Z5SobelP5Image)

; 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.10 = external hidden unnamed_addr constant [18 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 @_Z5SobelP5Image(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca [9 x i32], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 36, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %15, ptr noundef @.str.10)
  store ptr %16, ptr %9, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.Image, ptr %17, i32 0, i32 3
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %3, align 8, !tbaa !5
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Image, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !12
  br label %23

23:                                               ; preds = %156, %1
  %24 = load i32, ptr %10, align 4, !tbaa !12
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Image, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !13
  %28 = icmp slt i32 %24, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %159

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !12
  br label %31

31:                                               ; preds = %152, %30
  %32 = load i32, ptr %12, align 4, !tbaa !12
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Image, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !14
  %36 = icmp slt i32 %32, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %31
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %155

38:                                               ; preds = %31
  store i32 0, ptr %5, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 -1, ptr %13, align 4, !tbaa !12
  br label %39

39:                                               ; preds = %91, %38
  %40 = load i32, ptr %13, align 4, !tbaa !12
  %41 = icmp sle i32 %40, 1
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %94

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 -1, ptr %14, align 4, !tbaa !12
  br label %44

44:                                               ; preds = %87, %43
  %45 = load i32, ptr %14, align 4, !tbaa !12
  %46 = icmp sle i32 %45, 1
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %90

48:                                               ; preds = %44
  %49 = load i32, ptr %12, align 4, !tbaa !12
  %50 = load i32, ptr %14, align 4, !tbaa !12
  %51 = add nsw i32 %49, %50
  %52 = load i32, ptr %10, align 4, !tbaa !12
  %53 = load i32, ptr %13, align 4, !tbaa !12
  %54 = add nsw i32 %52, %53
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.Image, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !14
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.Image, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %51, i32 noundef %54, i32 noundef %57, i32 noundef %60)
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %80

63:                                               ; preds = %48
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.Image, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !14
  %68 = load i32, ptr %10, align 4, !tbaa !12
  %69 = load i32, ptr %13, align 4, !tbaa !12
  %70 = add nsw i32 %68, %69
  %71 = mul nsw i32 %67, %70
  %72 = load i32, ptr %12, align 4, !tbaa !12
  %73 = load i32, ptr %14, align 4, !tbaa !12
  %74 = add nsw i32 %72, %73
  %75 = add nsw i32 %71, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %64, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !15
  %79 = zext i8 %78 to i32
  br label %81

80:                                               ; preds = %48
  br label %81

81:                                               ; preds = %80, %63
  %82 = phi i32 [ %79, %63 ], [ 0, %80 ]
  %83 = load i32, ptr %5, align 4, !tbaa !12
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %5, align 4, !tbaa !12
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 %85
  store i32 %82, ptr %86, align 4, !tbaa !12
  br label %87

87:                                               ; preds = %81
  %88 = load i32, ptr %14, align 4, !tbaa !12
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %14, align 4, !tbaa !12
  br label %44, !llvm.loop !16

90:                                               ; preds = %47
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %13, align 4, !tbaa !12
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %13, align 4, !tbaa !12
  br label %39, !llvm.loop !18

94:                                               ; preds = %42
  %95 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 2
  %96 = load i32, ptr %95, align 8, !tbaa !12
  %97 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 5
  %98 = load i32, ptr %97, align 4, !tbaa !12
  %99 = mul nsw i32 2, %98
  %100 = add nsw i32 %96, %99
  %101 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 8
  %102 = load i32, ptr %101, align 16, !tbaa !12
  %103 = add nsw i32 %100, %102
  %104 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 0
  %105 = load i32, ptr %104, align 16, !tbaa !12
  %106 = sub nsw i32 %103, %105
  %107 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 3
  %108 = load i32, ptr %107, align 4, !tbaa !12
  %109 = mul nsw i32 2, %108
  %110 = sub nsw i32 %106, %109
  %111 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 6
  %112 = load i32, ptr %111, align 8, !tbaa !12
  %113 = sub nsw i32 %110, %112
  %114 = call i32 @llvm.abs.i32(i32 %113, i1 true)
  store i32 %114, ptr %7, align 4, !tbaa !12
  %115 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 6
  %116 = load i32, ptr %115, align 8, !tbaa !12
  %117 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 7
  %118 = load i32, ptr %117, align 4, !tbaa !12
  %119 = mul nsw i32 2, %118
  %120 = add nsw i32 %116, %119
  %121 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 8
  %122 = load i32, ptr %121, align 16, !tbaa !12
  %123 = add nsw i32 %120, %122
  %124 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 0
  %125 = load i32, ptr %124, align 16, !tbaa !12
  %126 = sub nsw i32 %123, %125
  %127 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 1
  %128 = load i32, ptr %127, align 4, !tbaa !12
  %129 = mul nsw i32 2, %128
  %130 = sub nsw i32 %126, %129
  %131 = getelementptr inbounds [9 x i32], ptr %6, i64 0, i64 2
  %132 = load i32, ptr %131, align 8, !tbaa !12
  %133 = sub nsw i32 %130, %132
  %134 = call i32 @llvm.abs.i32(i32 %133, i1 true)
  store i32 %134, ptr %8, align 4, !tbaa !12
  %135 = load i32, ptr %7, align 4, !tbaa !12
  %136 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %135, i32 noundef 2)
  %137 = load i32, ptr %8, align 4, !tbaa !12
  %138 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %137, i32 noundef 2)
  %139 = fadd double %136, %138
  %140 = call double @sqrt(double noundef %139) #6
  %141 = fptoui double %140 to i8
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = load ptr, ptr %2, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.Image, ptr %143, i32 0, i32 0
  %145 = load i32, ptr %144, align 8, !tbaa !14
  %146 = load i32, ptr %10, align 4, !tbaa !12
  %147 = mul nsw i32 %145, %146
  %148 = load i32, ptr %12, align 4, !tbaa !12
  %149 = add nsw i32 %147, %148
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds i8, ptr %142, i64 %150
  store i8 %141, ptr %151, align 1, !tbaa !15
  br label %152

152:                                              ; preds = %94
  %153 = load i32, ptr %12, align 4, !tbaa !12
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %12, align 4, !tbaa !12
  br label %31, !llvm.loop !19

155:                                              ; preds = %37
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %10, align 4, !tbaa !12
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %10, align 4, !tbaa !12
  br label %23, !llvm.loop !20

159:                                              ; preds = %29
  %160 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 36, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret ptr %160
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13boundaryCheckiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) #5

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 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 16}
!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 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}


; 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.10 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z5SobelP5Image(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %0, ptr noundef nonnull @.str.10)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %2, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !11
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader48.lr.ph, label %._crit_edge55

.preheader48.lr.ph:                               ; preds = %1
  %10 = load i32, ptr %0, align 8, !tbaa !12
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.preheader48, label %._crit_edge55

.preheader48:                                     ; preds = %.preheader48.lr.ph, %._crit_edge
  %12 = phi i32 [ %21, %._crit_edge ], [ %8, %.preheader48.lr.ph ]
  %13 = phi i32 [ %22, %._crit_edge ], [ %10, %.preheader48.lr.ph ]
  %.03454 = phi i32 [ %.pre-phi, %._crit_edge ], [ 0, %.preheader48.lr.ph ]
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.preheader47.preheader, label %.preheader48.._crit_edge_crit_edge

.preheader48.._crit_edge_crit_edge:               ; preds = %.preheader48
  %.pre71 = add nuw nsw i32 %.03454, 1
  br label %._crit_edge

.preheader47.preheader:                           ; preds = %.preheader48
  %15 = add nsw i32 %.03454, -1
  %16 = add nuw nsw i32 %.03454, 1
  br label %.preheader47

._crit_edge55:                                    ; preds = %._crit_edge, %.preheader48.lr.ph, %1
  ret ptr %2

.preheader47:                                     ; preds = %.preheader47.preheader, %110
  %17 = phi i32 [ %131, %110 ], [ %13, %.preheader47.preheader ]
  %.03353 = phi i32 [ %44, %110 ], [ 0, %.preheader47.preheader ]
  %18 = add nsw i32 %.03353, -1
  %19 = load i32, ptr %7, align 4, !tbaa !11
  %20 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %18, i32 noundef %15, i32 noundef %17, i32 noundef %19)
  %.not = icmp eq i32 %20, 0
  %.pre = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not, label %31, label %24

._crit_edge.loopexit:                             ; preds = %110
  %.pre70 = load i32, ptr %7, align 4, !tbaa !11
  br label %._crit_edge

._crit_edge:                                      ; preds = %.preheader48.._crit_edge_crit_edge, %._crit_edge.loopexit
  %.pre-phi = phi i32 [ %.pre71, %.preheader48.._crit_edge_crit_edge ], [ %16, %._crit_edge.loopexit ]
  %21 = phi i32 [ %12, %.preheader48.._crit_edge_crit_edge ], [ %.pre70, %._crit_edge.loopexit ]
  %22 = phi i32 [ %13, %.preheader48.._crit_edge_crit_edge ], [ %131, %._crit_edge.loopexit ]
  %23 = icmp slt i32 %.pre-phi, %21
  br i1 %23, label %.preheader48, label %._crit_edge55, !llvm.loop !13

24:                                               ; preds = %.preheader47
  %25 = mul nsw i32 %.pre, %15
  %26 = add nsw i32 %25, %18
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr %4, i64 %27
  %29 = load i8, ptr %28, align 1, !tbaa !16
  %30 = zext i8 %29 to i32
  br label %31

31:                                               ; preds = %.preheader47, %24
  %32 = phi i32 [ %30, %24 ], [ 0, %.preheader47 ]
  %33 = load i32, ptr %7, align 4, !tbaa !11
  %34 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %.03353, i32 noundef %15, i32 noundef %.pre, i32 noundef %33)
  %.not.1 = icmp eq i32 %34, 0
  %.pre63 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.1, label %42, label %35

35:                                               ; preds = %31
  %36 = mul nsw i32 %.pre63, %15
  %37 = add nsw i32 %36, %.03353
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i8, ptr %4, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !16
  %41 = zext i8 %40 to i32
  br label %42

42:                                               ; preds = %35, %31
  %43 = phi i32 [ %41, %35 ], [ 0, %31 ]
  %44 = add nuw nsw i32 %.03353, 1
  %45 = load i32, ptr %7, align 4, !tbaa !11
  %46 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %44, i32 noundef %15, i32 noundef %.pre63, i32 noundef %45)
  %.not.2 = icmp eq i32 %46, 0
  %.pre64 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.2, label %.preheader.1, label %47

47:                                               ; preds = %42
  %48 = mul nsw i32 %.pre64, %15
  %49 = add nsw i32 %48, %44
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %4, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !16
  %53 = zext i8 %52 to i32
  br label %.preheader.1

.preheader.1:                                     ; preds = %47, %42
  %54 = phi i32 [ %53, %47 ], [ 0, %42 ]
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %18, i32 noundef %.03454, i32 noundef %.pre64, i32 noundef %55)
  %.not.160 = icmp eq i32 %56, 0
  %.pre65 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.160, label %64, label %57

57:                                               ; preds = %.preheader.1
  %58 = mul nsw i32 %.pre65, %.03454
  %59 = add nsw i32 %58, %18
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %4, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !16
  %63 = zext i8 %62 to i32
  br label %64

64:                                               ; preds = %57, %.preheader.1
  %65 = phi i32 [ %63, %57 ], [ 0, %.preheader.1 ]
  %66 = load i32, ptr %7, align 4, !tbaa !11
  %67 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %.03353, i32 noundef %.03454, i32 noundef %.pre65, i32 noundef %66)
  %.pre66 = load i32, ptr %0, align 8, !tbaa !12
  %68 = load i32, ptr %7, align 4, !tbaa !11
  %69 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %44, i32 noundef %.03454, i32 noundef %.pre66, i32 noundef %68)
  %.not.2.1 = icmp eq i32 %69, 0
  %.pre67 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.2.1, label %.preheader.2, label %70

70:                                               ; preds = %64
  %71 = mul nsw i32 %.pre67, %.03454
  %72 = add nsw i32 %71, %44
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i8, ptr %4, i64 %73
  %75 = load i8, ptr %74, align 1, !tbaa !16
  %76 = zext i8 %75 to i32
  br label %.preheader.2

.preheader.2:                                     ; preds = %70, %64
  %77 = phi i32 [ %76, %70 ], [ 0, %64 ]
  %78 = load i32, ptr %7, align 4, !tbaa !11
  %79 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %18, i32 noundef %16, i32 noundef %.pre67, i32 noundef %78)
  %.not.262 = icmp eq i32 %79, 0
  %.pre68 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.262, label %87, label %80

80:                                               ; preds = %.preheader.2
  %81 = mul nsw i32 %.pre68, %16
  %82 = add nsw i32 %81, %18
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %4, i64 %83
  %85 = load i8, ptr %84, align 1, !tbaa !16
  %86 = zext i8 %85 to i32
  br label %87

87:                                               ; preds = %80, %.preheader.2
  %88 = phi i32 [ %86, %80 ], [ 0, %.preheader.2 ]
  %89 = load i32, ptr %7, align 4, !tbaa !11
  %90 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %.03353, i32 noundef %16, i32 noundef %.pre68, i32 noundef %89)
  %.not.1.2 = icmp eq i32 %90, 0
  %.pre69 = load i32, ptr %0, align 8, !tbaa !12
  br i1 %.not.1.2, label %98, label %91

91:                                               ; preds = %87
  %92 = mul nsw i32 %.pre69, %16
  %93 = add nsw i32 %92, %.03353
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i8, ptr %4, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !16
  %97 = zext i8 %96 to i32
  br label %98

98:                                               ; preds = %91, %87
  %99 = phi i32 [ %97, %91 ], [ 0, %87 ]
  %100 = load i32, ptr %7, align 4, !tbaa !11
  %101 = tail call noundef i32 @_Z13boundaryCheckiiii(i32 noundef %44, i32 noundef %16, i32 noundef %.pre69, i32 noundef %100)
  %.not.2.2 = icmp eq i32 %101, 0
  br i1 %.not.2.2, label %110, label %102

102:                                              ; preds = %98
  %103 = load i32, ptr %0, align 8, !tbaa !12
  %104 = mul nsw i32 %103, %16
  %105 = add nsw i32 %104, %44
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds i8, ptr %4, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !16
  %109 = zext i8 %108 to i32
  br label %110

110:                                              ; preds = %102, %98
  %111 = phi i32 [ %109, %102 ], [ 0, %98 ]
  %reass.add = sub nsw i32 %77, %65
  %reass.mul = shl nsw i32 %reass.add, 1
  %.neg39 = add nuw nsw i32 %111, %54
  %112 = add nuw nsw i32 %32, %88
  %113 = sub nsw i32 %.neg39, %112
  %114 = add nsw i32 %113, %reass.mul
  %115 = tail call i32 @llvm.abs.i32(i32 %114, i1 true)
  %reass.add45 = sub nsw i32 %99, %43
  %reass.mul46 = shl nsw i32 %reass.add45, 1
  %116 = add nuw nsw i32 %54, %32
  %117 = sub nsw i32 %111, %116
  %118 = add nsw i32 %117, %88
  %119 = add nsw i32 %118, %reass.mul46
  %120 = tail call i32 @llvm.abs.i32(i32 %119, i1 true)
  %121 = tail call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %115, i32 noundef 2)
  %122 = tail call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef %120, i32 noundef 2)
  %123 = fadd double %121, %122
  %124 = tail call double @sqrt(double noundef %123) #5
  %125 = fptoui double %124 to i8
  %126 = load i32, ptr %0, align 8, !tbaa !12
  %127 = mul nsw i32 %126, %.03454
  %128 = add nsw i32 %127, %.03353
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %6, i64 %129
  store i8 %125, ptr %130, align 1, !tbaa !16
  %131 = load i32, ptr %0, align 8, !tbaa !12
  %132 = icmp slt i32 %44, %131
  br i1 %132, label %.preheader47, label %._crit_edge.loopexit, !llvm.loop !17
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z13boundaryCheckiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #2

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

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

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #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 = { 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, !10, i64 16}
!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, !7, i64 0}
!13 = distinct !{!13, !14, !15}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !14}


; Effective O3 passes: ADCEPass,BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass