; 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_IDAT.png_IDAT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [49 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_error(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @png_write_IDAT(ptr noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca [5 x i8], align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !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_IDAT.png_IDAT, i64 5, i1 false)
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.png_struct_def, ptr %12, i32 0, i32 13
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = and i32 %14, 4
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %134, label %17

17:                                               ; preds = %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 129
  %20 = load i8, ptr %19, align 8, !tbaa !21
  %21 = zext i8 %20 to i32
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %134

23:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 0
  %26 = load i8, ptr %25, align 1, !tbaa !22
  %27 = zext i8 %26 to i32
  store i32 %27, ptr %8, align 4, !tbaa !23
  %28 = load i32, ptr %8, align 4, !tbaa !23
  %29 = and i32 %28, 15
  %30 = icmp eq i32 %29, 8
  br i1 %30, label %31, label %131

31:                                               ; preds = %23
  %32 = load i32, ptr %8, align 4, !tbaa !23
  %33 = and i32 %32, 240
  %34 = icmp ule i32 %33, 112
  br i1 %34, label %35, label %131

35:                                               ; preds = %31
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = icmp uge i64 %36, 2
  br i1 %37, label %38, label %130

38:                                               ; preds = %35
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.png_struct_def, ptr %39, i32 0, i32 25
  %41 = load i32, ptr %40, align 8, !tbaa !24
  %42 = icmp ult i32 %41, 16384
  br i1 %42, label %43, label %130

43:                                               ; preds = %38
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_struct_def, ptr %44, i32 0, i32 24
  %46 = load i32, ptr %45, align 4, !tbaa !25
  %47 = icmp ult i32 %46, 16384
  br i1 %47, label %48, label %130

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_struct_def, ptr %49, i32 0, i32 25
  %51 = load i32, ptr %50, align 8, !tbaa !24
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.png_struct_def, ptr %52, i32 0, i32 24
  %54 = load i32, ptr %53, align 4, !tbaa !25
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 54
  %57 = load i8, ptr %56, align 2, !tbaa !26
  %58 = zext i8 %57 to i32
  %59 = mul i32 %54, %58
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.png_struct_def, ptr %60, i32 0, i32 51
  %62 = load i8, ptr %61, align 1, !tbaa !27
  %63 = zext i8 %62 to i32
  %64 = mul i32 %59, %63
  %65 = add i32 %64, 15
  %66 = lshr i32 %65, 3
  %67 = mul i32 %51, %66
  store i32 %67, ptr %9, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %68 = load i32, ptr %8, align 4, !tbaa !23
  %69 = lshr i32 %68, 4
  store i32 %69, ptr %10, align 4, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %70 = load i32, ptr %10, align 4, !tbaa !23
  %71 = add i32 %70, 7
  %72 = shl i32 1, %71
  store i32 %72, ptr %11, align 4, !tbaa !23
  br label %73

73:                                               ; preds = %82, %48
  %74 = load i32, ptr %9, align 4, !tbaa !23
  %75 = load i32, ptr %11, align 4, !tbaa !23
  %76 = icmp ule i32 %74, %75
  br i1 %76, label %77, label %80

77:                                               ; preds = %73
  %78 = load i32, ptr %11, align 4, !tbaa !23
  %79 = icmp uge i32 %78, 256
  br label %80

80:                                               ; preds = %77, %73
  %81 = phi i1 [ false, %73 ], [ %79, %77 ]
  br i1 %81, label %82, label %87

82:                                               ; preds = %80
  %83 = load i32, ptr %10, align 4, !tbaa !23
  %84 = add i32 %83, -1
  store i32 %84, ptr %10, align 4, !tbaa !23
  %85 = load i32, ptr %11, align 4, !tbaa !23
  %86 = lshr i32 %85, 1
  store i32 %86, ptr %11, align 4, !tbaa !23
  br label %73, !llvm.loop !28

87:                                               ; preds = %80
  %88 = load i32, ptr %8, align 4, !tbaa !23
  %89 = and i32 %88, 15
  %90 = load i32, ptr %10, align 4, !tbaa !23
  %91 = shl i32 %90, 4
  %92 = or i32 %89, %91
  store i32 %92, ptr %8, align 4, !tbaa !23
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i64 0
  %95 = load i8, ptr %94, align 1, !tbaa !22
  %96 = zext i8 %95 to i32
  %97 = load i32, ptr %8, align 4, !tbaa !23
  %98 = trunc i32 %97 to i8
  %99 = zext i8 %98 to i32
  %100 = icmp ne i32 %96, %99
  br i1 %100, label %101, label %129

101:                                              ; preds = %87
  %102 = load i32, ptr %8, align 4, !tbaa !23
  %103 = trunc i32 %102 to i8
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds i8, ptr %104, i64 0
  store i8 %103, ptr %105, align 1, !tbaa !22
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds i8, ptr %106, i64 1
  %108 = load i8, ptr %107, align 1, !tbaa !22
  %109 = zext i8 %108 to i32
  %110 = and i32 %109, 224
  %111 = trunc i32 %110 to i8
  store i8 %111, ptr %107, align 1, !tbaa !22
  %112 = load i32, ptr %8, align 4, !tbaa !23
  %113 = shl i32 %112, 8
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds i8, ptr %114, i64 1
  %116 = load i8, ptr %115, align 1, !tbaa !22
  %117 = zext i8 %116 to i32
  %118 = add i32 %113, %117
  %119 = urem i32 %118, 31
  %120 = sub i32 31, %119
  %121 = trunc i32 %120 to i8
  %122 = zext i8 %121 to i32
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i64 1
  %125 = load i8, ptr %124, align 1, !tbaa !22
  %126 = zext i8 %125 to i32
  %127 = add nsw i32 %126, %122
  %128 = trunc i32 %127 to i8
  store i8 %128, ptr %124, align 1, !tbaa !22
  br label %129

129:                                              ; preds = %101, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %130

130:                                              ; preds = %129, %43, %38, %35
  br label %133

131:                                              ; preds = %31, %23
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %132, ptr noundef @.str.16)
  br label %133

133:                                              ; preds = %131, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %134

134:                                              ; preds = %133, %17, %3
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds [5 x i8], ptr %7, i64 0, i64 0
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = load i64, ptr %6, align 8, !tbaa !9
  call void @png_write_chunk(ptr noundef %135, ptr noundef %136, ptr noundef %137, i64 noundef %138)
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.png_struct_def, ptr %139, i32 0, i32 13
  %141 = load i32, ptr %140, align 4, !tbaa !11
  %142 = or i32 %141, 4
  store i32 %142, ptr %140, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 5, ptr %7) #4
  ret void
}

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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 284}
!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, !13, i64 284, !13, i64 288, !13, i64 292, !14, i64 296, !6, i64 408, !10, i64 416, !13, i64 424, !13, i64 428, !13, i64 432, !13, i64 436, !13, i64 440, !13, i64 444, !13, i64 448, !13, i64 452, !13, i64 456, !10, i64 464, !10, i64 472, !13, i64 480, !13, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !15, i64 536, !13, i64 560, !13, 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, !13, i64 640, !13, i64 644, !13, 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, !13, i64 824, !13, i64 828, !10, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !13, i64 864, !13, i64 868, !10, i64 872, !10, 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, !13, i64 984, !6, i64 992, !6, i64 1000, !13, i64 1008, !6, i64 1016, !7, i64 1024, !16, i64 1026, !16, i64 1028, !16, i64 1030, !13, i64 1032, !13, 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, !13, i64 1108, !13, i64 1112, !13, i64 1116, !20, i64 1120, !13, i64 1152, !13, i64 1156, !6, i64 1160, !13, i64 1168}
!13 = !{!"int", !7, i64 0}
!14 = !{!"z_stream_s", !6, i64 0, !13, i64 8, !10, i64 16, !6, i64 24, !13, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88, !10, i64 96, !10, i64 104}
!15 = !{!"png_row_info_struct", !13, i64 0, !10, 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, !10, i64 16, !7, i64 24}
!21 = !{!12, !7, i64 1104}
!22 = !{!7, !7, i64 0}
!23 = !{!13, !13, i64 0}
!24 = !{!12, !13, i64 448}
!25 = !{!12, !13, i64 444}
!26 = !{!12, !7, i64 594}
!27 = !{!12, !7, i64 591}
!28 = distinct !{!28, !29}
!29 = !{!"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_write_IDAT.png_IDAT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [49 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_error(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @png_write_IDAT(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca [5 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_IDAT.png_IDAT, i64 5, i1 false)
  %5 = getelementptr inbounds i8, ptr %0, i64 284
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, 4
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %67

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 1104
  %10 = load i8, ptr %9, align 8, !tbaa !19
  %11 = icmp eq i8 %10, 0
  br i1 %11, label %12, label %67

12:                                               ; preds = %8
  %13 = load i8, ptr %1, align 1, !tbaa !20
  %14 = zext i8 %13 to i32
  %15 = and i32 %14, 15
  %16 = icmp eq i32 %15, 8
  %17 = and i32 %14, 240
  %18 = icmp ult i32 %17, 113
  %or.cond = and i1 %16, %18
  br i1 %or.cond, label %19, label %66

19:                                               ; preds = %12
  %20 = icmp ugt i64 %2, 1
  br i1 %20, label %21, label %67

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %0, i64 448
  %23 = load i32, ptr %22, align 8, !tbaa !21
  %24 = icmp ult i32 %23, 16384
  br i1 %24, label %25, label %67

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 444
  %27 = load i32, ptr %26, align 4, !tbaa !22
  %28 = icmp ult i32 %27, 16384
  br i1 %28, label %29, label %67

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %0, i64 594
  %31 = load i8, ptr %30, align 2, !tbaa !23
  %32 = zext i8 %31 to i32
  %33 = mul nuw nsw i32 %27, %32
  %34 = getelementptr inbounds i8, ptr %0, i64 591
  %35 = load i8, ptr %34, align 1, !tbaa !24
  %36 = zext i8 %35 to i32
  %37 = mul nuw nsw i32 %33, %36
  %38 = add nuw nsw i32 %37, 15
  %39 = lshr i32 %38, 3
  %40 = mul i32 %39, %23
  %41 = lshr i32 %14, 4
  %42 = shl nuw nsw i32 128, %41
  %43 = icmp ule i32 %40, %42
  %44 = icmp ugt i32 %42, 255
  %45 = and i1 %43, %44
  br i1 %45, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %29, %.lr.ph
  %.040 = phi i32 [ %47, %.lr.ph ], [ %42, %29 ]
  %.03339 = phi i32 [ %46, %.lr.ph ], [ %41, %29 ]
  %46 = add nsw i32 %.03339, -1
  %47 = lshr i32 %.040, 1
  %48 = icmp ule i32 %40, %47
  %49 = icmp ugt i32 %.040, 511
  %50 = and i1 %48, %49
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !25

._crit_edge:                                      ; preds = %.lr.ph, %29
  %.033.lcssa = phi i32 [ %41, %29 ], [ %46, %.lr.ph ]
  %51 = shl i32 %.033.lcssa, 4
  %52 = or disjoint i32 %51, 8
  %53 = and i32 %52, 248
  %.not37 = icmp eq i32 %53, %14
  br i1 %.not37, label %67, label %54

54:                                               ; preds = %._crit_edge
  %55 = trunc i32 %52 to i8
  store i8 %55, ptr %1, align 1, !tbaa !20
  %56 = getelementptr inbounds i8, ptr %1, i64 1
  %57 = load i8, ptr %56, align 1, !tbaa !20
  %58 = and i8 %57, -32
  %59 = shl i32 %52, 8
  %60 = zext i8 %58 to i32
  %61 = or disjoint i32 %59, %60
  %62 = urem i32 %61, 31
  %63 = trunc nuw nsw i32 %62 to i8
  %64 = or disjoint i8 %58, %63
  %65 = xor i8 %64, 31
  store i8 %65, ptr %56, align 1, !tbaa !20
  br label %67

66:                                               ; preds = %12
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.16) #4
  br label %67

67:                                               ; preds = %66, %25, %21, %19, %54, %._crit_edge, %8, %3
  call void @png_write_chunk(ptr noundef %0, ptr noundef nonnull %4, ptr noundef %1, i64 noundef %2)
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = or i32 %68, 4
  store i32 %69, ptr %5, align 4, !tbaa !5
  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, !10, i64 284}
!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, !7, i64 1104}
!20 = !{!7, !7, i64 0}
!21 = !{!6, !10, i64 448}
!22 = !{!6, !10, i64 444}
!23 = !{!6, !7, i64 594}
!24 = !{!6, !7, i64 591}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass