; LLVM IR from zchrissirhcz/pixel :: src (px_flip)

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

@.str = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.px_flip = external hidden unnamed_addr constant [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @px_flip(ptr noundef %0, ptr noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %29

25:                                               ; preds = %3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  br label %30

29:                                               ; preds = %25, %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 10, ptr noundef @__PRETTY_FUNCTION__.px_flip) #6
  unreachable

30:                                               ; preds = %28
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call zeroext i1 @px_image_equal_in_shape(ptr noundef %31, ptr noundef %32, i1 noundef zeroext false)
  br i1 %33, label %34, label %35

34:                                               ; preds = %30
  br label %36

35:                                               ; preds = %30
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 11, ptr noundef @__PRETTY_FUNCTION__.px_flip) #6
  unreachable

36:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.px_image_t, ptr %37, i32 0, i32 2
  %39 = load i32, ptr %38, align 4, !tbaa !11
  store i32 %39, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.px_image_t, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !13
  store i32 %42, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.px_image_t, ptr %43, i32 0, i32 3
  %45 = load i32, ptr %44, align 8, !tbaa !14
  store i32 %45, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.px_image_t, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = mul nsw i32 %48, %49
  store i32 %50, ptr %10, align 4, !tbaa !9
  %51 = load i32, ptr %6, align 4, !tbaa !9
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %95

53:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %54 = load i32, ptr %10, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = mul i64 1, %55
  %57 = trunc i64 %56 to i32
  store i32 %57, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %91, %53
  %59 = load i32, ptr %12, align 4, !tbaa !9
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %94

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.px_image_t, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !15
  %67 = load i32, ptr %12, align 4, !tbaa !9
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.px_image_t, ptr %68, i32 0, i32 4
  %70 = load i32, ptr %69, align 4, !tbaa !16
  %71 = mul nsw i32 %67, %70
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %66, i64 %72
  store ptr %73, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.px_image_t, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !15
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = sub nsw i32 %77, 1
  %79 = load i32, ptr %12, align 4, !tbaa !9
  %80 = sub nsw i32 %78, %79
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.px_image_t, ptr %81, i32 0, i32 4
  %83 = load i32, ptr %82, align 4, !tbaa !16
  %84 = mul nsw i32 %80, %83
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %76, i64 %85
  store ptr %86, ptr %14, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = load i32, ptr %11, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %87, ptr align 1 %88, i64 %90, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %91

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

94:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %200

95:                                               ; preds = %36
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = icmp eq i32 %96, 1
  br i1 %97, label %98, label %170

98:                                               ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %166, %98
  %100 = load i32, ptr %15, align 4, !tbaa !9
  %101 = load i32, ptr %7, align 4, !tbaa !9
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %169

104:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.px_image_t, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  %108 = load i32, ptr %15, align 4, !tbaa !9
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.px_image_t, ptr %109, i32 0, i32 4
  %111 = load i32, ptr %110, align 4, !tbaa !16
  %112 = mul nsw i32 %108, %111
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i8, ptr %107, i64 %113
  store ptr %114, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.px_image_t, ptr %115, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !15
  %118 = load i32, ptr %15, align 4, !tbaa !9
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.px_image_t, ptr %119, i32 0, i32 4
  %121 = load i32, ptr %120, align 4, !tbaa !16
  %122 = mul nsw i32 %118, %121
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i8, ptr %117, i64 %123
  store ptr %124, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %162, %104
  %126 = load i32, ptr %19, align 4, !tbaa !9
  %127 = load i32, ptr %8, align 4, !tbaa !9
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %165

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  %131 = load i32, ptr %8, align 4, !tbaa !9
  %132 = sub nsw i32 %131, 1
  %133 = load i32, ptr %19, align 4, !tbaa !9
  %134 = sub nsw i32 %132, %133
  store i32 %134, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %135

135:                                              ; preds = %158, %130
  %136 = load i32, ptr %21, align 4, !tbaa !9
  %137 = load i32, ptr %9, align 4, !tbaa !9
  %138 = icmp slt i32 %136, %137
  br i1 %138, label %140, label %139

139:                                              ; preds = %135
  store i32 11, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %161

140:                                              ; preds = %135
  %141 = load ptr, ptr %17, align 8, !tbaa !5
  %142 = load i32, ptr %19, align 4, !tbaa !9
  %143 = load i32, ptr %9, align 4, !tbaa !9
  %144 = mul nsw i32 %142, %143
  %145 = load i32, ptr %21, align 4, !tbaa !9
  %146 = add nsw i32 %144, %145
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i8, ptr %141, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !19
  %150 = load ptr, ptr %18, align 8, !tbaa !5
  %151 = load i32, ptr %20, align 4, !tbaa !9
  %152 = load i32, ptr %9, align 4, !tbaa !9
  %153 = mul nsw i32 %151, %152
  %154 = load i32, ptr %21, align 4, !tbaa !9
  %155 = add nsw i32 %153, %154
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds i8, ptr %150, i64 %156
  store i8 %149, ptr %157, align 1, !tbaa !19
  br label %158

158:                                              ; preds = %140
  %159 = load i32, ptr %21, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %21, align 4, !tbaa !9
  br label %135, !llvm.loop !20

161:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %19, align 4, !tbaa !9
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %19, align 4, !tbaa !9
  br label %125, !llvm.loop !21

165:                                              ; preds = %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %15, align 4, !tbaa !9
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %15, align 4, !tbaa !9
  br label %99, !llvm.loop !22

169:                                              ; preds = %103
  br label %199

170:                                              ; preds = %95
  %171 = load i32, ptr %6, align 4, !tbaa !9
  %172 = icmp eq i32 %171, 2
  br i1 %172, label %173, label %189

173:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.px_image_t, ptr %174, i32 0, i32 2
  %176 = load i32, ptr %175, align 4, !tbaa !11
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.px_image_t, ptr %177, i32 0, i32 1
  %179 = load i32, ptr %178, align 8, !tbaa !13
  %180 = load ptr, ptr %4, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.px_image_t, ptr %180, i32 0, i32 3
  %182 = load i32, ptr %181, align 8, !tbaa !14
  %183 = call ptr @px_create_image(i32 noundef %176, i32 noundef %179, i32 noundef %182)
  store ptr %183, ptr %22, align 8, !tbaa !5
  %184 = load ptr, ptr %4, align 8, !tbaa !5
  %185 = load ptr, ptr %22, align 8, !tbaa !5
  call void @px_flip(ptr noundef %184, ptr noundef %185, i32 noundef 0)
  %186 = load ptr, ptr %22, align 8, !tbaa !5
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  call void @px_flip(ptr noundef %186, ptr noundef %187, i32 noundef 1)
  %188 = load ptr, ptr %22, align 8, !tbaa !5
  call void @px_destroy_image(ptr noundef %188)
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %198

189:                                              ; preds = %170
  br label %190

190:                                              ; preds = %189
  %191 = load ptr, ptr @stderr, align 8, !tbaa !5
  %192 = load i32, ptr %6, align 4, !tbaa !9
  %193 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %191, ptr noundef @.str.3, i32 noundef %192) #7
  %194 = load ptr, ptr @stderr, align 8, !tbaa !5
  %195 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %194, ptr noundef @.str.4) #7
  br label %196

196:                                              ; preds = %190
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197, %173
  br label %199

199:                                              ; preds = %198, %169
  br label %200

200:                                              ; preds = %199, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

declare zeroext i1 @px_image_equal_in_shape(ptr noundef, ptr noundef, i1 noundef zeroext) #2

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

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

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

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

declare void @px_destroy_image(ptr noundef) #2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 12}
!12 = !{!"px_image_t", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !10, i64 20}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !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 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [66 x i8], align 1
@__PRETTY_FUNCTION__.px_flip = external hidden unnamed_addr constant [55 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [37 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @px_flip(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp ne ptr %0, null
  %5 = icmp ne ptr %1, null
  %or.cond = and i1 %4, %5
  br i1 %or.cond, label %7, label %6

6:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 10, ptr noundef nonnull @__PRETTY_FUNCTION__.px_flip) #5
  unreachable

7:                                                ; preds = %3
  %8 = tail call zeroext i1 @px_image_equal_in_shape(ptr noundef nonnull %0, ptr noundef nonnull %1, i1 noundef zeroext false) #6
  br i1 %8, label %10, label %9

9:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 11, ptr noundef nonnull @__PRETTY_FUNCTION__.px_flip) #5
  unreachable

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 12
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  %16 = load i32, ptr %15, align 8, !tbaa !12
  switch i32 %2, label %94 [
    i32 0, label %45
    i32 1, label %.preheader
    i32 2, label %65
  ]

.preheader:                                       ; preds = %10
  %17 = icmp sgt i32 %12, 0
  br i1 %17, label %.lr.ph78, label %common.ret117

.lr.ph78:                                         ; preds = %.preheader
  %18 = getelementptr inbounds i8, ptr %0, i64 20
  %19 = getelementptr inbounds i8, ptr %1, i64 20
  %20 = icmp sgt i32 %14, 0
  %21 = icmp sgt i32 %16, 0
  %or.cond101 = select i1 %20, i1 %21, i1 false
  br i1 %or.cond101, label %.lr.ph75.us.us.preheader, label %common.ret117

.lr.ph75.us.us.preheader:                         ; preds = %.lr.ph78
  %22 = zext nneg i32 %14 to i64
  %23 = zext nneg i32 %16 to i64
  %wide.trip.count94 = zext nneg i32 %14 to i64
  %wide.trip.count = zext nneg i32 %16 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %24 = icmp ult i32 %16, 4
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph75.us.us

.lr.ph75.us.us:                                   ; preds = %.lr.ph75.us.us.preheader, %._crit_edge76.split.us.us.us
  %.06177.us.us = phi i32 [ %44, %._crit_edge76.split.us.us.us ], [ 0, %.lr.ph75.us.us.preheader ]
  %25 = load ptr, ptr %0, align 8, !tbaa !13
  %26 = load i32, ptr %18, align 4, !tbaa !14
  %27 = mul nsw i32 %26, %.06177.us.us
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %25, i64 %28
  %30 = load ptr, ptr %1, align 8, !tbaa !13
  %31 = load i32, ptr %19, align 4, !tbaa !14
  %32 = mul nsw i32 %31, %.06177.us.us
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i8, ptr %30, i64 %33
  br label %iter.check

iter.check:                                       ; preds = %._crit_edge.us.us.us, %.lr.ph75.us.us
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %._crit_edge.us.us.us ], [ 0, %.lr.ph75.us.us ]
  %35 = xor i64 %indvars.iv91, -1
  %36 = add nsw i64 %22, %35
  %37 = mul nuw nsw i64 %indvars.iv91, %23
  %38 = mul nsw i64 %36, %23
  %invariant.gep = getelementptr inbounds i8, ptr %29, i64 %37
  %invariant.gep99 = getelementptr i8, ptr %34, i64 %38
  br i1 %24, label %._crit_edge.us.us.us.unr-lcssa, label %iter.check.new

iter.check.new:                                   ; preds = %iter.check, %iter.check.new
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %iter.check.new ], [ 0, %iter.check ]
  %niter = phi i64 [ %niter.next.3, %iter.check.new ], [ 0, %iter.check ]
  %gep = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv
  %39 = load i8, ptr %gep, align 1, !tbaa !15
  %gep100 = getelementptr i8, ptr %invariant.gep99, i64 %indvars.iv
  store i8 %39, ptr %gep100, align 1, !tbaa !15
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %gep.1 = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv.next
  %40 = load i8, ptr %gep.1, align 1, !tbaa !15
  %gep100.1 = getelementptr i8, ptr %invariant.gep99, i64 %indvars.iv.next
  store i8 %40, ptr %gep100.1, align 1, !tbaa !15
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %gep.2 = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv.next.1
  %41 = load i8, ptr %gep.2, align 1, !tbaa !15
  %gep100.2 = getelementptr i8, ptr %invariant.gep99, i64 %indvars.iv.next.1
  store i8 %41, ptr %gep100.2, align 1, !tbaa !15
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %gep.3 = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv.next.2
  %42 = load i8, ptr %gep.3, align 1, !tbaa !15
  %gep100.3 = getelementptr i8, ptr %invariant.gep99, i64 %indvars.iv.next.2
  store i8 %42, ptr %gep100.3, align 1, !tbaa !15
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.us.us.us.unr-lcssa, label %iter.check.new, !llvm.loop !16

._crit_edge.us.us.us.unr-lcssa:                   ; preds = %iter.check.new, %iter.check
  %indvars.iv.unr = phi i64 [ 0, %iter.check ], [ %indvars.iv.next.3, %iter.check.new ]
  br i1 %lcmp.mod.not, label %._crit_edge.us.us.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.us.us.unr-lcssa, %.epil.preheader
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.epil.preheader ], [ %indvars.iv.unr, %._crit_edge.us.us.us.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.us.us.us.unr-lcssa ]
  %gep.epil = getelementptr inbounds i8, ptr %invariant.gep, i64 %indvars.iv.epil
  %43 = load i8, ptr %gep.epil, align 1, !tbaa !15
  %gep100.epil = getelementptr i8, ptr %invariant.gep99, i64 %indvars.iv.epil
  store i8 %43, ptr %gep100.epil, align 1, !tbaa !15
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge.us.us.us, label %.epil.preheader, !llvm.loop !19

._crit_edge.us.us.us:                             ; preds = %.epil.preheader, %._crit_edge.us.us.us.unr-lcssa
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %exitcond95.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count94
  br i1 %exitcond95.not, label %._crit_edge76.split.us.us.us, label %iter.check, !llvm.loop !21

._crit_edge76.split.us.us.us:                     ; preds = %._crit_edge.us.us.us
  %44 = add nuw nsw i32 %.06177.us.us, 1
  %exitcond96.not = icmp eq i32 %44, %12
  br i1 %exitcond96.not, label %common.ret117, label %.lr.ph75.us.us, !llvm.loop !22

45:                                               ; preds = %10
  %46 = mul nsw i32 %16, %14
  %47 = sext i32 %46 to i64
  %48 = icmp sgt i32 %12, 0
  br i1 %48, label %.lr.ph83, label %common.ret117

.lr.ph83:                                         ; preds = %45
  %49 = getelementptr inbounds i8, ptr %0, i64 20
  %50 = getelementptr inbounds i8, ptr %1, i64 20
  br label %51

51:                                               ; preds = %.lr.ph83, %51
  %.082 = phi i32 [ 0, %.lr.ph83 ], [ %64, %51 ]
  %52 = load ptr, ptr %0, align 8, !tbaa !13
  %53 = load i32, ptr %49, align 4, !tbaa !14
  %54 = mul nsw i32 %53, %.082
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i8, ptr %52, i64 %55
  %57 = load ptr, ptr %1, align 8, !tbaa !13
  %58 = xor i32 %.082, -1
  %59 = add nsw i32 %12, %58
  %60 = load i32, ptr %50, align 4, !tbaa !14
  %61 = mul nsw i32 %60, %59
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %57, i64 %62
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %63, ptr align 1 %56, i64 %47, i1 false)
  %64 = add nuw nsw i32 %.082, 1
  %exitcond97.not = icmp eq i32 %64, %12
  br i1 %exitcond97.not, label %common.ret117, label %51, !llvm.loop !23

65:                                               ; preds = %10
  %66 = tail call ptr @px_create_image(i32 noundef %12, i32 noundef %14, i32 noundef %16) #6
  %.not = icmp eq ptr %66, null
  br i1 %.not, label %67, label %68

67:                                               ; preds = %65
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 10, ptr noundef nonnull @__PRETTY_FUNCTION__.px_flip) #5
  unreachable

68:                                               ; preds = %65
  %69 = tail call zeroext i1 @px_image_equal_in_shape(ptr noundef nonnull %0, ptr noundef nonnull %66, i1 noundef zeroext false) #6
  br i1 %69, label %71, label %70

70:                                               ; preds = %68
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 11, ptr noundef nonnull @__PRETTY_FUNCTION__.px_flip) #5
  unreachable

71:                                               ; preds = %68
  %72 = load i32, ptr %11, align 4, !tbaa !5
  %73 = load i32, ptr %13, align 8, !tbaa !11
  %74 = load i32, ptr %15, align 8, !tbaa !12
  %75 = mul nsw i32 %74, %73
  %76 = sext i32 %75 to i64
  %77 = icmp sgt i32 %72, 0
  br i1 %77, label %.lr.ph, label %px_flip.exit

.lr.ph:                                           ; preds = %71
  %78 = getelementptr inbounds i8, ptr %0, i64 20
  %79 = getelementptr inbounds i8, ptr %66, i64 20
  br label %80

80:                                               ; preds = %.lr.ph, %80
  %.0.i70 = phi i32 [ 0, %.lr.ph ], [ %93, %80 ]
  %81 = load ptr, ptr %0, align 8, !tbaa !13
  %82 = load i32, ptr %78, align 4, !tbaa !14
  %83 = mul nsw i32 %82, %.0.i70
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i8, ptr %81, i64 %84
  %86 = load ptr, ptr %66, align 8, !tbaa !13
  %87 = xor i32 %.0.i70, -1
  %88 = add nsw i32 %72, %87
  %89 = load i32, ptr %79, align 4, !tbaa !14
  %90 = mul nsw i32 %89, %88
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %86, i64 %91
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %92, ptr align 1 %85, i64 %76, i1 false)
  %93 = add nuw nsw i32 %.0.i70, 1
  %exitcond.not = icmp eq i32 %93, %72
  br i1 %exitcond.not, label %px_flip.exit, label %80, !llvm.loop !23

common.ret117:                                    ; preds = %94, %45, %.preheader, %.lr.ph78, %51, %._crit_edge76.split.us.us.us, %px_flip.exit
  ret void

px_flip.exit:                                     ; preds = %80, %71
  tail call void @px_flip(ptr noundef nonnull %66, ptr noundef nonnull %1, i32 noundef 1)
  tail call void @px_destroy_image(ptr noundef nonnull %66) #6
  br label %common.ret117

94:                                               ; preds = %10
  %95 = load ptr, ptr @stderr, align 8, !tbaa !24
  %96 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.3, i32 noundef %2) #7
  %97 = load ptr, ptr @stderr, align 8, !tbaa !24
  %98 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef nonnull @.str.4) #7
  br label %common.ret117
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @px_image_equal_in_shape(ptr noundef, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

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

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

declare void @px_destroy_image(ptr noundef) local_unnamed_addr #2

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

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


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