; LLVM IR from rdguez-mariano/fast_imas_IPOL :: io_png/libs/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, i8, i8, i64, i64, i64, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i64, i64, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i64, i64, i32, float, float, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, i8, i16, i16, i16, i64, i64, i8, i8, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i64, i64, %struct.png_unknown_chunk_t, i64, i64, ptr }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_row_info_struct = type { i64, i64, i8, i8, i8, i8 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }
%struct.png_text_struct = type { i32, ptr, ptr, i64 }

@.str.112 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [41 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

declare void @png_error(ptr noundef, ptr noundef) #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_crc_read(ptr noundef, ptr noundef, i64 noundef) #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_zTXt(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 ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = 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 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.png_struct_def, ptr %15, i32 0, i32 12
  %17 = load i64, ptr %16, align 8, !tbaa !11
  %18 = and i64 %17, 1
  %19 = icmp ne i64 %18, 0
  br i1 %19, label %22, label %20

20:                                               ; preds = %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %21, ptr noundef @.str.112)
  br label %22

22:                                               ; preds = %20, %3
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.png_struct_def, ptr %23, i32 0, i32 12
  %25 = load i64, ptr %24, align 8, !tbaa !11
  %26 = and i64 %25, 4
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %33

28:                                               ; preds = %22
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_struct_def, ptr %29, i32 0, i32 12
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = or i64 %31, 8
  store i64 %32, ptr %30, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %28, %22
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.png_struct_def, ptr %35, i32 0, i32 137
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  call void @png_free(ptr noundef %34, ptr noundef %37)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = load i64, ptr %6, align 8, !tbaa !9
  %40 = add i64 %39, 1
  %41 = call ptr @png_malloc_warn(ptr noundef %38, i64 noundef %40)
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.png_struct_def, ptr %42, i32 0, i32 137
  store ptr %41, ptr %43, align 8, !tbaa !21
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_struct_def, ptr %44, i32 0, i32 137
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = icmp eq ptr %46, null
  br i1 %47, label %48, label %50

48:                                               ; preds = %33
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %49, ptr noundef @.str.113)
  store i32 1, ptr %14, align 4
  br label %173

50:                                               ; preds = %33
  %51 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %51, ptr %11, align 8, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.png_struct_def, ptr %53, i32 0, i32 137
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = load i64, ptr %11, align 8, !tbaa !9
  call void @png_crc_read(ptr noundef %52, ptr noundef %55, i64 noundef %56)
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = call i32 @png_crc_finish(ptr noundef %57, i64 noundef 0)
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %67

60:                                               ; preds = %50
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.png_struct_def, ptr %62, i32 0, i32 137
  %64 = load ptr, ptr %63, align 8, !tbaa !21
  call void @png_free(ptr noundef %61, ptr noundef %64)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_struct_def, ptr %65, i32 0, i32 137
  store ptr null, ptr %66, align 8, !tbaa !21
  store i32 1, ptr %14, align 4
  br label %173

67:                                               ; preds = %50
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 137
  %70 = load ptr, ptr %69, align 8, !tbaa !21
  %71 = load i64, ptr %11, align 8, !tbaa !9
  %72 = getelementptr inbounds i8, ptr %70, i64 %71
  store i8 0, ptr %72, align 1, !tbaa !22
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.png_struct_def, ptr %73, i32 0, i32 137
  %75 = load ptr, ptr %74, align 8, !tbaa !21
  store ptr %75, ptr %8, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %81, %67
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load i8, ptr %77, align 1, !tbaa !22
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %80, label %84

80:                                               ; preds = %76
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i32 1
  store ptr %83, ptr %8, align 8, !tbaa !5
  br label %76, !llvm.loop !23

84:                                               ; preds = %76
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.png_struct_def, ptr %86, i32 0, i32 137
  %88 = load ptr, ptr %87, align 8, !tbaa !21
  %89 = load i64, ptr %11, align 8, !tbaa !9
  %90 = getelementptr inbounds i8, ptr %88, i64 %89
  %91 = getelementptr inbounds i8, ptr %90, i64 -2
  %92 = icmp uge ptr %85, %91
  br i1 %92, label %93, label %101

93:                                               ; preds = %84
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %94, ptr noundef @.str.114)
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 137
  %98 = load ptr, ptr %97, align 8, !tbaa !21
  call void @png_free(ptr noundef %95, ptr noundef %98)
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_struct_def, ptr %99, i32 0, i32 137
  store ptr null, ptr %100, align 8, !tbaa !21
  store i32 1, ptr %14, align 4
  br label %173

101:                                              ; preds = %84
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = getelementptr inbounds i8, ptr %102, i32 1
  store ptr %103, ptr %8, align 8, !tbaa !5
  %104 = load i8, ptr %103, align 1, !tbaa !22
  %105 = sext i8 %104 to i32
  store i32 %105, ptr %9, align 4, !tbaa !25
  %106 = load i32, ptr %9, align 4, !tbaa !25
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %110

108:                                              ; preds = %101
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %109, ptr noundef @.str.115)
  store i32 0, ptr %9, align 4, !tbaa !25
  br label %110

110:                                              ; preds = %108, %101
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds i8, ptr %111, i32 1
  store ptr %112, ptr %8, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %110
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.png_struct_def, ptr %115, i32 0, i32 137
  %117 = load ptr, ptr %116, align 8, !tbaa !21
  %118 = ptrtoint ptr %114 to i64
  %119 = ptrtoint ptr %117 to i64
  %120 = sub i64 %118, %119
  store i64 %120, ptr %12, align 8, !tbaa !9
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = load i32, ptr %9, align 4, !tbaa !25
  %123 = load i64, ptr %6, align 8, !tbaa !9
  %124 = load i64, ptr %12, align 8, !tbaa !9
  call void @png_decompress_chunk(ptr noundef %121, i32 noundef %122, i64 noundef %123, i64 noundef %124, ptr noundef %13)
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = call ptr @png_malloc_warn(ptr noundef %125, i64 noundef 32)
  store ptr %126, ptr %7, align 8, !tbaa !5
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = icmp eq ptr %127, null
  br i1 %128, label %129, label %137

129:                                              ; preds = %113
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %130, ptr noundef @.str.116)
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_struct_def, ptr %132, i32 0, i32 137
  %134 = load ptr, ptr %133, align 8, !tbaa !21
  call void @png_free(ptr noundef %131, ptr noundef %134)
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.png_struct_def, ptr %135, i32 0, i32 137
  store ptr null, ptr %136, align 8, !tbaa !21
  store i32 1, ptr %14, align 4
  br label %173

137:                                              ; preds = %113
  %138 = load i32, ptr %9, align 4, !tbaa !25
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.png_text_struct, ptr %139, i32 0, i32 0
  store i32 %138, ptr %140, align 8, !tbaa !26
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_struct_def, ptr %141, i32 0, i32 137
  %143 = load ptr, ptr %142, align 8, !tbaa !21
  %144 = load ptr, ptr %7, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_text_struct, ptr %144, i32 0, i32 1
  store ptr %143, ptr %145, align 8, !tbaa !28
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.png_struct_def, ptr %146, i32 0, i32 137
  %148 = load ptr, ptr %147, align 8, !tbaa !21
  %149 = load i64, ptr %12, align 8, !tbaa !9
  %150 = getelementptr inbounds i8, ptr %148, i64 %149
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.png_text_struct, ptr %151, i32 0, i32 2
  store ptr %150, ptr %152, align 8, !tbaa !29
  %153 = load i64, ptr %13, align 8, !tbaa !9
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.png_text_struct, ptr %154, i32 0, i32 3
  store i64 %153, ptr %155, align 8, !tbaa !30
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = call i32 @png_set_text_2(ptr noundef %156, ptr noundef %157, ptr noundef %158, i32 noundef 1)
  store i32 %159, ptr %10, align 4, !tbaa !25
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %160, ptr noundef %161)
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = load ptr, ptr %4, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.png_struct_def, ptr %163, i32 0, i32 137
  %165 = load ptr, ptr %164, align 8, !tbaa !21
  call void @png_free(ptr noundef %162, ptr noundef %165)
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.png_struct_def, ptr %166, i32 0, i32 137
  store ptr null, ptr %167, align 8, !tbaa !21
  %168 = load i32, ptr %10, align 4, !tbaa !25
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %137
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %171, ptr noundef @.str.117)
  br label %172

172:                                              ; preds = %170, %137
  store i32 0, ptr %14, align 4
  br label %173

173:                                              ; preds = %172, %129, %93, %60, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %174 = load i32, ptr %14, align 4
  switch i32 %174, label %176 [
    i32 0, label %175
    i32 1, label %175
  ]

175:                                              ; preds = %173, %173
  ret void

176:                                              ; preds = %173
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = { 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, !10, i64 280}
!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, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !13, i64 304, !6, i64 416, !10, i64 424, !14, i64 432, !14, i64 436, !14, i64 440, !14, i64 444, !14, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !15, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !16, i64 616, !16, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !16, i64 638, !7, i64 640, !17, i64 644, !18, i64 648, !18, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !14, i64 696, !17, i64 700, !17, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !19, i64 760, !19, i64 765, !6, i64 776, !18, i64 784, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !14, i64 920, !14, i64 924, !10, i64 928, !10, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !7, i64 984, !7, i64 985, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !10, i64 1040, !6, i64 1048, !6, i64 1056, !14, i64 1064, !6, i64 1072, !7, i64 1080, !16, i64 1082, !16, i64 1084, !16, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !6, i64 1128, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !6, i64 1168, !6, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !20, i64 1208, !10, i64 1240, !10, i64 1248, !6, i64 1256}
!13 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !10, i64 16, !6, i64 24, !14, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, 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, !6, i64 1256}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!14, !14, i64 0}
!26 = !{!27, !14, i64 0}
!27 = !{!"png_text_struct", !14, i64 0, !6, i64 8, !6, i64 16, !10, i64 24}
!28 = !{!27, !6, i64 8}
!29 = !{!27, !6, i64 16}
!30 = !{!27, !10, i64 24}


; 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.112 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.113 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.114 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.115 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.116 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [41 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

declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #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_crc_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

declare void @png_free(ptr noundef, ptr 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: nounwind uwtable
define dso_local void @png_handle_zTXt(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 280
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = and i64 %6, 1
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %3
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.112) #3
  %.pre = load i64, ptr %5, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %8, %3
  %10 = phi i64 [ %.pre, %8 ], [ %6, %3 ]
  %11 = and i64 %10, 4
  %.not68 = icmp eq i64 %11, 0
  br i1 %.not68, label %14, label %12

12:                                               ; preds = %9
  %13 = or i64 %10, 8
  store i64 %13, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %12, %9
  %15 = getelementptr inbounds i8, ptr %0, i64 1256
  %16 = load ptr, ptr %15, align 8, !tbaa !19
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %16) #3
  %17 = add i64 %2, 1
  %18 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %17) #3
  store ptr %18, ptr %15, align 8, !tbaa !19
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %14
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.113) #3
  br label %59

21:                                               ; preds = %14
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %18, i64 noundef %2)
  %22 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef 0)
  %.not69 = icmp eq i32 %22, 0
  %23 = load ptr, ptr %15, align 8, !tbaa !19
  br i1 %.not69, label %25, label %24

24:                                               ; preds = %21
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %23) #3
  store ptr null, ptr %15, align 8, !tbaa !19
  br label %59

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %23, i64 %2
  store i8 0, ptr %26, align 1, !tbaa !20
  %27 = load ptr, ptr %15, align 8, !tbaa !19
  br label %28

28:                                               ; preds = %28, %25
  %.0 = phi ptr [ %27, %25 ], [ %30, %28 ]
  %29 = load i8, ptr %.0, align 1, !tbaa !20
  %.not70 = icmp eq i8 %29, 0
  %30 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not70, label %31, label %28, !llvm.loop !21

31:                                               ; preds = %28
  %32 = getelementptr inbounds i8, ptr %27, i64 %2
  %33 = getelementptr inbounds i8, ptr %32, i64 -2
  %.not71 = icmp ult ptr %.0, %33
  br i1 %.not71, label %36, label %34

34:                                               ; preds = %31
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.114) #3
  %35 = load ptr, ptr %15, align 8, !tbaa !19
  tail call void @png_free(ptr noundef %0, ptr noundef %35) #3
  store ptr null, ptr %15, align 8, !tbaa !19
  br label %59

36:                                               ; preds = %31
  %37 = load i8, ptr %30, align 1, !tbaa !20
  %.not72 = icmp eq i8 %37, 0
  br i1 %.not72, label %39, label %38

38:                                               ; preds = %36
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.115) #3
  %.pre74 = load ptr, ptr %15, align 8, !tbaa !19
  br label %39

39:                                               ; preds = %38, %36
  %40 = phi ptr [ %.pre74, %38 ], [ %27, %36 ]
  %41 = getelementptr inbounds i8, ptr %.0, i64 2
  %42 = ptrtoint ptr %41 to i64
  %43 = ptrtoint ptr %40 to i64
  %44 = sub i64 %42, %43
  call void @png_decompress_chunk(ptr noundef %0, i32 noundef 0, i64 noundef %2, i64 noundef %44, ptr noundef nonnull %4)
  %45 = call ptr @png_malloc_warn(ptr noundef %0, i64 noundef 32) #3
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %39
  call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.116) #3
  %48 = load ptr, ptr %15, align 8, !tbaa !19
  call void @png_free(ptr noundef nonnull %0, ptr noundef %48) #3
  store ptr null, ptr %15, align 8, !tbaa !19
  br label %59

49:                                               ; preds = %39
  store i32 0, ptr %45, align 8, !tbaa !23
  %50 = load ptr, ptr %15, align 8, !tbaa !19
  %51 = getelementptr inbounds i8, ptr %45, i64 8
  store ptr %50, ptr %51, align 8, !tbaa !25
  %52 = getelementptr inbounds i8, ptr %50, i64 %44
  %53 = getelementptr inbounds i8, ptr %45, i64 16
  store ptr %52, ptr %53, align 8, !tbaa !26
  %54 = load i64, ptr %4, align 8, !tbaa !27
  %55 = getelementptr inbounds i8, ptr %45, i64 24
  store i64 %54, ptr %55, align 8, !tbaa !28
  %56 = call i32 @png_set_text_2(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %45, i32 noundef 1) #3
  call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %45) #3
  %57 = load ptr, ptr %15, align 8, !tbaa !19
  call void @png_free(ptr noundef nonnull %0, ptr noundef %57) #3
  store ptr null, ptr %15, align 8, !tbaa !19
  %.not73 = icmp eq i32 %56, 0
  br i1 %.not73, label %59, label %58

58:                                               ; preds = %49
  call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.117) #3
  br label %59

59:                                               ; preds = %49, %58, %47, %34, %24, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = { 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 280}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !11, i64 304, !9, i64 416, !10, i64 424, !12, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !9, i64 520, !9, i64 528, !9, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !13, i64 568, !10, i64 592, !10, i64 600, !9, i64 608, !14, i64 616, !14, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !14, i64 638, !7, i64 640, !15, i64 644, !16, i64 648, !16, i64 658, !9, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !15, i64 700, !15, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !9, i64 744, !9, i64 752, !17, i64 760, !17, i64 765, !9, i64 776, !16, i64 784, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !9, i64 856, !9, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !12, i64 920, !12, i64 924, !10, i64 928, !10, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !7, i64 984, !7, i64 985, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !10, i64 1040, !9, i64 1048, !9, i64 1056, !12, i64 1064, !9, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !9, i64 1160, !9, i64 1168, !9, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !18, i64 1208, !10, i64 1240, !10, i64 1248, !9, i64 1256}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !10, i64 16, !9, i64 24, !12, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !10, i64 16, !7, i64 24}
!19 = !{!6, !9, i64 1256}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !12, i64 0}
!24 = !{!"png_text_struct", !12, i64 0, !9, i64 8, !9, i64 16, !10, i64 24}
!25 = !{!24, !9, i64 8}
!26 = !{!24, !9, i64 16}
!27 = !{!10, !10, i64 0}
!28 = !{!24, !10, i64 24}


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