; LLVM IR from niessner/Matterport :: code/gaps/pkgs/png (pngpread)

; 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.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i32, i32, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, float, float, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, ptr, i8, i16, i16, i16, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, %struct.png_unknown_chunk_t, i32, i32, ptr, i32 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_row_info_struct = type { i32, i64, i8, i8, i8, i8 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }

@__const.png_read_push_finish_row.png_pass_start = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_inc = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_ystart = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_yinc = external hidden unnamed_addr constant [7 x i32], align 16

; 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: 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) #1

; Function Attrs: nounwind uwtable
define dso_local void @png_read_push_finish_row(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca [7 x i32], align 16
  %4 = alloca [7 x i32], align 16
  %5 = alloca [7 x i32], align 16
  %6 = alloca [7 x i32], align 16
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 28, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.png_read_push_finish_row.png_pass_start, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 28, ptr %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %4, ptr align 16 @__const.png_read_push_finish_row.png_pass_inc, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 28, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.png_read_push_finish_row.png_pass_ystart, i64 28, i1 false)
  call void @llvm.lifetime.start.p0(i64 28, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.png_read_push_finish_row.png_pass_yinc, i64 28, i1 false)
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.png_struct_def, ptr %8, i32 0, i32 31
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = add i32 %10, 1
  store i32 %11, ptr %9, align 4, !tbaa !9
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.png_struct_def, ptr %12, i32 0, i32 31
  %14 = load i32, ptr %13, align 4, !tbaa !9
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.png_struct_def, ptr %15, i32 0, i32 26
  %17 = load i32, ptr %16, align 4, !tbaa !20
  %18 = icmp ult i32 %14, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %1
  store i32 1, ptr %7, align 4
  br label %171

20:                                               ; preds = %1
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 47
  %23 = load i8, ptr %22, align 1, !tbaa !21
  %24 = icmp ne i8 %23, 0
  br i1 %24, label %25, label %170

25:                                               ; preds = %20
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.png_struct_def, ptr %26, i32 0, i32 31
  store i32 0, ptr %27, align 4, !tbaa !9
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 32
  %30 = load ptr, ptr %29, align 8, !tbaa !22
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.png_struct_def, ptr %31, i32 0, i32 28
  %33 = load i64, ptr %32, align 8, !tbaa !23
  %34 = add i64 %33, 1
  call void @llvm.memset.p0.i64(ptr align 1 %30, i8 0, i64 %34, i1 false)
  br label %35

35:                                               ; preds = %167, %25
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.png_struct_def, ptr %36, i32 0, i32 48
  %38 = load i8, ptr %37, align 4, !tbaa !24
  %39 = add i8 %38, 1
  store i8 %39, ptr %37, align 4, !tbaa !24
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.png_struct_def, ptr %40, i32 0, i32 48
  %42 = load i8, ptr %41, align 4, !tbaa !24
  %43 = zext i8 %42 to i32
  %44 = icmp eq i32 %43, 1
  br i1 %44, label %45, label %50

45:                                               ; preds = %35
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.png_struct_def, ptr %46, i32 0, i32 24
  %48 = load i32, ptr %47, align 4, !tbaa !25
  %49 = icmp ult i32 %48, 5
  br i1 %49, label %72, label %50

50:                                               ; preds = %45, %35
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.png_struct_def, ptr %51, i32 0, i32 48
  %53 = load i8, ptr %52, align 4, !tbaa !24
  %54 = zext i8 %53 to i32
  %55 = icmp eq i32 %54, 3
  br i1 %55, label %56, label %61

56:                                               ; preds = %50
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.png_struct_def, ptr %57, i32 0, i32 24
  %59 = load i32, ptr %58, align 4, !tbaa !25
  %60 = icmp ult i32 %59, 3
  br i1 %60, label %72, label %61

61:                                               ; preds = %56, %50
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.png_struct_def, ptr %62, i32 0, i32 48
  %64 = load i8, ptr %63, align 4, !tbaa !24
  %65 = zext i8 %64 to i32
  %66 = icmp eq i32 %65, 5
  br i1 %66, label %67, label %77

67:                                               ; preds = %61
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 24
  %70 = load i32, ptr %69, align 4, !tbaa !25
  %71 = icmp ult i32 %70, 2
  br i1 %71, label %72, label %77

72:                                               ; preds = %67, %56, %45
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.png_struct_def, ptr %73, i32 0, i32 48
  %75 = load i8, ptr %74, align 4, !tbaa !24
  %76 = add i8 %75, 1
  store i8 %76, ptr %74, align 4, !tbaa !24
  br label %77

77:                                               ; preds = %72, %67, %61
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.png_struct_def, ptr %78, i32 0, i32 48
  %80 = load i8, ptr %79, align 4, !tbaa !24
  %81 = zext i8 %80 to i32
  %82 = icmp sgt i32 %81, 7
  br i1 %82, label %83, label %88

83:                                               ; preds = %77
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_struct_def, ptr %84, i32 0, i32 48
  %86 = load i8, ptr %85, align 4, !tbaa !24
  %87 = add i8 %86, -1
  store i8 %87, ptr %85, align 4, !tbaa !24
  br label %88

88:                                               ; preds = %83, %77
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.png_struct_def, ptr %89, i32 0, i32 48
  %91 = load i8, ptr %90, align 4, !tbaa !24
  %92 = zext i8 %91 to i32
  %93 = icmp sge i32 %92, 7
  br i1 %93, label %94, label %95

94:                                               ; preds = %88
  br label %169

95:                                               ; preds = %88
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 24
  %98 = load i32, ptr %97, align 4, !tbaa !25
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_struct_def, ptr %99, i32 0, i32 48
  %101 = load i8, ptr %100, align 4, !tbaa !24
  %102 = zext i8 %101 to i64
  %103 = getelementptr inbounds [7 x i32], ptr %4, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !26
  %105 = add i32 %98, %104
  %106 = sub i32 %105, 1
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.png_struct_def, ptr %107, i32 0, i32 48
  %109 = load i8, ptr %108, align 4, !tbaa !24
  %110 = zext i8 %109 to i64
  %111 = getelementptr inbounds [7 x i32], ptr %3, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !26
  %113 = sub i32 %106, %112
  %114 = load ptr, ptr %2, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_struct_def, ptr %114, i32 0, i32 48
  %116 = load i8, ptr %115, align 4, !tbaa !24
  %117 = zext i8 %116 to i64
  %118 = getelementptr inbounds [7 x i32], ptr %4, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !26
  %120 = udiv i32 %113, %119
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.png_struct_def, ptr %121, i32 0, i32 30
  store i32 %120, ptr %122, align 8, !tbaa !27
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.png_struct_def, ptr %123, i32 0, i32 15
  %125 = load i32, ptr %124, align 4, !tbaa !28
  %126 = and i32 %125, 2
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %95
  br label %169

129:                                              ; preds = %95
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.png_struct_def, ptr %130, i32 0, i32 25
  %132 = load i32, ptr %131, align 8, !tbaa !29
  %133 = load ptr, ptr %2, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_struct_def, ptr %133, i32 0, i32 48
  %135 = load i8, ptr %134, align 4, !tbaa !24
  %136 = zext i8 %135 to i64
  %137 = getelementptr inbounds [7 x i32], ptr %6, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !26
  %139 = add i32 %132, %138
  %140 = sub i32 %139, 1
  %141 = load ptr, ptr %2, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_struct_def, ptr %141, i32 0, i32 48
  %143 = load i8, ptr %142, align 4, !tbaa !24
  %144 = zext i8 %143 to i64
  %145 = getelementptr inbounds [7 x i32], ptr %5, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !26
  %147 = sub i32 %140, %146
  %148 = load ptr, ptr %2, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.png_struct_def, ptr %148, i32 0, i32 48
  %150 = load i8, ptr %149, align 4, !tbaa !24
  %151 = zext i8 %150 to i64
  %152 = getelementptr inbounds [7 x i32], ptr %6, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !26
  %154 = udiv i32 %147, %153
  %155 = load ptr, ptr %2, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.png_struct_def, ptr %155, i32 0, i32 26
  store i32 %154, ptr %156, align 4, !tbaa !20
  br label %157

157:                                              ; preds = %129
  %158 = load ptr, ptr %2, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.png_struct_def, ptr %158, i32 0, i32 30
  %160 = load i32, ptr %159, align 8, !tbaa !27
  %161 = icmp eq i32 %160, 0
  br i1 %161, label %167, label %162

162:                                              ; preds = %157
  %163 = load ptr, ptr %2, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.png_struct_def, ptr %163, i32 0, i32 26
  %165 = load i32, ptr %164, align 4, !tbaa !20
  %166 = icmp eq i32 %165, 0
  br label %167

167:                                              ; preds = %162, %157
  %168 = phi i1 [ true, %157 ], [ %166, %162 ]
  br i1 %168, label %35, label %169, !llvm.loop !30

169:                                              ; preds = %167, %128, %94
  br label %170

170:                                              ; preds = %169, %20
  store i32 0, ptr %7, align 4
  br label %171

171:                                              ; preds = %170, %19
  call void @llvm.lifetime.end.p0(i64 28, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 28, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 28, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 28, ptr %3) #4
  %172 = load i32, ptr %7, align 4
  switch i32 %172, label %174 [
    i32 0, label %173
    i32 1, label %173
  ]

173:                                              ; preds = %171, %171
  ret void

174:                                              ; preds = %171
  unreachable
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !11, i64 484}
!10 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !7, i64 280, !7, i64 281, !11, i64 284, !11, i64 288, !11, i64 292, !12, i64 296, !6, i64 408, !13, i64 416, !11, i64 424, !11, i64 428, !11, i64 432, !11, i64 436, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !13, i64 464, !13, i64 472, !11, i64 480, !11, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !14, i64 536, !11, i64 560, !11, i64 564, !6, i64 568, !15, i64 576, !15, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !15, i64 598, !7, i64 600, !16, i64 604, !17, i64 608, !17, i64 618, !6, i64 632, !11, i64 640, !11, i64 644, !11, i64 648, !16, i64 652, !16, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !18, i64 712, !18, i64 717, !6, i64 728, !17, i64 736, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !11, i64 824, !11, i64 828, !13, i64 832, !13, i64 840, !13, i64 848, !13, i64 856, !11, i64 864, !11, i64 868, !13, i64 872, !13, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !7, i64 929, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !11, i64 984, !6, i64 992, !6, i64 1000, !11, i64 1008, !6, i64 1016, !7, i64 1024, !15, i64 1026, !15, i64 1028, !15, i64 1030, !11, i64 1032, !11, i64 1036, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !7, i64 1104, !11, i64 1108, !11, i64 1112, !11, i64 1116, !19, i64 1120, !11, i64 1152, !11, i64 1156, !6, i64 1160, !11, i64 1168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !6, i64 0, !11, i64 8, !13, i64 16, !6, i64 24, !11, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !13, i64 96, !13, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!"png_row_info_struct", !11, i64 0, !13, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!15 = !{!"short", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!18 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!19 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!20 = !{!10, !11, i64 452}
!21 = !{!10, !7, i64 587}
!22 = !{!10, !6, i64 488}
!23 = !{!10, !13, i64 464}
!24 = !{!10, !7, i64 588}
!25 = !{!10, !11, i64 444}
!26 = !{!11, !11, i64 0}
!27 = !{!10, !11, i64 480}
!28 = !{!10, !11, i64 292}
!29 = !{!10, !11, i64 448}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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

@__const.png_read_push_finish_row.png_pass_start = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_inc = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_ystart = external hidden unnamed_addr constant [7 x i32], align 16
@__const.png_read_push_finish_row.png_pass_yinc = external hidden unnamed_addr constant [7 x i32], align 16

; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local void @png_read_push_finish_row(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 484
  %3 = load i32, ptr %2, align 4, !tbaa !5
  %4 = add i32 %3, 1
  store i32 %4, ptr %2, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 452
  %6 = load i32, ptr %5, align 4, !tbaa !19
  %7 = icmp ult i32 %4, %6
  br i1 %7, label %63, label %8

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 587
  %10 = load i8, ptr %9, align 1, !tbaa !20
  %.not = icmp eq i8 %10, 0
  br i1 %.not, label %63, label %11

11:                                               ; preds = %8
  store i32 0, ptr %2, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 488
  %13 = load ptr, ptr %12, align 8, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %0, i64 464
  %15 = load i64, ptr %14, align 8, !tbaa !22
  %16 = add i64 %15, 1
  tail call void @llvm.memset.p0.i64(ptr align 1 %13, i8 0, i64 %16, i1 false)
  %17 = getelementptr inbounds i8, ptr %0, i64 588
  %.promoted = load i8, ptr %17, align 4, !tbaa !23
  %18 = getelementptr inbounds i8, ptr %0, i64 444
  %19 = getelementptr inbounds i8, ptr %0, i64 480
  %20 = getelementptr inbounds i8, ptr %0, i64 292
  %21 = getelementptr inbounds i8, ptr %0, i64 448
  br label %.critedge

.critedge:                                        ; preds = %51, %11
  %.pr37 = phi i8 [ %39, %51 ], [ %.promoted, %11 ]
  %22 = add i8 %.pr37, 1
  switch i8 %.pr37, label %.thread32 [
    i8 0, label %23
    i8 2, label %26
    i8 4, label %29
  ]

23:                                               ; preds = %.critedge
  %24 = load i32, ptr %18, align 4, !tbaa !24
  %25 = icmp ult i32 %24, 5
  br i1 %25, label %.thread35, label %._crit_edge

26:                                               ; preds = %.critedge
  %27 = load i32, ptr %18, align 4, !tbaa !24
  %28 = icmp ult i32 %27, 3
  br i1 %28, label %.thread35, label %._crit_edge

29:                                               ; preds = %.critedge
  %30 = load i32, ptr %18, align 4, !tbaa !24
  %31 = icmp ult i32 %30, 2
  br i1 %31, label %.thread35, label %._crit_edge

.thread35:                                        ; preds = %29, %26, %23
  %32 = phi i32 [ %30, %29 ], [ %27, %26 ], [ %24, %23 ]
  %33 = add nuw nsw i8 %.pr37, 2
  br label %37

.thread32:                                        ; preds = %.critedge
  %34 = icmp ugt i8 %22, 7
  br i1 %34, label %.sink.split, label %35

35:                                               ; preds = %.thread32
  %36 = icmp eq i8 %22, 7
  br i1 %36, label %.sink.split, label %._crit_edge

._crit_edge:                                      ; preds = %23, %26, %29, %35
  %.pre = load i32, ptr %18, align 4, !tbaa !24
  br label %37

37:                                               ; preds = %._crit_edge, %.thread35
  %38 = phi i32 [ %32, %.thread35 ], [ %.pre, %._crit_edge ]
  %39 = phi i8 [ %33, %.thread35 ], [ %22, %._crit_edge ]
  %40 = zext nneg i8 %39 to i64
  %41 = getelementptr inbounds [7 x i32], ptr @__const.png_read_push_finish_row.png_pass_inc, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !25
  %43 = add i32 %42, %38
  %44 = getelementptr inbounds [7 x i32], ptr @__const.png_read_push_finish_row.png_pass_start, i64 0, i64 %40
  %45 = load i32, ptr %44, align 4, !tbaa !25
  %46 = xor i32 %45, -1
  %47 = add i32 %43, %46
  %48 = udiv i32 %47, %42
  store i32 %48, ptr %19, align 8, !tbaa !26
  %49 = load i32, ptr %20, align 4, !tbaa !27
  %50 = and i32 %49, 2
  %.not31 = icmp eq i32 %50, 0
  br i1 %.not31, label %51, label %.sink.split

51:                                               ; preds = %37
  %52 = load i32, ptr %21, align 8, !tbaa !28
  %53 = getelementptr inbounds [7 x i32], ptr @__const.png_read_push_finish_row.png_pass_yinc, i64 0, i64 %40
  %54 = load i32, ptr %53, align 4, !tbaa !25
  %55 = add i32 %54, %52
  %56 = getelementptr inbounds [7 x i32], ptr @__const.png_read_push_finish_row.png_pass_ystart, i64 0, i64 %40
  %57 = load i32, ptr %56, align 4, !tbaa !25
  %58 = xor i32 %57, -1
  %59 = add i32 %55, %58
  %60 = udiv i32 %59, %54
  store i32 %60, ptr %5, align 4, !tbaa !19
  %61 = icmp ugt i32 %42, %47
  %62 = icmp ugt i32 %54, %59
  %or.cond = select i1 %61, i1 true, i1 %62
  br i1 %or.cond, label %.critedge, label %.sink.split, !llvm.loop !29

.sink.split:                                      ; preds = %37, %35, %51, %.thread32
  %.pr39.sink = phi i8 [ %.pr37, %.thread32 ], [ %39, %51 ], [ 7, %35 ], [ %39, %37 ]
  store i8 %.pr39.sink, ptr %17, align 4, !tbaa !23
  br label %63

63:                                               ; preds = %.sink.split, %8, %1
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

attributes #0 = { nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) 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 nocallback nofree nounwind willreturn memory(argmem: write) }

!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 484}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !10, i64 288, !10, i64 292, !11, i64 296, !9, i64 408, !12, i64 416, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !12, i64 464, !12, i64 472, !10, i64 480, !10, i64 484, !9, i64 488, !9, i64 496, !9, i64 504, !9, i64 512, !9, i64 520, !9, i64 528, !13, i64 536, !10, i64 560, !10, i64 564, !9, i64 568, !14, i64 576, !14, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !14, i64 598, !7, i64 600, !15, i64 604, !16, i64 608, !16, i64 618, !9, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !15, i64 652, !15, i64 656, !9, i64 664, !9, i64 672, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !17, i64 712, !17, i64 717, !9, i64 728, !16, i64 736, !9, i64 752, !9, i64 760, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !10, i64 824, !10, i64 828, !12, i64 832, !12, i64 840, !12, i64 848, !12, i64 856, !10, i64 864, !10, i64 868, !12, i64 872, !12, i64 880, !9, i64 888, !9, i64 896, !9, i64 904, !9, i64 912, !9, i64 920, !7, i64 928, !7, i64 929, !9, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !10, i64 984, !9, i64 992, !9, i64 1000, !10, i64 1008, !9, i64 1016, !7, i64 1024, !14, i64 1026, !14, i64 1028, !14, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !9, i64 1048, !9, i64 1056, !9, i64 1064, !9, i64 1072, !9, i64 1080, !9, i64 1088, !9, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !18, i64 1120, !10, i64 1152, !10, i64 1156, !9, i64 1160, !10, i64 1168}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !10, i64 8, !12, i64 16, !9, i64 24, !10, i64 32, !12, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !10, i64 88, !12, i64 96, !12, i64 104}
!12 = !{!"long", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !12, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !12, i64 16, !7, i64 24}
!19 = !{!6, !10, i64 452}
!20 = !{!6, !7, i64 587}
!21 = !{!6, !9, i64 488}
!22 = !{!6, !12, i64 464}
!23 = !{!6, !7, i64 588}
!24 = !{!6, !10, i64 444}
!25 = !{!10, !10, i64 0}
!26 = !{!6, !10, i64 480}
!27 = !{!6, !10, i64 292}
!28 = !{!6, !10, i64 448}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass