; 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 }
%struct.png_text_struct = type { i32, ptr, ptr, i64, i64, ptr, ptr }

@.str.108 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [42 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, i32 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

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

18:                                               ; preds = %3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.png_struct_def, ptr %19, i32 0, i32 132
  %21 = load i32, ptr %20, align 4, !tbaa !11
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %27

23:                                               ; preds = %18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = call i32 @png_crc_finish(ptr noundef %24, i32 noundef %25)
  store i32 1, ptr %13, align 4
  br label %169

27:                                               ; preds = %18
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 132
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = add i32 %30, -1
  store i32 %31, ptr %29, align 4, !tbaa !11
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %38

33:                                               ; preds = %27
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %34, ptr noundef @.str.108)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = call i32 @png_crc_finish(ptr noundef %35, i32 noundef %36)
  store i32 1, ptr %13, align 4
  br label %169

38:                                               ; preds = %27
  br label %39

39:                                               ; preds = %38, %3
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.png_struct_def, ptr %40, i32 0, i32 13
  %42 = load i32, ptr %41, align 4, !tbaa !21
  %43 = and i32 %42, 1
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %47, label %45

45:                                               ; preds = %39
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %46, ptr noundef @.str.109)
  br label %47

47:                                               ; preds = %45, %39
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.png_struct_def, ptr %48, i32 0, i32 13
  %50 = load i32, ptr %49, align 4, !tbaa !21
  %51 = and i32 %50, 4
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %58

53:                                               ; preds = %47
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.png_struct_def, ptr %54, i32 0, i32 13
  %56 = load i32, ptr %55, align 4, !tbaa !21
  %57 = or i32 %56, 8
  store i32 %57, ptr %55, align 4, !tbaa !21
  br label %58

58:                                               ; preds = %53, %47
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.png_struct_def, ptr %60, i32 0, i32 136
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  call void @png_free(ptr noundef %59, ptr noundef %62)
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = add i32 %64, 1
  %66 = zext i32 %65 to i64
  %67 = call ptr @png_malloc_warn(ptr noundef %63, i64 noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 136
  store ptr %67, ptr %69, align 8, !tbaa !22
  %70 = load ptr, ptr %4, 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 !22
  %73 = icmp eq ptr %72, null
  br i1 %73, label %74, label %76

74:                                               ; preds = %58
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %75, ptr noundef @.str.110)
  store i32 1, ptr %13, align 4
  br label %169

76:                                               ; preds = %58
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = zext i32 %77 to i64
  store i64 %78, ptr %11, align 8, !tbaa !23
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.png_struct_def, ptr %80, i32 0, i32 136
  %82 = load ptr, ptr %81, align 8, !tbaa !22
  %83 = load i64, ptr %11, align 8, !tbaa !23
  call void @png_crc_read(ptr noundef %79, ptr noundef %82, i64 noundef %83)
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = load i32, ptr %10, align 4, !tbaa !9
  %86 = call i32 @png_crc_finish(ptr noundef %84, i32 noundef %85)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %95

88:                                               ; preds = %76
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_struct_def, ptr %90, i32 0, i32 136
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  call void @png_free(ptr noundef %89, ptr noundef %92)
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_struct_def, ptr %93, i32 0, i32 136
  store ptr null, ptr %94, align 8, !tbaa !22
  store i32 1, ptr %13, align 4
  br label %169

95:                                               ; preds = %76
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 136
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  store ptr %98, ptr %8, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = load i64, ptr %11, align 8, !tbaa !23
  %101 = getelementptr inbounds i8, ptr %99, i64 %100
  store i8 0, ptr %101, align 1, !tbaa !24
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %102, ptr %9, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %108, %95
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = load i8, ptr %104, align 1, !tbaa !24
  %106 = icmp ne i8 %105, 0
  br i1 %106, label %107, label %111

107:                                              ; preds = %103
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds i8, ptr %109, i32 1
  store ptr %110, ptr %9, align 8, !tbaa !5
  br label %103, !llvm.loop !25

111:                                              ; preds = %103
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = load i64, ptr %11, align 8, !tbaa !23
  %115 = getelementptr inbounds i8, ptr %113, i64 %114
  %116 = icmp ne ptr %112, %115
  br i1 %116, label %117, label %120

117:                                              ; preds = %111
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  %119 = getelementptr inbounds i8, ptr %118, i32 1
  store ptr %119, ptr %9, align 8, !tbaa !5
  br label %120

120:                                              ; preds = %117, %111
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = call ptr @png_malloc_warn(ptr noundef %121, i64 noundef 56)
  store ptr %122, ptr %7, align 8, !tbaa !5
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = icmp eq ptr %123, null
  br i1 %124, label %125, label %133

125:                                              ; preds = %120
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %126, ptr noundef @.str.111)
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.png_struct_def, ptr %128, i32 0, i32 136
  %130 = load ptr, ptr %129, align 8, !tbaa !22
  call void @png_free(ptr noundef %127, ptr noundef %130)
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.png_struct_def, ptr %131, i32 0, i32 136
  store ptr null, ptr %132, align 8, !tbaa !22
  store i32 1, ptr %13, align 4
  br label %169

133:                                              ; preds = %120
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.png_text_struct, ptr %134, i32 0, i32 0
  store i32 -1, ptr %135, align 8, !tbaa !27
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.png_text_struct, ptr %137, i32 0, i32 1
  store ptr %136, ptr %138, align 8, !tbaa !29
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.png_text_struct, ptr %139, i32 0, i32 5
  store ptr null, ptr %140, align 8, !tbaa !30
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_text_struct, ptr %141, i32 0, i32 6
  store ptr null, ptr %142, align 8, !tbaa !31
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.png_text_struct, ptr %143, i32 0, i32 4
  store i64 0, ptr %144, align 8, !tbaa !32
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.png_text_struct, ptr %146, i32 0, i32 2
  store ptr %145, ptr %147, align 8, !tbaa !33
  %148 = load ptr, ptr %9, align 8, !tbaa !5
  %149 = call i64 @strlen(ptr noundef %148) #5
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.png_text_struct, ptr %150, i32 0, i32 3
  store i64 %149, ptr %151, align 8, !tbaa !34
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load ptr, ptr %5, align 8, !tbaa !5
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = call i32 @png_set_text_2(ptr noundef %152, ptr noundef %153, ptr noundef %154, i32 noundef 1)
  store i32 %155, ptr %12, align 4, !tbaa !9
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.png_struct_def, ptr %157, i32 0, i32 136
  %159 = load ptr, ptr %158, align 8, !tbaa !22
  call void @png_free(ptr noundef %156, ptr noundef %159)
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.png_struct_def, ptr %160, i32 0, i32 136
  store ptr null, ptr %161, align 8, !tbaa !22
  %162 = load ptr, ptr %4, align 8, !tbaa !5
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %162, ptr noundef %163)
  %164 = load i32, ptr %12, align 4, !tbaa !9
  %165 = icmp ne i32 %164, 0
  br i1 %165, label %166, label %168

166:                                              ; preds = %133
  %167 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %167, ptr noundef @.str.112)
  br label %168

168:                                              ; preds = %166, %133
  store i32 0, ptr %13, align 4
  br label %169

169:                                              ; preds = %168, %125, %88, %74, %33, %23
  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 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %170 = load i32, ptr %13, align 4
  switch i32 %170, label %172 [
    i32 0, label %171
    i32 1, label %171
  ]

171:                                              ; preds = %169, %169
  ret void

172:                                              ; preds = %169
  unreachable
}

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

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

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 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1116}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !10, i64 288, !10, i64 292, !13, i64 296, !6, i64 408, !14, i64 416, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !14, i64 464, !14, i64 472, !10, i64 480, !10, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !15, i64 536, !10, i64 560, !10, i64 564, !6, i64 568, !16, i64 576, !16, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !16, i64 598, !7, i64 600, !17, i64 604, !18, i64 608, !18, i64 618, !6, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !17, i64 652, !17, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !19, i64 712, !19, i64 717, !6, i64 728, !18, i64 736, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !10, i64 824, !10, i64 828, !14, i64 832, !14, i64 840, !14, i64 848, !14, i64 856, !10, i64 864, !10, i64 868, !14, i64 872, !14, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !7, i64 929, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !10, i64 984, !6, i64 992, !6, i64 1000, !10, i64 1008, !6, i64 1016, !7, i64 1024, !16, i64 1026, !16, i64 1028, !16, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !20, i64 1120, !10, i64 1152, !10, i64 1156, !6, i64 1160, !10, i64 1168}
!13 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !14, i64 16, !6, i64 24, !10, i64 32, !14, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !14, i64 96, !14, i64 104}
!14 = !{!"long", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !14, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"png_color_16_struct", !7, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !14, i64 16, !7, i64 24}
!21 = !{!12, !10, i64 284}
!22 = !{!12, !6, i64 1160}
!23 = !{!14, !14, i64 0}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!28, !10, i64 0}
!28 = !{!"png_text_struct", !10, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 32, !6, i64 40, !6, i64 48}
!29 = !{!28, !6, i64 8}
!30 = !{!28, !6, i64 40}
!31 = !{!28, !6, i64 48}
!32 = !{!28, !14, i64 32}
!33 = !{!28, !6, i64 16}
!34 = !{!28, !14, 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.108 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.109 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.111 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.112 = external hidden unnamed_addr constant [42 x i8], align 1

declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_tEXt(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 1116
  %5 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %5, label %8 [
    i32 0, label %13
    i32 1, label %6
  ]

6:                                                ; preds = %3
  %7 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %55

8:                                                ; preds = %3
  %9 = add i32 %5, -1
  store i32 %9, ptr %4, align 4, !tbaa !5
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %11, label %13

11:                                               ; preds = %8
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.108) #4
  %12 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %55

13:                                               ; preds = %3, %8
  %14 = getelementptr inbounds i8, ptr %0, i64 284
  %15 = load i32, ptr %14, align 4, !tbaa !19
  %16 = and i32 %15, 1
  %.not66 = icmp eq i32 %16, 0
  br i1 %.not66, label %17, label %18

17:                                               ; preds = %13
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.109) #4
  %.pre = load i32, ptr %14, align 4, !tbaa !19
  br label %18

18:                                               ; preds = %17, %13
  %19 = phi i32 [ %.pre, %17 ], [ %15, %13 ]
  %20 = and i32 %19, 4
  %.not67 = icmp eq i32 %20, 0
  br i1 %.not67, label %23, label %21

21:                                               ; preds = %18
  %22 = or i32 %19, 8
  store i32 %22, ptr %14, align 4, !tbaa !19
  br label %23

23:                                               ; preds = %21, %18
  %24 = getelementptr inbounds i8, ptr %0, i64 1160
  %25 = load ptr, ptr %24, align 8, !tbaa !20
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %25) #4
  %26 = add i32 %2, 1
  %27 = zext i32 %26 to i64
  %28 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %27) #4
  store ptr %28, ptr %24, align 8, !tbaa !20
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %23
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.110) #4
  br label %55

31:                                               ; preds = %23
  %32 = zext i32 %2 to i64
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %28, i64 noundef %32)
  %33 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not68 = icmp eq i32 %33, 0
  %34 = load ptr, ptr %24, align 8, !tbaa !20
  br i1 %.not68, label %36, label %35

35:                                               ; preds = %31
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %34) #4
  store ptr null, ptr %24, align 8, !tbaa !20
  br label %55

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %34, i64 %32
  store i8 0, ptr %37, align 1, !tbaa !21
  br label %38

38:                                               ; preds = %38, %36
  %.0 = phi ptr [ %34, %36 ], [ %40, %38 ]
  %39 = load i8, ptr %.0, align 1, !tbaa !21
  %.not69 = icmp eq i8 %39, 0
  %40 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not69, label %41, label %38, !llvm.loop !22

41:                                               ; preds = %38
  %42 = tail call ptr @png_malloc_warn(ptr noundef %0, i64 noundef 56) #4
  %43 = icmp eq ptr %42, null
  br i1 %43, label %44, label %46

44:                                               ; preds = %41
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.111) #4
  %45 = load ptr, ptr %24, align 8, !tbaa !20
  tail call void @png_free(ptr noundef %0, ptr noundef %45) #4
  store ptr null, ptr %24, align 8, !tbaa !20
  br label %55

46:                                               ; preds = %41
  %.not70 = icmp ne ptr %.0, %37
  %spec.select.idx = zext i1 %.not70 to i64
  %spec.select = getelementptr inbounds i8, ptr %.0, i64 %spec.select.idx
  store i32 -1, ptr %42, align 8, !tbaa !24
  %47 = getelementptr inbounds i8, ptr %42, i64 8
  store ptr %34, ptr %47, align 8, !tbaa !26
  %48 = getelementptr inbounds i8, ptr %42, i64 32
  %49 = getelementptr inbounds i8, ptr %42, i64 16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %48, i8 0, i64 24, i1 false)
  store ptr %spec.select, ptr %49, align 8, !tbaa !27
  %50 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %spec.select) #5
  %51 = getelementptr inbounds i8, ptr %42, i64 24
  store i64 %50, ptr %51, align 8, !tbaa !28
  %52 = tail call i32 @png_set_text_2(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %42, i32 noundef 1) #4
  %53 = load ptr, ptr %24, align 8, !tbaa !20
  tail call void @png_free(ptr noundef %0, ptr noundef %53) #4
  store ptr null, ptr %24, align 8, !tbaa !20
  tail call void @png_free(ptr noundef %0, ptr noundef nonnull %42) #4
  %.not71 = icmp eq i32 %52, 0
  br i1 %.not71, label %55, label %54

54:                                               ; preds = %46
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.112) #4
  br label %55

55:                                               ; preds = %46, %54, %44, %35, %30, %11, %6
  ret void
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #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 = { 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 #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 nounwind willreturn memory(argmem: write) }
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, !10, i64 1116}
!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, !10, i64 284}
!20 = !{!6, !9, i64 1160}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!25, !10, i64 0}
!25 = !{!"png_text_struct", !10, i64 0, !9, i64 8, !9, i64 16, !12, i64 24, !12, i64 32, !9, i64 40, !9, i64 48}
!26 = !{!25, !9, i64 8}
!27 = !{!25, !9, i64 16}
!28 = !{!25, !12, i64 24}


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