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

; 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_write_sBIT.png_sBIT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [29 x i8], align 1

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

; Function Attrs: nocallback nofree 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #2

declare void @png_warning(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @png_write_sBIT(ptr noundef %0, ptr noundef %1, i32 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [5 x i8], align 1
  %8 = alloca [4 x i8], align 1
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 5, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %7, ptr align 1 @__const.png_write_sBIT.png_sBIT, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = and i32 %12, 2
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %86

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = icmp eq i32 %16, 3
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  br label %24

19:                                               ; preds = %15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.png_struct_def, ptr %20, i32 0, i32 52
  %22 = load i8, ptr %21, align 8, !tbaa !11
  %23 = zext i8 %22 to i32
  br label %24

24:                                               ; preds = %19, %18
  %25 = phi i32 [ 8, %18 ], [ %23, %19 ]
  %26 = trunc i32 %25 to i8
  store i8 %26, ptr %10, align 1, !tbaa !21
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.png_color_8_struct, ptr %27, i32 0, i32 0
  %29 = load i8, ptr %28, align 1, !tbaa !22
  %30 = zext i8 %29 to i32
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %68, label %32

32:                                               ; preds = %24
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.png_color_8_struct, ptr %33, i32 0, i32 0
  %35 = load i8, ptr %34, align 1, !tbaa !22
  %36 = zext i8 %35 to i32
  %37 = load i8, ptr %10, align 1, !tbaa !21
  %38 = zext i8 %37 to i32
  %39 = icmp sgt i32 %36, %38
  br i1 %39, label %68, label %40

40:                                               ; preds = %32
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_color_8_struct, ptr %41, i32 0, i32 1
  %43 = load i8, ptr %42, align 1, !tbaa !23
  %44 = zext i8 %43 to i32
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %68, label %46

46:                                               ; preds = %40
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_color_8_struct, ptr %47, i32 0, i32 1
  %49 = load i8, ptr %48, align 1, !tbaa !23
  %50 = zext i8 %49 to i32
  %51 = load i8, ptr %10, align 1, !tbaa !21
  %52 = zext i8 %51 to i32
  %53 = icmp sgt i32 %50, %52
  br i1 %53, label %68, label %54

54:                                               ; preds = %46
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_color_8_struct, ptr %55, i32 0, i32 2
  %57 = load i8, ptr %56, align 1, !tbaa !24
  %58 = zext i8 %57 to i32
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %68, label %60

60:                                               ; preds = %54
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_color_8_struct, ptr %61, i32 0, i32 2
  %63 = load i8, ptr %62, align 1, !tbaa !24
  %64 = zext i8 %63 to i32
  %65 = load i8, ptr %10, align 1, !tbaa !21
  %66 = zext i8 %65 to i32
  %67 = icmp sgt i32 %64, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %60, %54, %46, %40, %32, %24
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %69, ptr noundef @.str.22)
  store i32 1, ptr %11, align 4
  br label %83

70:                                               ; preds = %60
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.png_color_8_struct, ptr %71, i32 0, i32 0
  %73 = load i8, ptr %72, align 1, !tbaa !22
  %74 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 0
  store i8 %73, ptr %74, align 1, !tbaa !21
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.png_color_8_struct, ptr %75, i32 0, i32 1
  %77 = load i8, ptr %76, align 1, !tbaa !23
  %78 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 1
  store i8 %77, ptr %78, align 1, !tbaa !21
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.png_color_8_struct, ptr %79, i32 0, i32 2
  %81 = load i8, ptr %80, align 1, !tbaa !24
  %82 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 2
  store i8 %81, ptr %82, align 1, !tbaa !21
  store i64 3, ptr %9, align 8, !tbaa !25
  store i32 0, ptr %11, align 4
  br label %83

83:                                               ; preds = %70, %68
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  %84 = load i32, ptr %11, align 4
  switch i32 %84, label %143 [
    i32 0, label %85
  ]

85:                                               ; preds = %83
  br label %109

86:                                               ; preds = %3
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.png_color_8_struct, ptr %87, i32 0, i32 3
  %89 = load i8, ptr %88, align 1, !tbaa !26
  %90 = zext i8 %89 to i32
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %102, label %92

92:                                               ; preds = %86
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_color_8_struct, ptr %93, i32 0, i32 3
  %95 = load i8, ptr %94, align 1, !tbaa !26
  %96 = zext i8 %95 to i32
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.png_struct_def, ptr %97, i32 0, i32 52
  %99 = load i8, ptr %98, align 8, !tbaa !11
  %100 = zext i8 %99 to i32
  %101 = icmp sgt i32 %96, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %92, %86
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %103, ptr noundef @.str.22)
  store i32 1, ptr %11, align 4
  br label %143

104:                                              ; preds = %92
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.png_color_8_struct, ptr %105, i32 0, i32 3
  %107 = load i8, ptr %106, align 1, !tbaa !26
  %108 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 0
  store i8 %107, ptr %108, align 1, !tbaa !21
  store i64 1, ptr %9, align 8, !tbaa !25
  br label %109

109:                                              ; preds = %104, %85
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = and i32 %110, 4
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %138

113:                                              ; preds = %109
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_color_8_struct, ptr %114, i32 0, i32 4
  %116 = load i8, ptr %115, align 1, !tbaa !27
  %117 = zext i8 %116 to i32
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %129, label %119

119:                                              ; preds = %113
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_color_8_struct, ptr %120, i32 0, i32 4
  %122 = load i8, ptr %121, align 1, !tbaa !27
  %123 = zext i8 %122 to i32
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_struct_def, ptr %124, i32 0, i32 52
  %126 = load i8, ptr %125, align 8, !tbaa !11
  %127 = zext i8 %126 to i32
  %128 = icmp sgt i32 %123, %127
  br i1 %128, label %129, label %131

129:                                              ; preds = %119, %113
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %130, ptr noundef @.str.22)
  store i32 1, ptr %11, align 4
  br label %143

131:                                              ; preds = %119
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_color_8_struct, ptr %132, i32 0, i32 4
  %134 = load i8, ptr %133, align 1, !tbaa !27
  %135 = load i64, ptr %9, align 8, !tbaa !25
  %136 = add i64 %135, 1
  store i64 %136, ptr %9, align 8, !tbaa !25
  %137 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 %135
  store i8 %134, ptr %137, align 1, !tbaa !21
  br label %138

138:                                              ; preds = %131, %109
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds [5 x i8], ptr %7, i64 0, i64 0
  %141 = getelementptr inbounds [4 x i8], ptr %8, i64 0, i64 0
  %142 = load i64, ptr %9, align 8, !tbaa !25
  call void @png_write_chunk(ptr noundef %139, ptr noundef %140, ptr noundef %141, i64 noundef %142)
  store i32 0, ptr %11, align 4
  br label %143

143:                                              ; preds = %138, %129, %102, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr %7) #4
  %144 = load i32, ptr %11, align 4
  switch i32 %144, label %146 [
    i32 0, label %145
    i32 1, label %145
  ]

145:                                              ; preds = %143, %143
  ret void

146:                                              ; preds = %143
  unreachable
}

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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, !7, i64 592}
!12 = !{!"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, !10, i64 284, !10, i64 288, !10, i64 292, !13, i64 296, !6, i64 408, !14, 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, !14, i64 464, !14, i64 472, !10, i64 480, !10, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !15, i64 536, !10, i64 560, !10, i64 564, !6, i64 568, !16, i64 576, !16, 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, !16, i64 598, !7, i64 600, !17, i64 604, !18, i64 608, !18, i64 618, !6, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !17, i64 652, !17, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !19, i64 712, !19, i64 717, !6, i64 728, !18, 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, !10, i64 824, !10, i64 828, !14, i64 832, !14, i64 840, !14, i64 848, !14, i64 856, !10, i64 864, !10, i64 868, !14, i64 872, !14, 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, !10, i64 984, !6, i64 992, !6, i64 1000, !10, i64 1008, !6, i64 1016, !7, i64 1024, !16, i64 1026, !16, i64 1028, !16, i64 1030, !10, i64 1032, !10, 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, !10, i64 1108, !10, i64 1112, !10, i64 1116, !20, i64 1120, !10, i64 1152, !10, i64 1156, !6, i64 1160, !10, i64 1168}
!13 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !14, i64 16, !6, i64 24, !10, i64 32, !14, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !14, i64 96, !14, i64 104}
!14 = !{!"long", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !14, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"png_color_16_struct", !7, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !14, i64 16, !7, i64 24}
!21 = !{!7, !7, i64 0}
!22 = !{!19, !7, i64 0}
!23 = !{!19, !7, i64 1}
!24 = !{!19, !7, i64 2}
!25 = !{!14, !14, i64 0}
!26 = !{!19, !7, i64 3}
!27 = !{!19, !7, i64 4}


; 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_write_sBIT.png_sBIT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [29 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @png_write_sBIT(ptr noundef %0, ptr nocapture noundef readonly %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca [5 x i8], align 1
  %5 = alloca [4 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %4, ptr noundef nonnull align 1 dereferenceable(5) @__const.png_write_sBIT.png_sBIT, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %6 = and i32 %2, 2
  %.not = icmp eq i32 %6, 0
  %.1.sroa.gep = getelementptr inbounds i8, ptr %5, i64 3
  %.1.sroa.gep43 = getelementptr inbounds i8, ptr %5, i64 1
  br i1 %.not, label %33, label %7

7:                                                ; preds = %3
  %8 = icmp eq i32 %2, 3
  br i1 %8, label %13, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 592
  %11 = load i8, ptr %10, align 8, !tbaa !5
  %12 = zext i8 %11 to i32
  br label %13

13:                                               ; preds = %7, %9
  %14 = phi i32 [ %12, %9 ], [ 8, %7 ]
  %15 = load i8, ptr %1, align 1, !tbaa !19
  %16 = icmp eq i8 %15, 0
  %17 = zext i8 %15 to i32
  %18 = icmp ult i32 %14, %17
  %or.cond = select i1 %16, i1 true, i1 %18
  br i1 %or.cond, label %.critedge, label %19

19:                                               ; preds = %13
  %20 = getelementptr inbounds i8, ptr %1, i64 1
  %21 = load i8, ptr %20, align 1, !tbaa !20
  %22 = icmp eq i8 %21, 0
  %23 = zext i8 %21 to i32
  %24 = icmp ult i32 %14, %23
  %or.cond40 = select i1 %22, i1 true, i1 %24
  br i1 %or.cond40, label %.critedge, label %25

25:                                               ; preds = %19
  %26 = getelementptr inbounds i8, ptr %1, i64 2
  %27 = load i8, ptr %26, align 1, !tbaa !21
  %28 = icmp eq i8 %27, 0
  %29 = zext i8 %27 to i32
  %30 = icmp ult i32 %14, %29
  %or.cond42 = select i1 %28, i1 true, i1 %30
  br i1 %or.cond42, label %.critedge, label %31

.critedge:                                        ; preds = %25, %19, %13
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.22) #4
  br label %57

31:                                               ; preds = %25
  store i8 %15, ptr %5, align 1, !tbaa !22
  store i8 %21, ptr %.1.sroa.gep43, align 1, !tbaa !22
  %32 = getelementptr inbounds i8, ptr %5, i64 2
  store i8 %27, ptr %32, align 1, !tbaa !22
  br label %43

33:                                               ; preds = %3
  %34 = getelementptr inbounds i8, ptr %1, i64 3
  %35 = load i8, ptr %34, align 1, !tbaa !23
  %36 = icmp eq i8 %35, 0
  br i1 %36, label %41, label %37

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %0, i64 592
  %39 = load i8, ptr %38, align 8, !tbaa !5
  %40 = icmp ugt i8 %35, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %37, %33
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.22) #4
  br label %57

42:                                               ; preds = %37
  store i8 %35, ptr %5, align 1, !tbaa !22
  br label %43

43:                                               ; preds = %31, %42
  %.1.sroa.phi = phi ptr [ %.1.sroa.gep, %31 ], [ %.1.sroa.gep43, %42 ]
  %.1 = phi i64 [ 3, %31 ], [ 1, %42 ]
  %44 = and i32 %2, 4
  %.not37 = icmp eq i32 %44, 0
  br i1 %.not37, label %56, label %45

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %1, i64 4
  %47 = load i8, ptr %46, align 1, !tbaa !24
  %48 = icmp eq i8 %47, 0
  br i1 %48, label %53, label %49

49:                                               ; preds = %45
  %50 = getelementptr inbounds i8, ptr %0, i64 592
  %51 = load i8, ptr %50, align 8, !tbaa !5
  %52 = icmp ugt i8 %47, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %49, %45
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.22) #4
  br label %57

54:                                               ; preds = %49
  %55 = add nuw nsw i64 %.1, 1
  store i8 %47, ptr %.1.sroa.phi, align 1, !tbaa !22
  br label %56

56:                                               ; preds = %54, %43
  %.2 = phi i64 [ %55, %54 ], [ %.1, %43 ]
  call void @png_write_chunk(ptr noundef %0, ptr noundef nonnull %4, ptr noundef nonnull %5, i64 noundef %.2)
  br label %57

57:                                               ; preds = %.critedge, %56, %53, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %4) #4
  ret void
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass