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

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

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

@.str.20 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.21 = 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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_push_handle_unknown(ptr noundef %0, ptr noundef %1, i32 noundef %2) #3 {
  %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
  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) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.png_struct_def, ptr %9, i32 0, i32 44
  %11 = getelementptr inbounds [5 x i8], ptr %10, i64 0, i64 0
  %12 = load i8, ptr %11, align 4, !tbaa !11
  %13 = zext i8 %12 to i32
  %14 = and i32 %13, 32
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %33, label %16

16:                                               ; preds = %3
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 44
  %20 = getelementptr inbounds [5 x i8], ptr %19, i64 0, i64 0
  %21 = call i32 @png_handle_as_unknown(ptr noundef %17, ptr noundef %20)
  %22 = icmp ne i32 %21, 3
  br i1 %22, label %23, label %30

23:                                               ; preds = %16
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.png_struct_def, ptr %24, i32 0, i32 112
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %30

28:                                               ; preds = %23
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %29, ptr noundef @.str.20)
  br label %30

30:                                               ; preds = %28, %23, %16
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.png_info_struct, ptr %31, i64 0
  store ptr %32, ptr %5, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %30, %3
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.png_struct_def, ptr %34, i32 0, i32 14
  %36 = load i32, ptr %35, align 8, !tbaa !22
  %37 = zext i32 %36 to i64
  %38 = and i64 %37, 32768
  %39 = icmp ne i64 %38, 0
  br i1 %39, label %40, label %136

40:                                               ; preds = %33
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 133
  %43 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds [5 x i8], ptr %43, i64 0, i64 0
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.png_struct_def, ptr %45, i32 0, i32 44
  %47 = getelementptr inbounds [5 x i8], ptr %46, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %44, ptr align 4 %47, i64 5, i1 false)
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.png_struct_def, ptr %48, i32 0, i32 133
  %50 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [5 x i8], ptr %50, i64 0, i64 4
  store i8 0, ptr %51, align 4, !tbaa !11
  %52 = load i32, ptr %6, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.png_struct_def, ptr %54, i32 0, i32 133
  %56 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %55, i32 0, i32 2
  store i64 %53, ptr %56, align 8, !tbaa !23
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %63

59:                                               ; preds = %40
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.png_struct_def, ptr %60, i32 0, i32 133
  %62 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %61, i32 0, i32 1
  store ptr null, ptr %62, align 8, !tbaa !24
  br label %78

63:                                               ; preds = %40
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = zext i32 %65 to i64
  %67 = call ptr @png_malloc(ptr noundef %64, i64 noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 133
  %70 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %69, i32 0, i32 1
  store ptr %67, ptr %70, align 8, !tbaa !24
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.png_struct_def, ptr %72, i32 0, i32 133
  %74 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !24
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = zext i32 %76 to i64
  call void @png_crc_read(ptr noundef %71, ptr noundef %75, i64 noundef %77)
  br label %78

78:                                               ; preds = %63, %59
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.png_struct_def, ptr %79, i32 0, i32 112
  %81 = load ptr, ptr %80, align 8, !tbaa !12
  %82 = icmp ne ptr %81, null
  br i1 %82, label %83, label %122

83:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_struct_def, ptr %84, i32 0, i32 112
  %86 = load ptr, ptr %85, align 8, !tbaa !12
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.png_struct_def, ptr %88, i32 0, i32 133
  %90 = call i32 %86(ptr noundef %87, ptr noundef %89)
  store i32 %90, ptr %8, align 4, !tbaa !9
  %91 = load i32, ptr %8, align 4, !tbaa !9
  %92 = icmp slt i32 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %83
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %94, ptr noundef @.str.21)
  br label %95

95:                                               ; preds = %93, %83
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = icmp eq i32 %96, 0
  br i1 %97, label %98, label %121

98:                                               ; preds = %95
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_struct_def, ptr %99, i32 0, i32 44
  %101 = getelementptr inbounds [5 x i8], ptr %100, i64 0, i64 0
  %102 = load i8, ptr %101, align 4, !tbaa !11
  %103 = zext i8 %102 to i32
  %104 = and i32 %103, 32
  %105 = icmp ne i32 %104, 0
  br i1 %105, label %116, label %106

106:                                              ; preds = %98
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.png_struct_def, ptr %108, i32 0, i32 44
  %110 = getelementptr inbounds [5 x i8], ptr %109, i64 0, i64 0
  %111 = call i32 @png_handle_as_unknown(ptr noundef %107, ptr noundef %110)
  %112 = icmp ne i32 %111, 3
  br i1 %112, label %113, label %115

113:                                              ; preds = %106
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %114, ptr noundef @.str.20)
  br label %115

115:                                              ; preds = %113, %106
  br label %116

116:                                              ; preds = %115, %98
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.png_struct_def, ptr %119, i32 0, i32 133
  call void @png_set_unknown_chunks(ptr noundef %117, ptr noundef %118, ptr noundef %120, i32 noundef 1)
  br label %121

121:                                              ; preds = %116, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %127

122:                                              ; preds = %78
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.png_struct_def, ptr %125, i32 0, i32 133
  call void @png_set_unknown_chunks(ptr noundef %123, ptr noundef %124, ptr noundef %126, i32 noundef 1)
  br label %127

127:                                              ; preds = %122, %121
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.png_struct_def, ptr %129, i32 0, i32 133
  %131 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !24
  call void @png_free(ptr noundef %128, ptr noundef %132)
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_struct_def, ptr %133, i32 0, i32 133
  %135 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %134, i32 0, i32 1
  store ptr null, ptr %135, align 8, !tbaa !24
  br label %138

136:                                              ; preds = %33
  %137 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %137, ptr %7, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %136, %127
  %139 = load ptr, ptr %4, align 8, !tbaa !5
  %140 = load i32, ptr %7, align 4, !tbaa !9
  call void @png_push_crc_skip(ptr noundef %139, i32 noundef %140)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_crc_skip(ptr noundef, i32 noundef) #3

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind 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 #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, !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 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 1000}
!13 = !{!"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, !14, i64 296, !6, i64 408, !15, 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, !15, i64 464, !15, i64 472, !10, i64 480, !10, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !16, i64 536, !10, i64 560, !10, i64 564, !6, i64 568, !17, i64 576, !17, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !17, i64 598, !7, i64 600, !18, i64 604, !19, i64 608, !19, i64 618, !6, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !18, i64 652, !18, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !20, i64 712, !20, i64 717, !6, i64 728, !19, i64 736, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !10, i64 824, !10, i64 828, !15, i64 832, !15, i64 840, !15, i64 848, !15, i64 856, !10, i64 864, !10, i64 868, !15, i64 872, !15, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !7, i64 929, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !10, i64 984, !6, i64 992, !6, i64 1000, !10, i64 1008, !6, i64 1016, !7, i64 1024, !17, i64 1026, !17, i64 1028, !17, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !21, i64 1120, !10, i64 1152, !10, i64 1156, !6, i64 1160, !10, i64 1168}
!14 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !15, i64 16, !6, i64 24, !10, i64 32, !15, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !15, i64 96, !15, i64 104}
!15 = !{!"long", !7, i64 0}
!16 = !{!"png_row_info_struct", !10, i64 0, !15, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!17 = !{!"short", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"png_color_16_struct", !7, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !17, i64 8}
!20 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!21 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !15, i64 16, !7, i64 24}
!22 = !{!13, !10, i64 288}
!23 = !{!13, !15, i64 1136}
!24 = !{!13, !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.20 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.21 = 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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_push_handle_unknown(ptr noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 580
  %5 = load i8, ptr %4, align 4, !tbaa !5
  %6 = and i8 %5, 32
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %7, label %14

7:                                                ; preds = %3
  %8 = tail call i32 @png_handle_as_unknown(ptr noundef nonnull %0, ptr noundef nonnull %4) #3
  %.not44 = icmp eq i32 %8, 3
  br i1 %.not44, label %14, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 1000
  %11 = load ptr, ptr %10, align 8, !tbaa !8
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

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

14:                                               ; preds = %7, %9, %13, %3
  %15 = getelementptr inbounds i8, ptr %0, i64 288
  %16 = load i32, ptr %15, align 8, !tbaa !20
  %17 = and i32 %16, 32768
  %.not45 = icmp eq i32 %17, 0
  br i1 %.not45, label %48, label %18

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 1120
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(5) %19, ptr noundef nonnull align 4 dereferenceable(5) %4, i64 5, i1 false)
  %20 = getelementptr inbounds i8, ptr %0, i64 1124
  store i8 0, ptr %20, align 4, !tbaa !5
  %21 = zext i32 %2 to i64
  %22 = getelementptr inbounds i8, ptr %0, i64 1136
  store i64 %21, ptr %22, align 8, !tbaa !21
  %23 = icmp eq i32 %2, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %18
  %25 = getelementptr inbounds i8, ptr %0, i64 1128
  store ptr null, ptr %25, align 8, !tbaa !22
  br label %29

26:                                               ; preds = %18
  %27 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %21) #3
  %28 = getelementptr inbounds i8, ptr %0, i64 1128
  store ptr %27, ptr %28, align 8, !tbaa !22
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %27, i64 noundef %21) #3
  br label %29

29:                                               ; preds = %26, %24
  %30 = getelementptr inbounds i8, ptr %0, i64 1000
  %31 = load ptr, ptr %30, align 8, !tbaa !8
  %.not46 = icmp eq ptr %31, null
  br i1 %.not46, label %44, label %32

32:                                               ; preds = %29
  %33 = tail call i32 %31(ptr noundef nonnull %0, ptr noundef nonnull %19) #3
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %.thread, label %35

.thread:                                          ; preds = %32
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.21) #3
  br label %45

35:                                               ; preds = %32
  %36 = icmp eq i32 %33, 0
  br i1 %36, label %37, label %45

37:                                               ; preds = %35
  %38 = load i8, ptr %4, align 4, !tbaa !5
  %39 = and i8 %38, 32
  %.not47 = icmp eq i8 %39, 0
  br i1 %.not47, label %40, label %43

40:                                               ; preds = %37
  %41 = tail call i32 @png_handle_as_unknown(ptr noundef nonnull %0, ptr noundef nonnull %4) #3
  %.not48 = icmp eq i32 %41, 3
  br i1 %.not48, label %43, label %42

42:                                               ; preds = %40
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.20) #3
  br label %43

43:                                               ; preds = %40, %42, %37
  tail call void @png_set_unknown_chunks(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %19, i32 noundef 1) #3
  br label %45

44:                                               ; preds = %29
  tail call void @png_set_unknown_chunks(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %19, i32 noundef 1) #3
  br label %45

45:                                               ; preds = %.thread, %35, %43, %44
  %46 = getelementptr inbounds i8, ptr %0, i64 1128
  %47 = load ptr, ptr %46, align 8, !tbaa !22
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %47) #3
  store ptr null, ptr %46, align 8, !tbaa !22
  br label %48

48:                                               ; preds = %14, %45
  %.042 = phi i32 [ 0, %45 ], [ %2, %14 ]
  tail call void @png_push_crc_skip(ptr noundef nonnull %0, i32 noundef %.042)
  ret void
}

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

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

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

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

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

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


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