; LLVM IR from mkazhdan/DMG :: Util/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 }
%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: 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: nounwind uwtable
define dso_local void @png_read_push_finish_row(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.png_struct_def, ptr %5, i32 0, i32 30
  %7 = load i64, ptr %6, align 8, !tbaa !9
  %8 = add i64 %7, 1
  store i64 %8, ptr %6, align 8, !tbaa !9
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.png_struct_def, ptr %9, i32 0, i32 30
  %11 = load i64, ptr %10, align 8, !tbaa !9
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.png_struct_def, ptr %12, i32 0, i32 25
  %14 = load i64, ptr %13, align 8, !tbaa !20
  %15 = icmp ult i64 %11, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %1
  br label %185

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

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

34:                                               ; preds = %182, %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.png_struct_def, ptr %35, i32 0, i32 47
  %37 = load i8, ptr %36, align 4, !tbaa !24
  %38 = zext i8 %37 to i32
  store i32 %38, ptr %3, align 4, !tbaa !25
  %39 = load i32, ptr %3, align 4, !tbaa !25
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %3, align 4, !tbaa !25
  %41 = load i32, ptr %3, align 4, !tbaa !25
  %42 = icmp eq i32 %41, 1
  br i1 %42, label %43, label %48

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

48:                                               ; preds = %43, %34
  %49 = load i32, ptr %3, align 4, !tbaa !25
  %50 = icmp eq i32 %49, 3
  br i1 %50, label %51, label %56

51:                                               ; preds = %48
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.png_struct_def, ptr %52, i32 0, i32 23
  %54 = load i64, ptr %53, align 8, !tbaa !26
  %55 = icmp ult i64 %54, 3
  br i1 %55, label %64, label %56

56:                                               ; preds = %51, %48
  %57 = load i32, ptr %3, align 4, !tbaa !25
  %58 = icmp eq i32 %57, 5
  br i1 %58, label %59, label %67

59:                                               ; preds = %56
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.png_struct_def, ptr %60, i32 0, i32 23
  %62 = load i64, ptr %61, align 8, !tbaa !26
  %63 = icmp ult i64 %62, 2
  br i1 %63, label %64, label %67

64:                                               ; preds = %59, %51, %43
  %65 = load i32, ptr %3, align 4, !tbaa !25
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !25
  br label %67

67:                                               ; preds = %64, %59, %56
  %68 = load i32, ptr %3, align 4, !tbaa !25
  %69 = icmp sgt i32 %68, 7
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  %71 = load i32, ptr %3, align 4, !tbaa !25
  %72 = add nsw i32 %71, -1
  store i32 %72, ptr %3, align 4, !tbaa !25
  br label %73

73:                                               ; preds = %70, %67
  %74 = load i32, ptr %3, align 4, !tbaa !25
  %75 = trunc i32 %74 to i8
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.png_struct_def, ptr %76, i32 0, i32 47
  store i8 %75, ptr %77, align 4, !tbaa !24
  %78 = load i32, ptr %3, align 4, !tbaa !25
  %79 = icmp slt i32 %78, 7
  br i1 %79, label %80, label %167

80:                                               ; preds = %73
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 23
  %83 = load i64, ptr %82, align 8, !tbaa !26
  %84 = load i32, ptr %3, align 4, !tbaa !25
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [7 x i32], ptr @png_pass_inc, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !25
  %88 = sext i32 %87 to i64
  %89 = add i64 %83, %88
  %90 = sub i64 %89, 1
  %91 = load i32, ptr %3, align 4, !tbaa !25
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [7 x i32], ptr @png_pass_start, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !25
  %95 = sext i32 %94 to i64
  %96 = sub i64 %90, %95
  %97 = load i32, ptr %3, align 4, !tbaa !25
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [7 x i32], ptr @png_pass_inc, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !25
  %101 = sext i32 %100 to i64
  %102 = udiv i64 %96, %101
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.png_struct_def, ptr %103, i32 0, i32 29
  store i64 %102, ptr %104, align 8, !tbaa !27
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.png_struct_def, ptr %105, i32 0, i32 52
  %107 = load i8, ptr %106, align 1, !tbaa !28
  %108 = zext i8 %107 to i32
  %109 = icmp sge i32 %108, 8
  br i1 %109, label %110, label %120

110:                                              ; preds = %80
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.png_struct_def, ptr %111, i32 0, i32 29
  %113 = load i64, ptr %112, align 8, !tbaa !27
  %114 = load ptr, ptr %2, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_struct_def, ptr %114, i32 0, i32 52
  %116 = load i8, ptr %115, align 1, !tbaa !28
  %117 = zext i8 %116 to i64
  %118 = lshr i64 %117, 3
  %119 = mul i64 %113, %118
  br label %131

120:                                              ; preds = %80
  %121 = load ptr, ptr %2, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.png_struct_def, ptr %121, i32 0, i32 29
  %123 = load i64, ptr %122, align 8, !tbaa !27
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_struct_def, ptr %124, i32 0, i32 52
  %126 = load i8, ptr %125, align 1, !tbaa !28
  %127 = zext i8 %126 to i64
  %128 = mul i64 %123, %127
  %129 = add i64 %128, 7
  %130 = lshr i64 %129, 3
  br label %131

131:                                              ; preds = %120, %110
  %132 = phi i64 [ %119, %110 ], [ %130, %120 ]
  %133 = add i64 %132, 1
  %134 = load ptr, ptr %2, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.png_struct_def, ptr %134, i32 0, i32 28
  store i64 %133, ptr %135, align 8, !tbaa !29
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.png_struct_def, ptr %136, i32 0, i32 14
  %138 = load i64, ptr %137, align 8, !tbaa !30
  %139 = and i64 %138, 2
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %141, label %142

141:                                              ; preds = %131
  store i32 2, ptr %4, align 4
  br label %169

142:                                              ; preds = %131
  %143 = load ptr, ptr %2, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.png_struct_def, ptr %143, i32 0, i32 24
  %145 = load i64, ptr %144, align 8, !tbaa !31
  %146 = load i32, ptr %3, align 4, !tbaa !25
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [7 x i32], ptr @png_pass_yinc, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !25
  %150 = sext i32 %149 to i64
  %151 = add i64 %145, %150
  %152 = sub i64 %151, 1
  %153 = load i32, ptr %3, align 4, !tbaa !25
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [7 x i32], ptr @png_pass_ystart, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !25
  %157 = sext i32 %156 to i64
  %158 = sub i64 %152, %157
  %159 = load i32, ptr %3, align 4, !tbaa !25
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [7 x i32], ptr @png_pass_yinc, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !25
  %163 = sext i32 %162 to i64
  %164 = udiv i64 %158, %163
  %165 = load ptr, ptr %2, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_struct_def, ptr %165, i32 0, i32 25
  store i64 %164, ptr %166, align 8, !tbaa !20
  br label %168

167:                                              ; preds = %73
  store i32 2, ptr %4, align 4
  br label %169

168:                                              ; preds = %142
  store i32 0, ptr %4, align 4
  br label %169

169:                                              ; preds = %168, %167, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  %170 = load i32, ptr %4, align 4
  switch i32 %170, label %186 [
    i32 0, label %171
    i32 2, label %184
  ]

171:                                              ; preds = %169
  br label %172

172:                                              ; preds = %171
  %173 = load ptr, ptr %2, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.png_struct_def, ptr %173, i32 0, i32 29
  %175 = load i64, ptr %174, align 8, !tbaa !27
  %176 = icmp eq i64 %175, 0
  br i1 %176, label %182, label %177

177:                                              ; preds = %172
  %178 = load ptr, ptr %2, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.png_struct_def, ptr %178, i32 0, i32 25
  %180 = load i64, ptr %179, align 8, !tbaa !20
  %181 = icmp eq i64 %180, 0
  br label %182

182:                                              ; preds = %177, %172
  %183 = phi i1 [ true, %172 ], [ %181, %177 ]
  br i1 %183, label %34, label %184, !llvm.loop !32

184:                                              ; preds = %182, %169
  br label %185

185:                                              ; preds = %184, %17, %16
  ret void

186:                                              ; preds = %169
  unreachable
}

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

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

!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}
!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 = !{!13, !13, i64 0}
!26 = !{!10, !11, i64 456}
!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 %.thread49, 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 %.thread49, 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 = %73, %11
  %25 = phi i8 [ %.promoted, %11 ], [ %44, %73 ]
  %26 = zext i8 %25 to i32
  %27 = add nuw nsw i32 %26, 1
  switch i8 %25, label %37 [
    i8 0, label %28
    i8 2, label %.critedge._crit_edge52
    i8 4, label %.critedge._crit_edge
  ]

28:                                               ; preds = %.critedge
  %29 = load i64, ptr %19, align 8, !tbaa !24
  %30 = icmp ult i64 %29, 5
  br i1 %30, label %33, label %37

.critedge._crit_edge52:                           ; preds = %.critedge
  %.pre53 = load i64, ptr %19, align 8, !tbaa !24
  %31 = icmp ult i64 %.pre53, 3
  br i1 %31, label %33, label %.thread47

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

33:                                               ; preds = %.critedge._crit_edge, %.critedge._crit_edge52, %28
  %34 = add nuw nsw i32 %26, 2
  br label %37

.thread47:                                        ; preds = %.critedge._crit_edge52, %.critedge._crit_edge
  %35 = phi i64 [ %.pre53, %.critedge._crit_edge52 ], [ %.pre, %.critedge._crit_edge ]
  %.041.ph = phi i32 [ 3, %.critedge._crit_edge52 ], [ 5, %.critedge._crit_edge ]
  %36 = trunc nuw nsw i32 %.041.ph to i8
  store i8 %36, ptr %18, align 4, !tbaa !23
  br label %42

37:                                               ; preds = %28, %.critedge, %33
  %.041 = phi i32 [ %34, %33 ], [ %27, %.critedge ], [ %27, %28 ]
  %.041.fr = freeze i32 %.041
  %38 = icmp ugt i32 %.041.fr, 7
  %39 = sext i1 %38 to i32
  %spec.select = add nsw i32 %.041.fr, %39
  %40 = trunc i32 %spec.select to i8
  store i8 %40, ptr %18, align 4, !tbaa !23
  %41 = icmp ult i32 %spec.select, 7
  br i1 %41, label %._crit_edge, label %.thread49

._crit_edge:                                      ; preds = %37
  %.pre54 = load i64, ptr %19, align 8, !tbaa !24
  br label %42

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

59:                                               ; preds = %42
  %60 = lshr i8 %57, 3
  %61 = zext nneg i8 %60 to i64
  %62 = mul i64 %56, %61
  br label %68

63:                                               ; preds = %42
  %64 = zext nneg i8 %57 to i64
  %65 = mul i64 %56, %64
  %66 = add i64 %65, 7
  %67 = lshr i64 %66, 3
  br label %68

68:                                               ; preds = %63, %59
  %69 = phi i64 [ %62, %59 ], [ %67, %63 ]
  %70 = add i64 %69, 1
  store i64 %70, ptr %22, align 8, !tbaa !28
  %71 = load i64, ptr %23, align 8, !tbaa !29
  %72 = and i64 %71, 2
  %.not44 = icmp eq i64 %72, 0
  br i1 %.not44, label %73, label %.thread49

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

.thread49:                                        ; preds = %37, %68, %73, %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}
!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,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass