; LLVM IR from mkazhdan/DMG :: Util/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, 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 }
%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 }

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

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

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

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

20:                                               ; preds = %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.png_struct_def, ptr %22, i32 0, i32 43
  %24 = getelementptr inbounds [5 x i8], ptr %23, i64 0, i64 0
  %25 = call i32 @png_handle_as_unknown(ptr noundef %21, ptr noundef %24)
  %26 = icmp ne i32 %25, 3
  br i1 %26, label %27, label %34

27:                                               ; preds = %20
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 111
  %30 = load ptr, ptr %29, align 8, !tbaa !12
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %33, ptr noundef @.str.16)
  br label %34

34:                                               ; preds = %32, %27, %20
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %35, ptr %5, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %34, %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 i64, ptr %38, align 8, !tbaa !22
  %40 = and i64 %39, 32768
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %135

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

60:                                               ; preds = %42
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 134
  %63 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %62, i32 0, i32 1
  store ptr null, ptr %63, align 8, !tbaa !24
  br label %77

64:                                               ; preds = %42
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i64, ptr %6, align 8, !tbaa !9
  %67 = call ptr @png_malloc(ptr noundef %65, i64 noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 134
  %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 134
  %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 i64, ptr %6, align 8, !tbaa !9
  call void @png_crc_read(ptr noundef %71, ptr noundef %75, i64 noundef %76)
  br label %77

77:                                               ; preds = %64, %60
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.png_struct_def, ptr %78, i32 0, i32 111
  %80 = load ptr, ptr %79, align 8, !tbaa !12
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %121

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

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

94:                                               ; preds = %92, %82
  %95 = load i32, ptr %8, align 4, !tbaa !25
  %96 = icmp eq i32 %95, 0
  br i1 %96, label %97, label %120

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

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

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

114:                                              ; preds = %112, %105
  br label %115

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

120:                                              ; preds = %115, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %126

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

126:                                              ; preds = %121, %120
  %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 134
  %130 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %129, i32 0, i32 1
  %131 = load ptr, ptr %130, align 8, !tbaa !24
  call void @png_free(ptr noundef %127, ptr noundef %131)
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_struct_def, ptr %132, i32 0, i32 134
  %134 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %133, i32 0, i32 1
  store ptr null, ptr %134, align 8, !tbaa !24
  br label %137

135:                                              ; preds = %36
  %136 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %136, ptr %7, align 8, !tbaa !9
  br label %137

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

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

; 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) #3

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

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

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

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

declare void @png_set_unknown_chunks(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 1056}
!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, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !14, i64 304, !6, i64 416, !10, i64 424, !15, i64 432, !15, i64 436, !15, i64 440, !15, i64 444, !15, 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, !16, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !17, i64 616, !17, 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, !17, i64 638, !7, i64 640, !18, i64 644, !19, i64 648, !19, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !15, i64 696, !18, i64 700, !18, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !20, i64 760, !20, i64 765, !6, i64 776, !19, 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, !15, i64 920, !15, 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, !15, i64 1064, !6, i64 1072, !7, i64 1080, !17, i64 1082, !17, i64 1084, !17, 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, !21, i64 1208, !10, i64 1240, !10, i64 1248}
!14 = !{!"z_stream_s", !6, i64 0, !15, i64 8, !10, i64 16, !6, i64 24, !15, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !15, i64 88, !10, i64 96, !10, i64 104}
!15 = !{!"int", !7, i64 0}
!16 = !{!"png_row_info_struct", !10, i64 0, !10, 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, !10, i64 16, !7, i64 24}
!22 = !{!13, !10, i64 288}
!23 = !{!13, !10, i64 1224}
!24 = !{!13, !6, i64 1216}
!25 = !{!15, !15, i64 0}


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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_push_handle_unknown(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 620
  tail call void @png_check_chunk_name(ptr noundef %0, ptr noundef nonnull %4) #3
  %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
  %.not46 = icmp eq i32 %8, 3
  br i1 %.not46, label %14, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 1056
  %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.16) #3
  br label %14

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

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %0, i64 1208
  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 1212
  store i8 0, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 1224
  store i64 %2, ptr %21, align 8, !tbaa !21
  %22 = icmp eq i64 %2, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %18
  %24 = getelementptr inbounds i8, ptr %0, i64 1216
  store ptr null, ptr %24, align 8, !tbaa !22
  br label %28

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

28:                                               ; preds = %25, %23
  %29 = getelementptr inbounds i8, ptr %0, i64 1056
  %30 = load ptr, ptr %29, align 8, !tbaa !8
  %.not48 = icmp eq ptr %30, null
  br i1 %.not48, label %43, label %31

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

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

34:                                               ; preds = %31
  %35 = icmp eq i32 %32, 0
  br i1 %35, label %36, label %44

36:                                               ; preds = %34
  %37 = load i8, ptr %4, align 4, !tbaa !5
  %38 = and i8 %37, 32
  %.not49 = icmp eq i8 %38, 0
  br i1 %.not49, label %39, label %42

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

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

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

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

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

47:                                               ; preds = %14, %44
  %.044 = phi i64 [ 0, %44 ], [ %2, %14 ]
  tail call void @png_push_crc_skip(ptr noundef nonnull %0, i64 noundef %.044)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @png_push_crc_skip(ptr noundef, i64 noundef) local_unnamed_addr #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) #2

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

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

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

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

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

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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 1056}
!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, !6, i64 272, !6, i64 273, !11, i64 280, !11, i64 288, !11, i64 296, !12, i64 304, !10, i64 416, !11, i64 424, !13, i64 432, !13, i64 436, !13, i64 440, !13, i64 444, !13, i64 448, !11, i64 456, !11, i64 464, !11, i64 472, !11, i64 480, !11, i64 488, !11, i64 496, !11, i64 504, !11, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !14, i64 568, !11, i64 592, !11, i64 600, !10, i64 608, !15, i64 616, !15, i64 618, !6, i64 620, !6, i64 625, !6, i64 626, !6, i64 627, !6, i64 628, !6, i64 629, !6, i64 630, !6, i64 631, !6, i64 632, !6, i64 633, !6, i64 634, !6, i64 635, !6, i64 636, !15, i64 638, !6, i64 640, !16, i64 644, !17, i64 648, !17, i64 658, !10, i64 672, !11, i64 680, !11, i64 688, !13, i64 696, !16, i64 700, !16, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !18, i64 760, !18, i64 765, !10, i64 776, !17, i64 784, !10, i64 800, !10, i64 808, !10, i64 816, !10, i64 824, !10, i64 832, !10, i64 840, !10, i64 848, !10, i64 856, !10, i64 864, !11, i64 872, !11, i64 880, !11, i64 888, !11, i64 896, !11, i64 904, !11, i64 912, !13, i64 920, !13, i64 924, !11, i64 928, !11, i64 936, !10, i64 944, !10, i64 952, !10, i64 960, !10, i64 968, !10, i64 976, !6, i64 984, !6, i64 985, !10, i64 992, !10, i64 1000, !10, i64 1008, !10, i64 1016, !10, i64 1024, !10, i64 1032, !11, i64 1040, !10, i64 1048, !10, i64 1056, !13, i64 1064, !10, i64 1072, !6, i64 1080, !15, i64 1082, !15, i64 1084, !15, i64 1086, !11, i64 1088, !11, i64 1096, !6, i64 1104, !6, i64 1105, !11, i64 1112, !11, i64 1120, !10, i64 1128, !10, i64 1136, !10, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !10, i64 1176, !6, i64 1184, !11, i64 1192, !11, i64 1200, !19, i64 1208, !11, i64 1240, !11, i64 1248}
!10 = !{!"any pointer", !6, i64 0}
!11 = !{!"long", !6, i64 0}
!12 = !{!"z_stream_s", !10, i64 0, !13, i64 8, !11, i64 16, !10, i64 24, !13, i64 32, !11, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !13, i64 88, !11, i64 96, !11, i64 104}
!13 = !{!"int", !6, i64 0}
!14 = !{!"png_row_info_struct", !11, i64 0, !11, 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, !11, i64 16, !6, i64 24}
!20 = !{!9, !11, i64 288}
!21 = !{!9, !11, i64 1224}
!22 = !{!9, !10, i64 1216}


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