; LLVM IR from niessner/Matterport :: code/gaps/pkgs/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, 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 }
%struct.png_text_struct = type { i32, ptr, ptr, i64, i64, ptr, ptr }

@.str.19 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @png_push_read_iTXt(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.png_struct_def, ptr %14, i32 0, i32 91
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = icmp ne i64 %16, 0
  br i1 %17, label %18, label %55

18:                                               ; preds = %2
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.png_struct_def, ptr %19, i32 0, i32 96
  %21 = load i64, ptr %20, align 8, !tbaa !20
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %55

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.png_struct_def, ptr %24, i32 0, i32 91
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.png_struct_def, ptr %27, i32 0, i32 96
  %29 = load i64, ptr %28, align 8, !tbaa !20
  %30 = icmp ult i64 %26, %29
  br i1 %30, label %31, label %35

31:                                               ; preds = %23
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_struct_def, ptr %32, i32 0, i32 91
  %34 = load i64, ptr %33, align 8, !tbaa !9
  store i64 %34, ptr %5, align 8, !tbaa !21
  br label %39

35:                                               ; preds = %23
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.png_struct_def, ptr %36, i32 0, i32 96
  %38 = load i64, ptr %37, align 8, !tbaa !20
  store i64 %38, ptr %5, align 8, !tbaa !21
  br label %39

39:                                               ; preds = %35, %31
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 98
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  %44 = load i64, ptr %5, align 8, !tbaa !21
  call void @png_crc_read(ptr noundef %40, ptr noundef %43, i64 noundef %44)
  %45 = load i64, ptr %5, align 8, !tbaa !21
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.png_struct_def, ptr %46, i32 0, i32 96
  %48 = load i64, ptr %47, align 8, !tbaa !20
  %49 = sub i64 %48, %45
  store i64 %49, ptr %47, align 8, !tbaa !20
  %50 = load i64, ptr %5, align 8, !tbaa !21
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.png_struct_def, ptr %51, i32 0, i32 98
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = getelementptr inbounds i8, ptr %53, i64 %50
  store ptr %54, ptr %52, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %55

55:                                               ; preds = %39, %18, %2
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.png_struct_def, ptr %56, i32 0, i32 96
  %58 = load i64, ptr %57, align 8, !tbaa !20
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %183, label %60

60:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 91
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = icmp ult i64 %63, 4
  br i1 %64, label %65, label %67

65:                                               ; preds = %60
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_push_save_buffer(ptr noundef %66)
  store i32 1, ptr %13, align 4
  br label %180

67:                                               ; preds = %60
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_push_crc_finish(ptr noundef %68)
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.png_struct_def, ptr %69, i32 0, i32 97
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  store ptr %71, ptr %7, align 8, !tbaa !5
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %72, ptr %9, align 8, !tbaa !5
  br label %73

73:                                               ; preds = %78, %67
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load i8, ptr %74, align 1, !tbaa !24
  %76 = icmp ne i8 %75, 0
  br i1 %76, label %77, label %81

77:                                               ; preds = %73
  br label %78

78:                                               ; preds = %77
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i32 1
  store ptr %80, ptr %9, align 8, !tbaa !5
  br label %73, !llvm.loop !25

81:                                               ; preds = %73
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_struct_def, ptr %84, i32 0, i32 95
  %86 = load i64, ptr %85, align 8, !tbaa !27
  %87 = getelementptr inbounds i8, ptr %83, i64 %86
  %88 = getelementptr inbounds i8, ptr %87, i64 -3
  %89 = icmp ult ptr %82, %88
  br i1 %89, label %90, label %93

90:                                               ; preds = %81
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i32 1
  store ptr %92, ptr %9, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %90, %81
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i32 1
  store ptr %95, ptr %9, align 8, !tbaa !5
  %96 = load i8, ptr %94, align 1, !tbaa !24
  %97 = sext i8 %96 to i32
  store i32 %97, ptr %8, align 4, !tbaa !28
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds i8, ptr %98, i32 1
  store ptr %99, ptr %9, align 8, !tbaa !5
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %100, ptr %10, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %106, %93
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load i8, ptr %102, align 1, !tbaa !24
  %104 = icmp ne i8 %103, 0
  br i1 %104, label %105, label %109

105:                                              ; preds = %101
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = getelementptr inbounds i8, ptr %107, i32 1
  store ptr %108, ptr %10, align 8, !tbaa !5
  br label %101, !llvm.loop !29

109:                                              ; preds = %101
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i32 1
  store ptr %111, ptr %10, align 8, !tbaa !5
  %112 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %112, ptr %11, align 8, !tbaa !5
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.png_struct_def, ptr %115, i32 0, i32 95
  %117 = load i64, ptr %116, align 8, !tbaa !27
  %118 = getelementptr inbounds i8, ptr %114, i64 %117
  %119 = getelementptr inbounds i8, ptr %118, i64 -1
  %120 = icmp ult ptr %113, %119
  br i1 %120, label %121, label %131

121:                                              ; preds = %109
  br label %122

122:                                              ; preds = %127, %121
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = load i8, ptr %123, align 1, !tbaa !24
  %125 = icmp ne i8 %124, 0
  br i1 %125, label %126, label %130

126:                                              ; preds = %122
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = getelementptr inbounds i8, ptr %128, i32 1
  store ptr %129, ptr %11, align 8, !tbaa !5
  br label %122, !llvm.loop !30

130:                                              ; preds = %122
  br label %131

131:                                              ; preds = %130, %109
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.png_struct_def, ptr %134, i32 0, i32 95
  %136 = load i64, ptr %135, align 8, !tbaa !27
  %137 = getelementptr inbounds i8, ptr %133, i64 %136
  %138 = icmp ult ptr %132, %137
  br i1 %138, label %139, label %142

139:                                              ; preds = %131
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = getelementptr inbounds i8, ptr %140, i32 1
  store ptr %141, ptr %11, align 8, !tbaa !5
  br label %142

142:                                              ; preds = %139, %131
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = call ptr @png_malloc(ptr noundef %143, i64 noundef 56)
  store ptr %144, ptr %6, align 8, !tbaa !5
  %145 = load i32, ptr %8, align 4, !tbaa !28
  %146 = add nsw i32 %145, 2
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.png_text_struct, ptr %147, i32 0, i32 0
  store i32 %146, ptr %148, align 8, !tbaa !31
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.png_text_struct, ptr %150, i32 0, i32 1
  store ptr %149, ptr %151, align 8, !tbaa !33
  %152 = load ptr, ptr %9, align 8, !tbaa !5
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.png_text_struct, ptr %153, i32 0, i32 5
  store ptr %152, ptr %154, align 8, !tbaa !34
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.png_text_struct, ptr %156, i32 0, i32 6
  store ptr %155, ptr %157, align 8, !tbaa !35
  %158 = load ptr, ptr %11, align 8, !tbaa !5
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.png_text_struct, ptr %159, i32 0, i32 2
  store ptr %158, ptr %160, align 8, !tbaa !36
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.png_text_struct, ptr %161, i32 0, i32 3
  store i64 0, ptr %162, align 8, !tbaa !37
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  %164 = call i64 @strlen(ptr noundef %163) #5
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_text_struct, ptr %165, i32 0, i32 4
  store i64 %164, ptr %166, align 8, !tbaa !38
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = call i32 @png_set_text_2(ptr noundef %167, ptr noundef %168, ptr noundef %169, i32 noundef 1)
  store i32 %170, ptr %12, align 4, !tbaa !28
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.png_struct_def, ptr %171, i32 0, i32 97
  store ptr null, ptr %172, align 8, !tbaa !23
  %173 = load ptr, ptr %3, align 8, !tbaa !5
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  call void @png_free(ptr noundef %173, ptr noundef %174)
  %175 = load i32, ptr %12, align 4, !tbaa !28
  %176 = icmp ne i32 %175, 0
  br i1 %176, label %177, label %179

177:                                              ; preds = %142
  %178 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_warning(ptr noundef %178, ptr noundef @.str.19)
  br label %179

179:                                              ; preds = %177, %142
  store i32 0, ptr %13, align 4
  br label %180

180:                                              ; preds = %179, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  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 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %181 = load i32, ptr %13, align 4
  switch i32 %181, label %184 [
    i32 0, label %182
    i32 1, label %183
  ]

182:                                              ; preds = %180
  br label %183

183:                                              ; preds = %182, %180, %55
  ret void

184:                                              ; preds = %180
  unreachable
}

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_crc_finish(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_save_buffer(ptr noundef) #0

declare void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) #2

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

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

declare ptr @png_malloc(ptr noundef, i64 noundef) #2

declare i32 @png_set_text_2(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 willreturn memory(read) "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 }
attributes #5 = { nounwind willreturn memory(read) }

!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, !13, i64 848}
!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, !6, i64 272, !7, i64 280, !7, i64 281, !11, i64 284, !11, i64 288, !11, i64 292, !12, i64 296, !6, i64 408, !13, i64 416, !11, i64 424, !11, i64 428, !11, i64 432, !11, i64 436, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !13, i64 464, !13, i64 472, !11, i64 480, !11, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !14, i64 536, !11, i64 560, !11, i64 564, !6, i64 568, !15, i64 576, !15, 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, !15, i64 598, !7, i64 600, !16, i64 604, !17, i64 608, !17, i64 618, !6, i64 632, !11, i64 640, !11, i64 644, !11, i64 648, !16, i64 652, !16, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !18, i64 712, !18, i64 717, !6, i64 728, !17, 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, !11, i64 824, !11, i64 828, !13, i64 832, !13, i64 840, !13, i64 848, !13, i64 856, !11, i64 864, !11, i64 868, !13, i64 872, !13, 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, !11, i64 984, !6, i64 992, !6, i64 1000, !11, i64 1008, !6, i64 1016, !7, i64 1024, !15, i64 1026, !15, i64 1028, !15, i64 1030, !11, i64 1032, !11, 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, !11, i64 1108, !11, i64 1112, !11, i64 1116, !19, i64 1120, !11, i64 1152, !11, i64 1156, !6, i64 1160, !11, i64 1168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !6, i64 0, !11, i64 8, !13, i64 16, !6, i64 24, !11, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !13, i64 96, !13, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!"png_row_info_struct", !11, i64 0, !13, 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, !13, i64 16, !7, i64 24}
!20 = !{!10, !13, i64 880}
!21 = !{!13, !13, i64 0}
!22 = !{!10, !6, i64 896}
!23 = !{!10, !6, i64 888}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!10, !13, i64 872}
!28 = !{!11, !11, i64 0}
!29 = distinct !{!29, !26}
!30 = distinct !{!30, !26}
!31 = !{!32, !11, i64 0}
!32 = !{!"png_text_struct", !11, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !6, i64 48}
!33 = !{!32, !6, i64 8}
!34 = !{!32, !6, i64 40}
!35 = !{!32, !6, i64 48}
!36 = !{!32, !6, i64 16}
!37 = !{!32, !13, i64 24}
!38 = !{!32, !13, i64 32}


; 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.19 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @png_push_read_iTXt(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 848
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i64 %4, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 880
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !19
  br i1 %.not, label %._crit_edge, label %5

5:                                                ; preds = %2
  %.not70 = icmp eq i64 %.pre, 0
  br i1 %.not70, label %.thread, label %6

6:                                                ; preds = %5
  %. = tail call i64 @llvm.umin.i64(i64 %4, i64 %.pre)
  %7 = getelementptr inbounds i8, ptr %0, i64 896
  %8 = load ptr, ptr %7, align 8, !tbaa !20
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %8, i64 noundef %.) #4
  %9 = load i64, ptr %.phi.trans.insert, align 8, !tbaa !19
  %10 = sub i64 %9, %.
  store i64 %10, ptr %.phi.trans.insert, align 8, !tbaa !19
  %11 = load ptr, ptr %7, align 8, !tbaa !20
  %12 = getelementptr inbounds i8, ptr %11, i64 %.
  store ptr %12, ptr %7, align 8, !tbaa !20
  br label %._crit_edge

._crit_edge:                                      ; preds = %2, %6
  %13 = phi i64 [ %10, %6 ], [ %.pre, %2 ]
  %.not71 = icmp eq i64 %13, 0
  br i1 %.not71, label %.thread, label %52

.thread:                                          ; preds = %5, %._crit_edge
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = icmp ult i64 %14, 4
  br i1 %15, label %16, label %17

16:                                               ; preds = %.thread
  tail call void @png_push_save_buffer(ptr noundef nonnull %0)
  br label %52

17:                                               ; preds = %.thread
  tail call void @png_push_crc_finish(ptr noundef nonnull %0)
  %18 = getelementptr inbounds i8, ptr %0, i64 888
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  br label %20

20:                                               ; preds = %20, %17
  %.064 = phi ptr [ %19, %17 ], [ %22, %20 ]
  %21 = load i8, ptr %.064, align 1, !tbaa !22
  %.not72 = icmp eq i8 %21, 0
  %22 = getelementptr inbounds i8, ptr %.064, i64 1
  br i1 %.not72, label %23, label %20, !llvm.loop !23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 872
  %25 = load i64, ptr %24, align 8, !tbaa !25
  %26 = getelementptr inbounds i8, ptr %19, i64 %25
  %27 = getelementptr inbounds i8, ptr %26, i64 -3
  %28 = icmp ult ptr %.064, %27
  %spec.select.idx = zext i1 %28 to i64
  %spec.select = getelementptr inbounds i8, ptr %.064, i64 %spec.select.idx
  %29 = load i8, ptr %spec.select, align 1, !tbaa !22
  %30 = getelementptr inbounds i8, ptr %spec.select, i64 2
  br label %31

31:                                               ; preds = %31, %23
  %.063 = phi ptr [ %30, %23 ], [ %33, %31 ]
  %32 = load i8, ptr %.063, align 1, !tbaa !22
  %.not73 = icmp eq i8 %32, 0
  %33 = getelementptr inbounds i8, ptr %.063, i64 1
  br i1 %.not73, label %34, label %31, !llvm.loop !26

34:                                               ; preds = %31
  %35 = sext i8 %29 to i32
  %36 = getelementptr inbounds i8, ptr %26, i64 -1
  %37 = icmp ult ptr %33, %36
  br i1 %37, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %34, %.preheader
  %.062 = phi ptr [ %39, %.preheader ], [ %33, %34 ]
  %38 = load i8, ptr %.062, align 1, !tbaa !22
  %.not74 = icmp eq i8 %38, 0
  %39 = getelementptr inbounds i8, ptr %.062, i64 1
  br i1 %.not74, label %.loopexit, label %.preheader, !llvm.loop !27

.loopexit:                                        ; preds = %.preheader, %34
  %.1 = phi ptr [ %33, %34 ], [ %.062, %.preheader ]
  %40 = icmp ult ptr %.1, %26
  %spec.select76.idx = zext i1 %40 to i64
  %spec.select76 = getelementptr inbounds i8, ptr %.1, i64 %spec.select76.idx
  %41 = tail call ptr @png_malloc(ptr noundef %0, i64 noundef 56) #4
  %42 = add nsw i32 %35, 2
  store i32 %42, ptr %41, align 8, !tbaa !28
  %43 = getelementptr inbounds i8, ptr %41, i64 8
  store ptr %19, ptr %43, align 8, !tbaa !30
  %44 = getelementptr inbounds i8, ptr %41, i64 40
  store ptr %30, ptr %44, align 8, !tbaa !31
  %45 = getelementptr inbounds i8, ptr %41, i64 48
  store ptr %33, ptr %45, align 8, !tbaa !32
  %46 = getelementptr inbounds i8, ptr %41, i64 16
  store ptr %spec.select76, ptr %46, align 8, !tbaa !33
  %47 = getelementptr inbounds i8, ptr %41, i64 24
  store i64 0, ptr %47, align 8, !tbaa !34
  %48 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %spec.select76) #5
  %49 = getelementptr inbounds i8, ptr %41, i64 32
  store i64 %48, ptr %49, align 8, !tbaa !35
  %50 = tail call i32 @png_set_text_2(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %41, i32 noundef 1) #4
  store ptr null, ptr %18, align 8, !tbaa !21
  tail call void @png_free(ptr noundef %0, ptr noundef nonnull %41) #4
  %.not75 = icmp eq i32 %50, 0
  br i1 %.not75, label %52, label %51

51:                                               ; preds = %.loopexit
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.19) #4
  br label %52

52:                                               ; preds = %16, %51, %.loopexit, %._crit_edge
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_crc_finish(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_save_buffer(ptr noundef) local_unnamed_addr #0

declare void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

declare ptr @png_malloc(ptr noundef, i64 noundef) local_unnamed_addr #1

declare i32 @png_set_text_2(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #3

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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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, !12, i64 848}
!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 880}
!20 = !{!6, !9, i64 896}
!21 = !{!6, !9, i64 888}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!6, !12, i64 872}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}
!28 = !{!29, !10, i64 0}
!29 = !{!"png_text_struct", !10, i64 0, !9, i64 8, !9, i64 16, !12, i64 24, !12, i64 32, !9, i64 40, !9, i64 48}
!30 = !{!29, !9, i64 8}
!31 = !{!29, !9, i64 40}
!32 = !{!29, !9, i64 48}
!33 = !{!29, !9, i64 16}
!34 = !{!29, !12, i64 24}
!35 = !{!29, !12, i64 32}


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