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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i32, i32, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, float, float, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, ptr, i8, i16, i16, i16, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, %struct.png_unknown_chunk_t, i32, i32, ptr, i32 }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_row_info_struct = type { i32, i64, i8, i8, i8, i8 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }

@.str.127 = external hidden unnamed_addr constant [42 x i8], align 1
@__const.png_handle_unknown.png_IDAT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [20 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
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_chunk_error(ptr noundef, ptr noundef) #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_unknown(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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [5 x i8], align 1
  %10 = 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 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.png_struct_def, ptr %11, i32 0, i32 132
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %36

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

20:                                               ; preds = %15
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = call i32 @png_crc_finish(ptr noundef %21, i32 noundef %22)
  store i32 1, ptr %8, align 4
  br label %192

24:                                               ; preds = %15
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 132
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = add i32 %27, -1
  store i32 %28, ptr %26, align 4, !tbaa !11
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %35

30:                                               ; preds = %24
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %31, ptr noundef @.str.127)
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = call i32 @png_crc_finish(ptr noundef %32, i32 noundef %33)
  store i32 1, ptr %8, align 4
  br label %192

35:                                               ; preds = %24
  br label %36

36:                                               ; preds = %35, %3
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.png_struct_def, ptr %37, i32 0, i32 13
  %39 = load i32, ptr %38, align 4, !tbaa !21
  %40 = and i32 %39, 4
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %55

42:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 5, ptr %9) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 @__const.png_handle_unknown.png_IDAT, i64 5, i1 false)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.png_struct_def, ptr %43, i32 0, i32 44
  %45 = getelementptr inbounds [5 x i8], ptr %44, i64 0, i64 0
  %46 = getelementptr inbounds [5 x i8], ptr %9, i64 0, i64 0
  %47 = call i32 @memcmp(ptr noundef %45, ptr noundef %46, i64 noundef 4) #6
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %54

49:                                               ; preds = %42
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.png_struct_def, ptr %50, i32 0, i32 13
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = or i32 %52, 8
  store i32 %53, ptr %51, align 4, !tbaa !21
  br label %54

54:                                               ; preds = %49, %42
  call void @llvm.lifetime.end.p0(i64 5, ptr %9) #5
  br label %55

55:                                               ; preds = %54, %36
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.png_struct_def, ptr %56, i32 0, i32 44
  %58 = getelementptr inbounds [5 x i8], ptr %57, i64 0, i64 0
  %59 = load i8, ptr %58, align 4, !tbaa !22
  %60 = zext i8 %59 to i32
  %61 = and i32 %60, 32
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %78, label %63

63:                                               ; preds = %55
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_struct_def, ptr %65, i32 0, i32 44
  %67 = getelementptr inbounds [5 x i8], ptr %66, i64 0, i64 0
  %68 = call i32 @png_handle_as_unknown(ptr noundef %64, ptr noundef %67)
  %69 = icmp ne i32 %68, 3
  br i1 %69, label %70, label %77

70:                                               ; preds = %63
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.png_struct_def, ptr %71, i32 0, i32 112
  %73 = load ptr, ptr %72, align 8, !tbaa !23
  %74 = icmp eq ptr %73, null
  br i1 %74, label %75, label %77

75:                                               ; preds = %70
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %76, ptr noundef @.str.128)
  br label %77

77:                                               ; preds = %75, %70, %63
  br label %78

78:                                               ; preds = %77, %55
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.png_struct_def, ptr %79, i32 0, i32 14
  %81 = load i32, ptr %80, align 8, !tbaa !24
  %82 = zext i32 %81 to i64
  %83 = and i64 %82, 32768
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %90, label %85

85:                                               ; preds = %78
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.png_struct_def, ptr %86, i32 0, i32 112
  %88 = load ptr, ptr %87, align 8, !tbaa !23
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %186

90:                                               ; preds = %85, %78
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.png_struct_def, ptr %91, i32 0, i32 133
  %93 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %92, i32 0, i32 0
  %94 = getelementptr inbounds [5 x i8], ptr %93, i64 0, i64 0
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.png_struct_def, ptr %95, i32 0, i32 44
  %97 = getelementptr inbounds [5 x i8], ptr %96, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %94, ptr align 4 %97, i64 5, i1 false)
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.png_struct_def, ptr %98, i32 0, i32 133
  %100 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %99, i32 0, i32 0
  %101 = getelementptr inbounds [5 x i8], ptr %100, i64 0, i64 4
  store i8 0, ptr %101, align 4, !tbaa !22
  %102 = load i32, ptr %6, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_struct_def, ptr %104, i32 0, i32 133
  %106 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %105, i32 0, i32 2
  store i64 %103, ptr %106, align 8, !tbaa !25
  %107 = load i32, ptr %6, align 4, !tbaa !9
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %113

109:                                              ; preds = %90
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.png_struct_def, ptr %110, i32 0, i32 133
  %112 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %111, i32 0, i32 1
  store ptr null, ptr %112, align 8, !tbaa !26
  br label %128

113:                                              ; preds = %90
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !9
  %116 = zext i32 %115 to i64
  %117 = call ptr @png_malloc(ptr noundef %114, i64 noundef %116)
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.png_struct_def, ptr %118, i32 0, i32 133
  %120 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %119, i32 0, i32 1
  store ptr %117, ptr %120, align 8, !tbaa !26
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.png_struct_def, ptr %122, i32 0, i32 133
  %124 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %123, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !26
  %126 = load i32, ptr %6, align 4, !tbaa !9
  %127 = zext i32 %126 to i64
  call void @png_crc_read(ptr noundef %121, ptr noundef %125, i64 noundef %127)
  br label %128

128:                                              ; preds = %113, %109
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.png_struct_def, ptr %129, i32 0, i32 112
  %131 = load ptr, ptr %130, align 8, !tbaa !23
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %172

133:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.png_struct_def, ptr %134, i32 0, i32 112
  %136 = load ptr, ptr %135, align 8, !tbaa !23
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.png_struct_def, ptr %138, i32 0, i32 133
  %140 = call i32 %136(ptr noundef %137, ptr noundef %139)
  store i32 %140, ptr %10, align 4, !tbaa !9
  %141 = load i32, ptr %10, align 4, !tbaa !9
  %142 = icmp slt i32 %141, 0
  br i1 %142, label %143, label %145

143:                                              ; preds = %133
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %144, ptr noundef @.str.129)
  br label %145

145:                                              ; preds = %143, %133
  %146 = load i32, ptr %10, align 4, !tbaa !9
  %147 = icmp eq i32 %146, 0
  br i1 %147, label %148, label %171

148:                                              ; preds = %145
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.png_struct_def, ptr %149, i32 0, i32 44
  %151 = getelementptr inbounds [5 x i8], ptr %150, i64 0, i64 0
  %152 = load i8, ptr %151, align 4, !tbaa !22
  %153 = zext i8 %152 to i32
  %154 = and i32 %153, 32
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %166, label %156

156:                                              ; preds = %148
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.png_struct_def, ptr %158, i32 0, i32 44
  %160 = getelementptr inbounds [5 x i8], ptr %159, i64 0, i64 0
  %161 = call i32 @png_handle_as_unknown(ptr noundef %157, ptr noundef %160)
  %162 = icmp ne i32 %161, 3
  br i1 %162, label %163, label %165

163:                                              ; preds = %156
  %164 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %164, ptr noundef @.str.128)
  br label %165

165:                                              ; preds = %163, %156
  br label %166

166:                                              ; preds = %165, %148
  %167 = load ptr, ptr %4, align 8, !tbaa !5
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.png_struct_def, ptr %169, i32 0, i32 133
  call void @png_set_unknown_chunks(ptr noundef %167, ptr noundef %168, ptr noundef %170, i32 noundef 1)
  br label %171

171:                                              ; preds = %166, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %177

172:                                              ; preds = %128
  %173 = load ptr, ptr %4, align 8, !tbaa !5
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.png_struct_def, ptr %175, i32 0, i32 133
  call void @png_set_unknown_chunks(ptr noundef %173, ptr noundef %174, ptr noundef %176, i32 noundef 1)
  br label %177

177:                                              ; preds = %172, %171
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.png_struct_def, ptr %179, i32 0, i32 133
  %181 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %180, i32 0, i32 1
  %182 = load ptr, ptr %181, align 8, !tbaa !26
  call void @png_free(ptr noundef %178, ptr noundef %182)
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.png_struct_def, ptr %183, i32 0, i32 133
  %185 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %184, i32 0, i32 1
  store ptr null, ptr %185, align 8, !tbaa !26
  br label %188

186:                                              ; preds = %85
  %187 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %187, ptr %7, align 4, !tbaa !9
  br label %188

188:                                              ; preds = %186, %177
  %189 = load ptr, ptr %4, align 8, !tbaa !5
  %190 = load i32, ptr %7, align 4, !tbaa !9
  %191 = call i32 @png_crc_finish(ptr noundef %189, i32 noundef %190)
  store i32 0, ptr %8, align 4
  br label %192

192:                                              ; preds = %188, %30, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %193 = load i32, ptr %8, align 4
  switch i32 %193, label %195 [
    i32 0, label %194
    i32 1, label %194
  ]

194:                                              ; preds = %192, %192
  ret void

195:                                              ; preds = %192
  unreachable
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #4

declare i32 @png_handle_as_unknown(ptr noundef, ptr noundef) #3

declare void @png_set_unknown_chunks(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind 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 #5 = { nounwind }
attributes #6 = { 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 = !{!7, !7, i64 0}
!23 = !{!12, !6, i64 1000}
!24 = !{!12, !10, i64 288}
!25 = !{!12, !14, i64 1136}
!26 = !{!12, !6, i64 1128}


; 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.127 = external hidden unnamed_addr constant [42 x i8], align 1
@__const.png_handle_unknown.png_IDAT = external hidden unnamed_addr constant [5 x i8], align 1
@.str.128 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.129 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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_chunk_error(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_unknown(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 %6 [
    i32 0, label %10
    i32 1, label %66
  ]

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

9:                                                ; preds = %6
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.127) #4
  br label %66

10:                                               ; preds = %3, %6
  %11 = getelementptr inbounds i8, ptr %0, i64 284
  %12 = load i32, ptr %11, align 4, !tbaa !19
  %13 = and i32 %12, 4
  %.not55 = icmp eq i32 %13, 0
  br i1 %.not55, label %18, label %14

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 580
  %bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(4) %15, ptr noundef nonnull dereferenceable(4) @__const.png_handle_unknown.png_IDAT, i64 4)
  %.not56 = icmp eq i32 %bcmp, 0
  br i1 %.not56, label %18, label %16

16:                                               ; preds = %14
  %17 = or i32 %12, 8
  store i32 %17, ptr %11, align 4, !tbaa !19
  br label %18

18:                                               ; preds = %14, %16, %10
  %19 = getelementptr inbounds i8, ptr %0, i64 580
  %20 = load i8, ptr %19, align 4, !tbaa !20
  %21 = and i8 %20, 32
  %.not57 = icmp eq i8 %21, 0
  br i1 %.not57, label %22, label %29

22:                                               ; preds = %18
  %23 = tail call i32 @png_handle_as_unknown(ptr noundef nonnull %0, ptr noundef nonnull %19) #4
  %.not58 = icmp eq i32 %23, 3
  br i1 %.not58, label %29, label %24

24:                                               ; preds = %22
  %25 = getelementptr inbounds i8, ptr %0, i64 1000
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %24
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.128) #4
  br label %29

29:                                               ; preds = %22, %24, %28, %18
  %30 = getelementptr inbounds i8, ptr %0, i64 288
  %31 = load i32, ptr %30, align 8, !tbaa !22
  %32 = and i32 %31, 32768
  %.not59 = icmp eq i32 %32, 0
  br i1 %.not59, label %33, label %36

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 1000
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %.not60 = icmp eq ptr %35, null
  br i1 %.not60, label %66, label %36

36:                                               ; preds = %33, %29
  %37 = getelementptr inbounds i8, ptr %0, i64 1120
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(5) %37, ptr noundef nonnull align 4 dereferenceable(5) %19, i64 5, i1 false)
  %38 = getelementptr inbounds i8, ptr %0, i64 1124
  store i8 0, ptr %38, align 4, !tbaa !20
  %39 = zext i32 %2 to i64
  %40 = getelementptr inbounds i8, ptr %0, i64 1136
  store i64 %39, ptr %40, align 8, !tbaa !23
  %41 = icmp eq i32 %2, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %36
  %43 = getelementptr inbounds i8, ptr %0, i64 1128
  store ptr null, ptr %43, align 8, !tbaa !24
  br label %47

44:                                               ; preds = %36
  %45 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %39) #4
  %46 = getelementptr inbounds i8, ptr %0, i64 1128
  store ptr %45, ptr %46, align 8, !tbaa !24
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %45, i64 noundef %39)
  br label %47

47:                                               ; preds = %44, %42
  %48 = getelementptr inbounds i8, ptr %0, i64 1000
  %49 = load ptr, ptr %48, align 8, !tbaa !21
  %.not61 = icmp eq ptr %49, null
  br i1 %.not61, label %62, label %50

50:                                               ; preds = %47
  %51 = tail call i32 %49(ptr noundef nonnull %0, ptr noundef nonnull %37) #4
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %.thread, label %53

.thread:                                          ; preds = %50
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.129) #4
  br label %63

53:                                               ; preds = %50
  %54 = icmp eq i32 %51, 0
  br i1 %54, label %55, label %63

55:                                               ; preds = %53
  %56 = load i8, ptr %19, align 4, !tbaa !20
  %57 = and i8 %56, 32
  %.not62 = icmp eq i8 %57, 0
  br i1 %.not62, label %58, label %61

58:                                               ; preds = %55
  %59 = tail call i32 @png_handle_as_unknown(ptr noundef nonnull %0, ptr noundef nonnull %19) #4
  %.not63 = icmp eq i32 %59, 3
  br i1 %.not63, label %61, label %60

60:                                               ; preds = %58
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.128) #4
  br label %61

61:                                               ; preds = %58, %60, %55
  tail call void @png_set_unknown_chunks(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %37, i32 noundef 1) #4
  br label %63

62:                                               ; preds = %47
  tail call void @png_set_unknown_chunks(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %37, i32 noundef 1) #4
  br label %63

63:                                               ; preds = %.thread, %53, %61, %62
  %64 = getelementptr inbounds i8, ptr %0, i64 1128
  %65 = load ptr, ptr %64, align 8, !tbaa !24
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %65) #4
  store ptr null, ptr %64, align 8, !tbaa !24
  br label %66

66:                                               ; preds = %63, %33, %3, %9
  %.0.sink = phi i32 [ %2, %9 ], [ %2, %3 ], [ 0, %63 ], [ %2, %33 ]
  %67 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %.0.sink)
  ret void
}

declare i32 @png_handle_as_unknown(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @png_set_unknown_chunks(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #3

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !10, i64 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 = !{!7, !7, i64 0}
!21 = !{!6, !9, i64 1000}
!22 = !{!6, !10, i64 288}
!23 = !{!6, !12, i64 1136}
!24 = !{!6, !9, i64 1128}


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