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

; 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 }

@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local void @png_decompress_chunk(ptr noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3, ptr noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca [50 x i8], align 16
  %16 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !11
  store i64 %3, ptr %9, align 8, !tbaa !11
  store ptr %4, ptr %10, align 8, !tbaa !5
  %17 = load i64, ptr %9, align 8, !tbaa !11
  %18 = load i64, ptr %8, align 8, !tbaa !11
  %19 = icmp ugt i64 %17, %18
  br i1 %19, label %20, label %22

20:                                               ; preds = %5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %21, ptr noundef @.str.2)
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %125

22:                                               ; preds = %5
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %118

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.png_struct_def, ptr %27, i32 0, i32 136
  %29 = load ptr, ptr %28, align 8, !tbaa !13
  %30 = load i64, ptr %9, align 8, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %29, i64 %30
  %32 = load i64, ptr %8, align 8, !tbaa !11
  %33 = load i64, ptr %9, align 8, !tbaa !11
  %34 = sub i64 %32, %33
  %35 = call i64 @png_inflate(ptr noundef %26, ptr noundef %31, i64 noundef %34, ptr noundef null, i64 noundef 0)
  store i64 %35, ptr %11, align 8, !tbaa !11
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.png_struct_def, ptr %36, i32 0, i32 29
  %38 = load i64, ptr %37, align 8, !tbaa !22
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %51

40:                                               ; preds = %25
  %41 = load i64, ptr %9, align 8, !tbaa !11
  %42 = load i64, ptr %11, align 8, !tbaa !11
  %43 = add i64 %41, %42
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_struct_def, ptr %44, i32 0, i32 29
  %46 = load i64, ptr %45, align 8, !tbaa !22
  %47 = sub i64 %46, 1
  %48 = icmp uge i64 %43, %47
  br i1 %48, label %49, label %51

49:                                               ; preds = %40
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %50, ptr noundef @.str.3)
  br label %114

51:                                               ; preds = %40, %25
  %52 = load i64, ptr %11, align 8, !tbaa !11
  %53 = icmp ugt i64 %52, 0
  br i1 %53, label %54, label %113

54:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 0, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = load i64, ptr %9, align 8, !tbaa !11
  %57 = load i64, ptr %11, align 8, !tbaa !11
  %58 = add i64 %56, %57
  %59 = add i64 %58, 1
  %60 = call ptr @png_malloc_warn(ptr noundef %55, i64 noundef %59)
  store ptr %60, ptr %13, align 8, !tbaa !5
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = icmp ne ptr %61, null
  br i1 %62, label %63, label %107

63:                                               ; preds = %54
  %64 = load ptr, ptr %13, align 8, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_struct_def, ptr %65, i32 0, i32 136
  %67 = load ptr, ptr %66, align 8, !tbaa !13
  %68 = load i64, ptr %9, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %64, ptr align 1 %67, i64 %68, i1 false)
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.png_struct_def, ptr %70, i32 0, i32 136
  %72 = load ptr, ptr %71, align 8, !tbaa !13
  %73 = load i64, ptr %9, align 8, !tbaa !11
  %74 = getelementptr inbounds i8, ptr %72, i64 %73
  %75 = load i64, ptr %8, align 8, !tbaa !11
  %76 = load i64, ptr %9, align 8, !tbaa !11
  %77 = sub i64 %75, %76
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = load i64, ptr %9, align 8, !tbaa !11
  %80 = getelementptr inbounds i8, ptr %78, i64 %79
  %81 = load i64, ptr %11, align 8, !tbaa !11
  %82 = call i64 @png_inflate(ptr noundef %69, ptr noundef %74, i64 noundef %77, ptr noundef %80, i64 noundef %81)
  store i64 %82, ptr %12, align 8, !tbaa !11
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = load i64, ptr %9, align 8, !tbaa !11
  %85 = load i64, ptr %11, align 8, !tbaa !11
  %86 = add i64 %84, %85
  %87 = getelementptr inbounds i8, ptr %83, i64 %86
  store i8 0, ptr %87, align 1, !tbaa !23
  %88 = load i64, ptr %12, align 8, !tbaa !11
  %89 = load i64, ptr %11, align 8, !tbaa !11
  %90 = icmp eq i64 %88, %89
  br i1 %90, label %91, label %103

91:                                               ; preds = %63
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_struct_def, ptr %93, i32 0, i32 136
  %95 = load ptr, ptr %94, align 8, !tbaa !13
  call void @png_free(ptr noundef %92, ptr noundef %95)
  %96 = load ptr, ptr %13, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.png_struct_def, ptr %97, i32 0, i32 136
  store ptr %96, ptr %98, align 8, !tbaa !13
  %99 = load i64, ptr %9, align 8, !tbaa !11
  %100 = load i64, ptr %11, align 8, !tbaa !11
  %101 = add i64 %99, %100
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %101, ptr %102, align 8, !tbaa !11
  store i32 1, ptr %14, align 4
  br label %110

103:                                              ; preds = %63
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %104, ptr noundef @.str.4)
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  call void @png_free(ptr noundef %105, ptr noundef %106)
  br label %109

107:                                              ; preds = %54
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_warning(ptr noundef %108, ptr noundef @.str.5)
  br label %109

109:                                              ; preds = %107, %103
  store i32 0, ptr %14, align 4
  br label %110

110:                                              ; preds = %109, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  %111 = load i32, ptr %14, align 4
  switch i32 %111, label %115 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  br label %113

113:                                              ; preds = %112, %51
  br label %114

114:                                              ; preds = %113, %49
  store i32 0, ptr %14, align 4
  br label %115

115:                                              ; preds = %114, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %116 = load i32, ptr %14, align 4
  switch i32 %116, label %158 [
    i32 0, label %117
    i32 1, label %157
  ]

117:                                              ; preds = %115
  br label %124

118:                                              ; preds = %22
  call void @llvm.lifetime.start.p0(i64 50, ptr %15) #5
  %119 = getelementptr inbounds [50 x i8], ptr %15, i64 0, i64 0
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %119, i64 noundef 50, ptr noundef @.str.6, i32 noundef %120) #5
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds [50 x i8], ptr %15, i64 0, i64 0
  call void @png_warning(ptr noundef %122, ptr noundef %123)
  call void @llvm.lifetime.end.p0(i64 50, ptr %15) #5
  br label %124

124:                                              ; preds = %118, %117
  br label %125

125:                                              ; preds = %124, %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = load i64, ptr %9, align 8, !tbaa !11
  %128 = add i64 %127, 1
  %129 = call ptr @png_malloc_warn(ptr noundef %126, i64 noundef %128)
  store ptr %129, ptr %16, align 8, !tbaa !5
  %130 = load ptr, ptr %16, align 8, !tbaa !5
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %154

132:                                              ; preds = %125
  %133 = load i64, ptr %9, align 8, !tbaa !11
  %134 = icmp ugt i64 %133, 0
  br i1 %134, label %135, label %141

135:                                              ; preds = %132
  %136 = load ptr, ptr %16, align 8, !tbaa !5
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.png_struct_def, ptr %137, i32 0, i32 136
  %139 = load ptr, ptr %138, align 8, !tbaa !13
  %140 = load i64, ptr %9, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %136, ptr align 1 %139, i64 %140, i1 false)
  br label %141

141:                                              ; preds = %135, %132
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.png_struct_def, ptr %143, i32 0, i32 136
  %145 = load ptr, ptr %144, align 8, !tbaa !13
  call void @png_free(ptr noundef %142, ptr noundef %145)
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.png_struct_def, ptr %147, i32 0, i32 136
  store ptr %146, ptr %148, align 8, !tbaa !13
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.png_struct_def, ptr %149, i32 0, i32 136
  %151 = load ptr, ptr %150, align 8, !tbaa !13
  %152 = load i64, ptr %9, align 8, !tbaa !11
  %153 = getelementptr inbounds i8, ptr %151, i64 %152
  store i8 0, ptr %153, align 1, !tbaa !23
  br label %154

154:                                              ; preds = %141, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %155 = load i64, ptr %9, align 8, !tbaa !11
  %156 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %155, ptr %156, align 8, !tbaa !11
  br label %157

157:                                              ; preds = %154, %115
  ret void

158:                                              ; preds = %115
  unreachable
}

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

; Function Attrs: nounwind uwtable
declare hidden i64 @png_inflate(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) #2

declare ptr @png_malloc_warn(ptr noundef, i64 noundef) #3

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

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 "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 #5 = { 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, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 1160}
!14 = !{!"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, !15, i64 296, !6, 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, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !16, i64 536, !10, i64 560, !10, i64 564, !6, i64 568, !17, i64 576, !17, 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, !17, i64 598, !7, i64 600, !18, i64 604, !19, i64 608, !19, i64 618, !6, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !18, i64 652, !18, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !20, i64 712, !20, i64 717, !6, i64 728, !19, 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, !12, i64 832, !12, i64 840, !12, i64 848, !12, i64 856, !10, i64 864, !10, i64 868, !12, i64 872, !12, 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, !17, i64 1026, !17, i64 1028, !17, 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, !21, i64 1120, !10, i64 1152, !10, i64 1156, !6, i64 1160, !10, i64 1168}
!15 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !12, i64 16, !6, i64 24, !10, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !12, i64 96, !12, i64 104}
!16 = !{!"png_row_info_struct", !10, i64 0, !12, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!17 = !{!"short", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"png_color_16_struct", !7, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !17, i64 8}
!20 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!21 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !12, i64 16, !7, i64 24}
!22 = !{!14, !12, i64 472}
!23 = !{!7, !7, i64 0}


; 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"

@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [33 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.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: nounwind uwtable
define dso_local void @png_decompress_chunk(ptr noundef %0, i32 noundef %1, i64 noundef %2, i64 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #2 {
  %6 = alloca [50 x i8], align 16
  %7 = icmp ugt i64 %3, %2
  br i1 %7, label %8, label %9

8:                                                ; preds = %5
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.2) #5
  br label %.thread

9:                                                ; preds = %5
  %10 = icmp eq i32 %1, 0
  br i1 %10, label %11, label %40

11:                                               ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 1160
  %13 = load ptr, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 %3
  %15 = sub i64 %2, %3
  %16 = tail call i64 @png_inflate(ptr noundef %0, ptr noundef %14, i64 noundef %15, ptr noundef null, i64 noundef 0)
  %17 = getelementptr inbounds i8, ptr %0, i64 472
  %18 = load i64, ptr %17, align 8, !tbaa !19
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %23, label %19

19:                                               ; preds = %11
  %20 = add i64 %16, %3
  %21 = add i64 %18, -1
  %.not72 = icmp ult i64 %20, %21
  br i1 %.not72, label %23, label %22

22:                                               ; preds = %19
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.3) #5
  br label %.thread

23:                                               ; preds = %19, %11
  %.not73 = icmp eq i64 %16, 0
  br i1 %.not73, label %.thread, label %24

24:                                               ; preds = %23
  %25 = add i64 %16, %3
  %26 = add i64 %25, 1
  %27 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %26) #5
  %.not74 = icmp eq ptr %27, null
  br i1 %.not74, label %37, label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %27, ptr align 1 %29, i64 %3, i1 false)
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 %3
  %32 = getelementptr inbounds i8, ptr %27, i64 %3
  %33 = tail call i64 @png_inflate(ptr noundef nonnull %0, ptr noundef %31, i64 noundef %15, ptr noundef nonnull %32, i64 noundef %16)
  %34 = getelementptr inbounds i8, ptr %27, i64 %25
  store i8 0, ptr %34, align 1, !tbaa !20
  %35 = icmp eq i64 %33, %16
  br i1 %35, label %38, label %36

36:                                               ; preds = %28
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.4) #5
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %27) #5
  br label %.thread

37:                                               ; preds = %24
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.5) #5
  br label %.thread

38:                                               ; preds = %28
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %39) #5
  store ptr %27, ptr %12, align 8, !tbaa !5
  br label %52

40:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %6) #5
  %41 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %6, i64 noundef 50, ptr noundef nonnull @.str.6, i32 noundef %1) #5
  call void @png_warning(ptr noundef %0, ptr noundef nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %6) #5
  br label %.thread

.thread:                                          ; preds = %22, %23, %36, %37, %40, %8
  %.0 = phi i64 [ 0, %8 ], [ %3, %40 ], [ %3, %37 ], [ %3, %36 ], [ %3, %23 ], [ %3, %22 ]
  %42 = add i64 %.0, 1
  %43 = call ptr @png_malloc_warn(ptr noundef %0, i64 noundef %42) #5
  %.not75 = icmp eq ptr %43, null
  br i1 %.not75, label %52, label %44

44:                                               ; preds = %.thread
  %.not76 = icmp eq i64 %.0, 0
  br i1 %.not76, label %48, label %45

45:                                               ; preds = %44
  %46 = getelementptr inbounds i8, ptr %0, i64 1160
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %43, ptr align 1 %47, i64 %.0, i1 false)
  br label %48

48:                                               ; preds = %45, %44
  %49 = getelementptr inbounds i8, ptr %0, i64 1160
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  call void @png_free(ptr noundef %0, ptr noundef %50) #5
  store ptr %43, ptr %49, align 8, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %43, i64 %.0
  store i8 0, ptr %51, align 1, !tbaa !20
  br label %52

52:                                               ; preds = %.thread, %48, %38
  %storemerge = phi i64 [ %25, %38 ], [ %.0, %48 ], [ %.0, %.thread ]
  store i64 %storemerge, ptr %4, align 8, !tbaa !21
  ret void
}

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

; Function Attrs: nounwind uwtable
declare hidden i64 @png_inflate(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare ptr @png_malloc_warn(ptr noundef, i64 noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

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 = { nofree nounwind "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 #5 = { 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, !9, i64 1160}
!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, !12, i64 472}
!20 = !{!7, !7, i64 0}
!21 = !{!12, !12, i64 0}


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