; LLVM IR from rdguez-mariano/fast_imas_IPOL :: io_png/libs/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, i8, i8, i64, i64, i64, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i64, i64, 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, i64, i64, 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, i64, i64, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, i8, i16, i16, i16, i64, i64, i8, i8, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i64, i64, %struct.png_unknown_chunk_t, i64, i64, ptr }
%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 { i64, 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 }

@png_pass_inc = external constant [7 x i32], align 16
@png_pass_start = external constant [7 x i32], align 16
@png_pass_yinc = external constant [7 x i32], align 16
@png_pass_ystart = external constant [7 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local void @png_read_push_finish_row(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.png_struct_def, ptr %3, i32 0, i32 30
  %5 = load i64, ptr %4, align 8, !tbaa !9
  %6 = add i64 %5, 1
  store i64 %6, ptr %4, align 8, !tbaa !9
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.png_struct_def, ptr %7, i32 0, i32 30
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.png_struct_def, ptr %10, i32 0, i32 25
  %12 = load i64, ptr %11, align 8, !tbaa !20
  %13 = icmp ult i64 %9, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %1
  br label %204

15:                                               ; preds = %1
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.png_struct_def, ptr %16, i32 0, i32 46
  %18 = load i8, ptr %17, align 1, !tbaa !21
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %204

20:                                               ; preds = %15
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 30
  store i64 0, ptr %22, align 8, !tbaa !9
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.png_struct_def, ptr %24, i32 0, i32 31
  %26 = load ptr, ptr %25, align 8, !tbaa !22
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.png_struct_def, ptr %27, i32 0, i32 27
  %29 = load i64, ptr %28, align 8, !tbaa !23
  %30 = add i64 %29, 1
  %31 = call ptr @png_memset_check(ptr noundef %23, ptr noundef %26, i32 noundef 0, i64 noundef %30)
  br label %32

32:                                               ; preds = %201, %20
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.png_struct_def, ptr %33, i32 0, i32 47
  %35 = load i8, ptr %34, align 4, !tbaa !24
  %36 = add i8 %35, 1
  store i8 %36, ptr %34, align 4, !tbaa !24
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.png_struct_def, ptr %37, i32 0, i32 47
  %39 = load i8, ptr %38, align 4, !tbaa !24
  %40 = zext i8 %39 to i32
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %42, label %47

42:                                               ; preds = %32
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.png_struct_def, ptr %43, i32 0, i32 23
  %45 = load i64, ptr %44, align 8, !tbaa !25
  %46 = icmp ult i64 %45, 5
  br i1 %46, label %69, label %47

47:                                               ; preds = %42, %32
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.png_struct_def, ptr %48, i32 0, i32 47
  %50 = load i8, ptr %49, align 4, !tbaa !24
  %51 = zext i8 %50 to i32
  %52 = icmp eq i32 %51, 3
  br i1 %52, label %53, label %58

53:                                               ; preds = %47
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.png_struct_def, ptr %54, i32 0, i32 23
  %56 = load i64, ptr %55, align 8, !tbaa !25
  %57 = icmp ult i64 %56, 3
  br i1 %57, label %69, label %58

58:                                               ; preds = %53, %47
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.png_struct_def, ptr %59, i32 0, i32 47
  %61 = load i8, ptr %60, align 4, !tbaa !24
  %62 = zext i8 %61 to i32
  %63 = icmp eq i32 %62, 5
  br i1 %63, label %64, label %74

64:                                               ; preds = %58
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_struct_def, ptr %65, i32 0, i32 23
  %67 = load i64, ptr %66, align 8, !tbaa !25
  %68 = icmp ult i64 %67, 2
  br i1 %68, label %69, label %74

69:                                               ; preds = %64, %53, %42
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.png_struct_def, ptr %70, i32 0, i32 47
  %72 = load i8, ptr %71, align 4, !tbaa !24
  %73 = add i8 %72, 1
  store i8 %73, ptr %71, align 4, !tbaa !24
  br label %74

74:                                               ; preds = %69, %64, %58
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.png_struct_def, ptr %75, i32 0, i32 47
  %77 = load i8, ptr %76, align 4, !tbaa !24
  %78 = zext i8 %77 to i32
  %79 = icmp sgt i32 %78, 7
  br i1 %79, label %80, label %85

80:                                               ; preds = %74
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 47
  %83 = load i8, ptr %82, align 4, !tbaa !24
  %84 = add i8 %83, -1
  store i8 %84, ptr %82, align 4, !tbaa !24
  br label %85

85:                                               ; preds = %80, %74
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.png_struct_def, ptr %86, i32 0, i32 47
  %88 = load i8, ptr %87, align 4, !tbaa !24
  %89 = zext i8 %88 to i32
  %90 = icmp sge i32 %89, 7
  br i1 %90, label %91, label %92

91:                                               ; preds = %85
  br label %203

92:                                               ; preds = %85
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_struct_def, ptr %93, i32 0, i32 23
  %95 = load i64, ptr %94, align 8, !tbaa !25
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 47
  %98 = load i8, ptr %97, align 4, !tbaa !24
  %99 = zext i8 %98 to i64
  %100 = getelementptr inbounds [7 x i32], ptr @png_pass_inc, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !26
  %102 = sext i32 %101 to i64
  %103 = add i64 %95, %102
  %104 = sub i64 %103, 1
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.png_struct_def, ptr %105, i32 0, i32 47
  %107 = load i8, ptr %106, align 4, !tbaa !24
  %108 = zext i8 %107 to i64
  %109 = getelementptr inbounds [7 x i32], ptr @png_pass_start, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !26
  %111 = sext i32 %110 to i64
  %112 = sub i64 %104, %111
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.png_struct_def, ptr %113, i32 0, i32 47
  %115 = load i8, ptr %114, align 4, !tbaa !24
  %116 = zext i8 %115 to i64
  %117 = getelementptr inbounds [7 x i32], ptr @png_pass_inc, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !26
  %119 = sext i32 %118 to i64
  %120 = udiv i64 %112, %119
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.png_struct_def, ptr %121, i32 0, i32 29
  store i64 %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 52
  %125 = load i8, ptr %124, align 1, !tbaa !28
  %126 = zext i8 %125 to i32
  %127 = icmp sge i32 %126, 8
  br i1 %127, label %128, label %138

128:                                              ; preds = %92
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.png_struct_def, ptr %129, i32 0, i32 29
  %131 = load i64, ptr %130, align 8, !tbaa !27
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_struct_def, ptr %132, i32 0, i32 52
  %134 = load i8, ptr %133, align 1, !tbaa !28
  %135 = zext i8 %134 to i64
  %136 = lshr i64 %135, 3
  %137 = mul i64 %131, %136
  br label %149

138:                                              ; preds = %92
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.png_struct_def, ptr %139, i32 0, i32 29
  %141 = load i64, ptr %140, align 8, !tbaa !27
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.png_struct_def, ptr %142, i32 0, i32 52
  %144 = load i8, ptr %143, align 1, !tbaa !28
  %145 = zext i8 %144 to i64
  %146 = mul i64 %141, %145
  %147 = add i64 %146, 7
  %148 = lshr i64 %147, 3
  br label %149

149:                                              ; preds = %138, %128
  %150 = phi i64 [ %137, %128 ], [ %148, %138 ]
  %151 = add i64 %150, 1
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.png_struct_def, ptr %152, i32 0, i32 28
  store i64 %151, ptr %153, align 8, !tbaa !29
  %154 = load ptr, ptr %2, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.png_struct_def, ptr %154, i32 0, i32 14
  %156 = load i64, ptr %155, align 8, !tbaa !30
  %157 = and i64 %156, 2
  %158 = icmp ne i64 %157, 0
  br i1 %158, label %159, label %160

159:                                              ; preds = %149
  br label %203

160:                                              ; preds = %149
  %161 = load ptr, ptr %2, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.png_struct_def, ptr %161, i32 0, i32 24
  %163 = load i64, ptr %162, align 8, !tbaa !31
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.png_struct_def, ptr %164, i32 0, i32 47
  %166 = load i8, ptr %165, align 4, !tbaa !24
  %167 = zext i8 %166 to i64
  %168 = getelementptr inbounds [7 x i32], ptr @png_pass_yinc, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !26
  %170 = sext i32 %169 to i64
  %171 = add i64 %163, %170
  %172 = sub i64 %171, 1
  %173 = load ptr, ptr %2, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.png_struct_def, ptr %173, i32 0, i32 47
  %175 = load i8, ptr %174, align 4, !tbaa !24
  %176 = zext i8 %175 to i64
  %177 = getelementptr inbounds [7 x i32], ptr @png_pass_ystart, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !26
  %179 = sext i32 %178 to i64
  %180 = sub i64 %172, %179
  %181 = load ptr, ptr %2, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.png_struct_def, ptr %181, i32 0, i32 47
  %183 = load i8, ptr %182, align 4, !tbaa !24
  %184 = zext i8 %183 to i64
  %185 = getelementptr inbounds [7 x i32], ptr @png_pass_yinc, i64 0, i64 %184
  %186 = load i32, ptr %185, align 4, !tbaa !26
  %187 = sext i32 %186 to i64
  %188 = udiv i64 %180, %187
  %189 = load ptr, ptr %2, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.png_struct_def, ptr %189, i32 0, i32 25
  store i64 %188, ptr %190, align 8, !tbaa !20
  br label %191

191:                                              ; preds = %160
  %192 = load ptr, ptr %2, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.png_struct_def, ptr %192, i32 0, i32 29
  %194 = load i64, ptr %193, align 8, !tbaa !27
  %195 = icmp eq i64 %194, 0
  br i1 %195, label %201, label %196

196:                                              ; preds = %191
  %197 = load ptr, ptr %2, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.png_struct_def, ptr %197, i32 0, i32 25
  %199 = load i64, ptr %198, align 8, !tbaa !20
  %200 = icmp eq i64 %199, 0
  br label %201

201:                                              ; preds = %196, %191
  %202 = phi i1 [ true, %191 ], [ %200, %196 ]
  br i1 %202, label %32, label %203, !llvm.loop !32

203:                                              ; preds = %201, %159, %91
  br label %204

204:                                              ; preds = %203, %15, %14
  ret void
}

declare ptr @png_memset_check(ptr noundef, ptr noundef, i32 noundef, i64 noundef) #1

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 = { "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" }

!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 512}
!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, !7, i64 272, !7, i64 273, !11, i64 280, !11, i64 288, !11, i64 296, !12, i64 304, !6, i64 416, !11, i64 424, !13, i64 432, !13, i64 436, !13, i64 440, !13, i64 444, !13, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !11, i64 496, !11, i64 504, !11, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !14, i64 568, !11, i64 592, !11, i64 600, !6, i64 608, !15, i64 616, !15, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !15, i64 638, !7, i64 640, !16, i64 644, !17, i64 648, !17, i64 658, !6, i64 672, !11, i64 680, !11, i64 688, !13, i64 696, !16, i64 700, !16, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !18, i64 760, !18, i64 765, !6, i64 776, !17, i64 784, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !11, i64 872, !11, i64 880, !11, i64 888, !11, i64 896, !11, i64 904, !11, i64 912, !13, i64 920, !13, i64 924, !11, i64 928, !11, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !7, i64 984, !7, i64 985, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !11, i64 1040, !6, i64 1048, !6, i64 1056, !13, i64 1064, !6, i64 1072, !7, i64 1080, !15, i64 1082, !15, i64 1084, !15, i64 1086, !11, i64 1088, !11, i64 1096, !7, i64 1104, !7, i64 1105, !11, i64 1112, !11, i64 1120, !6, i64 1128, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !6, i64 1168, !6, i64 1176, !7, i64 1184, !11, i64 1192, !11, i64 1200, !19, i64 1208, !11, i64 1240, !11, i64 1248, !6, i64 1256}
!11 = !{!"long", !7, i64 0}
!12 = !{!"z_stream_s", !6, i64 0, !13, i64 8, !11, i64 16, !6, i64 24, !13, i64 32, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88, !11, i64 96, !11, i64 104}
!13 = !{!"int", !7, i64 0}
!14 = !{!"png_row_info_struct", !11, i64 0, !11, 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, !11, i64 16, !7, i64 24}
!20 = !{!10, !11, i64 472}
!21 = !{!10, !7, i64 627}
!22 = !{!10, !6, i64 520}
!23 = !{!10, !11, i64 488}
!24 = !{!10, !7, i64 628}
!25 = !{!10, !11, i64 456}
!26 = !{!13, !13, i64 0}
!27 = !{!10, !11, i64 504}
!28 = !{!10, !7, i64 633}
!29 = !{!10, !11, i64 496}
!30 = !{!10, !11, i64 296}
!31 = !{!10, !11, i64 464}
!32 = distinct !{!32, !33}
!33 = !{!"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"

@png_pass_inc = external local_unnamed_addr constant [7 x i32], align 16
@png_pass_start = external local_unnamed_addr constant [7 x i32], align 16
@png_pass_yinc = external local_unnamed_addr constant [7 x i32], align 16
@png_pass_ystart = external local_unnamed_addr constant [7 x i32], align 16

; Function Attrs: nounwind uwtable
define dso_local void @png_read_push_finish_row(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 512
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = add i64 %3, 1
  store i64 %4, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 472
  %6 = load i64, ptr %5, align 8, !tbaa !19
  %7 = icmp ult i64 %4, %6
  br i1 %7, label %84, label %8

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

11:                                               ; preds = %8
  store i64 0, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 520
  %13 = load ptr, ptr %12, align 8, !tbaa !21
  %14 = getelementptr inbounds i8, ptr %0, i64 488
  %15 = load i64, ptr %14, align 8, !tbaa !22
  %16 = add i64 %15, 1
  %17 = tail call ptr @png_memset_check(ptr noundef nonnull %0, ptr noundef %13, i32 noundef 0, i64 noundef %16) #2
  %18 = getelementptr inbounds i8, ptr %0, i64 628
  %.promoted = load i8, ptr %18, align 4, !tbaa !23
  %19 = getelementptr inbounds i8, ptr %0, i64 456
  %20 = getelementptr inbounds i8, ptr %0, i64 504
  %21 = getelementptr inbounds i8, ptr %0, i64 633
  %22 = getelementptr inbounds i8, ptr %0, i64 496
  %23 = getelementptr inbounds i8, ptr %0, i64 296
  %24 = getelementptr inbounds i8, ptr %0, i64 464
  br label %.critedge

.critedge:                                        ; preds = %70, %11
  %.pr44 = phi i8 [ %42, %70 ], [ %.promoted, %11 ]
  %25 = add i8 %.pr44, 1
  switch i8 %.pr44, label %.thread39 [
    i8 0, label %26
    i8 2, label %29
    i8 4, label %32
  ]

26:                                               ; preds = %.critedge
  %27 = load i64, ptr %19, align 8, !tbaa !24
  %28 = icmp ult i64 %27, 5
  br i1 %28, label %.thread42, label %._crit_edge

29:                                               ; preds = %.critedge
  %30 = load i64, ptr %19, align 8, !tbaa !24
  %31 = icmp ult i64 %30, 3
  br i1 %31, label %.thread42, label %._crit_edge

32:                                               ; preds = %.critedge
  %33 = load i64, ptr %19, align 8, !tbaa !24
  %34 = icmp ult i64 %33, 2
  br i1 %34, label %.thread42, label %._crit_edge

.thread42:                                        ; preds = %32, %29, %26
  %35 = phi i64 [ %33, %32 ], [ %30, %29 ], [ %27, %26 ]
  %36 = add nuw nsw i8 %.pr44, 2
  br label %40

.thread39:                                        ; preds = %.critedge
  %37 = icmp ugt i8 %25, 7
  br i1 %37, label %.sink.split, label %38

38:                                               ; preds = %.thread39
  %39 = icmp eq i8 %25, 7
  br i1 %39, label %.sink.split, label %._crit_edge

._crit_edge:                                      ; preds = %26, %29, %32, %38
  %.pre = load i64, ptr %19, align 8, !tbaa !24
  br label %40

40:                                               ; preds = %._crit_edge, %.thread42
  %41 = phi i64 [ %35, %.thread42 ], [ %.pre, %._crit_edge ]
  %42 = phi i8 [ %36, %.thread42 ], [ %25, %._crit_edge ]
  %43 = zext nneg i8 %42 to i64
  %44 = getelementptr inbounds [7 x i32], ptr @png_pass_inc, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !25
  %46 = sext i32 %45 to i64
  %47 = add i64 %41, %46
  %48 = getelementptr inbounds [7 x i32], ptr @png_pass_start, i64 0, i64 %43
  %49 = load i32, ptr %48, align 4, !tbaa !25
  %50 = xor i32 %49, -1
  %51 = sext i32 %50 to i64
  %52 = add i64 %47, %51
  %53 = udiv i64 %52, %46
  store i64 %53, ptr %20, align 8, !tbaa !26
  %54 = load i8, ptr %21, align 1, !tbaa !27
  %55 = icmp ugt i8 %54, 7
  br i1 %55, label %56, label %60

56:                                               ; preds = %40
  %57 = lshr i8 %54, 3
  %58 = zext nneg i8 %57 to i64
  %59 = mul i64 %53, %58
  br label %65

60:                                               ; preds = %40
  %61 = zext nneg i8 %54 to i64
  %62 = mul i64 %53, %61
  %63 = add i64 %62, 7
  %64 = lshr i64 %63, 3
  br label %65

65:                                               ; preds = %60, %56
  %66 = phi i64 [ %59, %56 ], [ %64, %60 ]
  %67 = add i64 %66, 1
  store i64 %67, ptr %22, align 8, !tbaa !28
  %68 = load i64, ptr %23, align 8, !tbaa !29
  %69 = and i64 %68, 2
  %.not38 = icmp eq i64 %69, 0
  br i1 %.not38, label %70, label %.sink.split

70:                                               ; preds = %65
  %71 = load i64, ptr %24, align 8, !tbaa !30
  %72 = getelementptr inbounds [7 x i32], ptr @png_pass_yinc, i64 0, i64 %43
  %73 = load i32, ptr %72, align 4, !tbaa !25
  %74 = sext i32 %73 to i64
  %75 = add i64 %71, %74
  %76 = getelementptr inbounds [7 x i32], ptr @png_pass_ystart, i64 0, i64 %43
  %77 = load i32, ptr %76, align 4, !tbaa !25
  %78 = xor i32 %77, -1
  %79 = sext i32 %78 to i64
  %80 = add i64 %75, %79
  %81 = udiv i64 %80, %74
  store i64 %81, ptr %5, align 8, !tbaa !19
  %82 = icmp ult i64 %52, %46
  %83 = icmp ult i64 %80, %74
  %or.cond = select i1 %82, i1 true, i1 %83
  br i1 %or.cond, label %.critedge, label %.sink.split, !llvm.loop !31

.sink.split:                                      ; preds = %70, %38, %65, %.thread39
  %.pr46.sink = phi i8 [ %.pr44, %.thread39 ], [ %42, %65 ], [ 7, %38 ], [ %42, %70 ]
  store i8 %.pr46.sink, ptr %18, align 4, !tbaa !23
  br label %84

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

declare ptr @png_memset_check(ptr noundef, ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #1

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 = { "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 }

!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 512}
!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, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !11, i64 304, !9, i64 416, !10, i64 424, !12, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !9, i64 520, !9, i64 528, !9, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !13, i64 568, !10, i64 592, !10, i64 600, !9, i64 608, !14, i64 616, !14, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !14, i64 638, !7, i64 640, !15, i64 644, !16, i64 648, !16, i64 658, !9, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !15, i64 700, !15, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !9, i64 744, !9, i64 752, !17, i64 760, !17, i64 765, !9, i64 776, !16, i64 784, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !9, i64 856, !9, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !12, i64 920, !12, i64 924, !10, i64 928, !10, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !7, i64 984, !7, i64 985, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !10, i64 1040, !9, i64 1048, !9, i64 1056, !12, i64 1064, !9, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !9, i64 1160, !9, i64 1168, !9, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !18, i64 1208, !10, i64 1240, !10, i64 1248, !9, i64 1256}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !10, i64 16, !9, i64 24, !12, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !10, 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, !10, i64 16, !7, i64 24}
!19 = !{!6, !10, i64 472}
!20 = !{!6, !7, i64 627}
!21 = !{!6, !9, i64 520}
!22 = !{!6, !10, i64 488}
!23 = !{!6, !7, i64 628}
!24 = !{!6, !10, i64 456}
!25 = !{!12, !12, i64 0}
!26 = !{!6, !10, i64 504}
!27 = !{!6, !7, i64 633}
!28 = !{!6, !10, i64 496}
!29 = !{!6, !10, i64 296}
!30 = !{!6, !10, i64 464}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


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