; LLVM IR from EyalAr/lwip :: src/lib/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, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, %struct.z_stream_s, i32, i32, i32, i32, i64, i32, i32, i32, ptr, ptr, i64, i32, i32, ptr, i16, i32, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, i32, %struct.png_color_16_struct, %struct.png_color_16_struct, i32, i32, 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, ptr, ptr, i8, [29 x i8], i32, ptr, ptr, i32, i32, ptr, i8, i8, i16, i16, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, i64, %struct.png_unknown_chunk_t, i64, ptr, i64, i32, i32, ptr, [4 x ptr], %struct.png_colorspace }
%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_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_colorspace = type { i32, %struct.png_xy, %struct.png_XYZ, i16, i16 }
%struct.png_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_XYZ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.str.30 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [25 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: nounwind uwtable
declare dso_local i32 @png_crc_finish(ptr noalias noundef, i32 noundef) #1

; Function Attrs: noreturn
declare void @png_chunk_error(ptr noundef, ptr noundef) #2

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

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

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

15:                                               ; preds = %4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load i32, ptr %7, align 4, !tbaa !9
  %18 = call i32 @png_cache_unknown_chunk(ptr noundef %16, i32 noundef %17)
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %51

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 88
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 110
  %27 = call i32 %23(ptr noundef %24, ptr noundef %26)
  store i32 %27, ptr %10, align 4, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %32

30:                                               ; preds = %20
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %31, ptr noundef @.str.34) #5
  unreachable

32:                                               ; preds = %20
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %48

35:                                               ; preds = %32
  %36 = load i32, ptr %8, align 4, !tbaa !9
  %37 = icmp slt i32 %36, 2
  br i1 %37, label %38, label %47

38:                                               ; preds = %35
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.png_struct_def, ptr %39, i32 0, i32 89
  %41 = load i32, ptr %40, align 8, !tbaa !22
  %42 = icmp slt i32 %41, 2
  br i1 %42, label %43, label %46

43:                                               ; preds = %38
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_app_warning(ptr noundef %45, ptr noundef @.str.35)
  br label %46

46:                                               ; preds = %43, %38
  store i32 2, ptr %8, align 4, !tbaa !9
  br label %47

47:                                               ; preds = %46, %35
  br label %49

48:                                               ; preds = %32
  store i32 1, ptr %9, align 4, !tbaa !9
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %48, %47
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %52

51:                                               ; preds = %15
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %51, %50
  br label %85

53:                                               ; preds = %4
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %60

56:                                               ; preds = %53
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.png_struct_def, ptr %57, i32 0, i32 89
  %59 = load i32, ptr %58, align 8, !tbaa !22
  store i32 %59, ptr %8, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %56, %53
  %61 = load i32, ptr %8, align 4, !tbaa !9
  %62 = icmp eq i32 %61, 3
  br i1 %62, label %73, label %63

63:                                               ; preds = %60
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = icmp eq i32 %64, 2
  br i1 %65, label %66, label %80

66:                                               ; preds = %63
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.png_struct_def, ptr %67, i32 0, i32 25
  %69 = load i32, ptr %68, align 8, !tbaa !23
  %70 = lshr i32 %69, 29
  %71 = and i32 1, %70
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %80

73:                                               ; preds = %66, %60
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = call i32 @png_cache_unknown_chunk(ptr noundef %74, i32 noundef %75)
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %73
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %79

79:                                               ; preds = %78, %73
  br label %84

80:                                               ; preds = %66, %63
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = call i32 @png_crc_finish(ptr noundef %81, i32 noundef %82)
  br label %84

84:                                               ; preds = %80, %79
  br label %85

85:                                               ; preds = %84, %52
  %86 = load i32, ptr %8, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 3
  br i1 %87, label %98, label %88

88:                                               ; preds = %85
  %89 = load i32, ptr %8, align 4, !tbaa !9
  %90 = icmp eq i32 %89, 2
  br i1 %90, label %91, label %117

91:                                               ; preds = %88
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.png_struct_def, ptr %92, i32 0, i32 25
  %94 = load i32, ptr %93, align 8, !tbaa !23
  %95 = lshr i32 %94, 29
  %96 = and i32 1, %95
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %117

98:                                               ; preds = %91, %85
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_struct_def, ptr %99, i32 0, i32 108
  %101 = load i32, ptr %100, align 4, !tbaa !24
  switch i32 %101, label %106 [
    i32 2, label %102
    i32 1, label %116
    i32 0, label %111
  ]

102:                                              ; preds = %98
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.png_struct_def, ptr %103, i32 0, i32 108
  store i32 1, ptr %104, align 4, !tbaa !24
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %105, ptr noundef @.str.30)
  br label %116

106:                                              ; preds = %98
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.png_struct_def, ptr %107, i32 0, i32 108
  %109 = load i32, ptr %108, align 4, !tbaa !24
  %110 = add i32 %109, -1
  store i32 %110, ptr %108, align 4, !tbaa !24
  br label %111

111:                                              ; preds = %106, %98
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_struct_def, ptr %114, i32 0, i32 110
  call void @png_set_unknown_chunks(ptr noundef %112, ptr noundef %113, ptr noundef %115, i32 noundef 1)
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %111, %102, %98
  br label %117

117:                                              ; preds = %116, %91, %88
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.png_struct_def, ptr %118, i32 0, i32 110
  %120 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !25
  %122 = icmp ne ptr %121, null
  br i1 %122, label %123, label %129

123:                                              ; preds = %117
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.png_struct_def, ptr %125, i32 0, i32 110
  %127 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %126, i32 0, i32 1
  %128 = load ptr, ptr %127, align 8, !tbaa !25
  call void @png_free(ptr noundef %124, ptr noundef %128)
  br label %129

129:                                              ; preds = %123, %117
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.png_struct_def, ptr %130, i32 0, i32 110
  %132 = getelementptr inbounds %struct.png_unknown_chunk_t, ptr %131, i32 0, i32 1
  store ptr null, ptr %132, align 8, !tbaa !25
  %133 = load i32, ptr %9, align 4, !tbaa !9
  %134 = icmp eq i32 %133, 0
  br i1 %134, label %135, label %144

135:                                              ; preds = %129
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.png_struct_def, ptr %136, i32 0, i32 25
  %138 = load i32, ptr %137, align 8, !tbaa !23
  %139 = lshr i32 %138, 29
  %140 = and i32 1, %139
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %144, label %142

142:                                              ; preds = %135
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %143, ptr noundef @.str.36) #5
  unreachable

144:                                              ; preds = %135, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @png_cache_unknown_chunk(ptr noalias noundef, i32 noundef) #1

declare void @png_app_warning(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 = { 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 = { noreturn "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 }
attributes #5 = { noreturn }

!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, !6, i64 832}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !13, 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, !10, i64 296, !14, i64 304, !10, i64 416, !10, i64 420, !10, i64 424, !10, i64 428, !13, i64 432, !10, i64 440, !10, i64 444, !10, i64 448, !6, i64 456, !6, i64 464, !13, i64 472, !10, i64 480, !10, i64 484, !6, i64 488, !15, i64 496, !10, i64 500, !15, i64 504, !7, i64 506, !7, i64 507, !7, i64 508, !7, i64 509, !7, i64 510, !7, i64 511, !7, i64 512, !7, i64 513, !7, i64 514, !7, i64 515, !7, i64 516, !7, i64 517, !7, i64 518, !15, i64 520, !7, i64 522, !10, i64 524, !16, i64 528, !16, i64 538, !10, i64 548, !10, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !17, i64 608, !17, i64 613, !6, i64 624, !16, i64 632, !6, i64 648, !6, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !10, i64 720, !10, i64 724, !13, i64 728, !13, i64 736, !13, i64 744, !13, i64 752, !10, i64 760, !10, i64 764, !6, i64 768, !6, i64 776, !7, i64 784, !7, i64 785, !10, i64 816, !6, i64 824, !6, i64 832, !10, i64 840, !10, i64 844, !6, i64 848, !7, i64 856, !7, i64 857, !15, i64 858, !15, i64 860, !10, i64 864, !7, i64 868, !6, i64 872, !6, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !10, i64 932, !10, i64 936, !10, i64 940, !13, i64 944, !18, i64 952, !13, i64 984, !6, i64 992, !13, i64 1000, !10, i64 1008, !10, i64 1012, !6, i64 1016, !7, i64 1024, !19, i64 1056}
!13 = !{!"long", !7, i64 0}
!14 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24, !10, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !13, i64 96, !13, i64 104}
!15 = !{!"short", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, 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, !6, i64 8, !13, i64 16, !7, i64 24}
!19 = !{!"png_colorspace", !10, i64 0, !20, i64 4, !21, i64 36, !15, i64 72, !15, i64 74}
!20 = !{!"png_xy", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!21 = !{!"png_XYZ", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!22 = !{!12, !10, i64 840}
!23 = !{!12, !10, i64 448}
!24 = !{!12, !10, i64 940}
!25 = !{!12, !6, i64 960}


; 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.30 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [25 x i8], align 1

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

; Function Attrs: noreturn
declare void @png_chunk_error(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_unknown(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 832
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %24, label %7

7:                                                ; preds = %4
  %8 = tail call i32 @png_cache_unknown_chunk(ptr noundef nonnull %0, i32 noundef %2)
  %.not46 = icmp eq i32 %8, 0
  br i1 %.not46, label %.thread, label %9

9:                                                ; preds = %7
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 952
  %12 = tail call i32 %10(ptr noundef nonnull %0, ptr noundef nonnull %11) #3
  %13 = icmp slt i32 %12, 0
  br i1 %13, label %14, label %15

14:                                               ; preds = %9
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.34) #4
  unreachable

15:                                               ; preds = %9
  %16 = icmp eq i32 %12, 0
  br i1 %16, label %17, label %.thread

17:                                               ; preds = %15
  %18 = icmp slt i32 %3, 2
  br i1 %18, label %19, label %39

19:                                               ; preds = %17
  %20 = getelementptr inbounds i8, ptr %0, i64 840
  %21 = load i32, ptr %20, align 8, !tbaa !20
  %22 = icmp slt i32 %21, 2
  br i1 %22, label %23, label %.thread53

23:                                               ; preds = %19
  tail call void @png_app_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.35) #3
  br label %.thread53

24:                                               ; preds = %4
  %25 = icmp eq i32 %3, 0
  br i1 %25, label %26, label %29

26:                                               ; preds = %24
  %27 = getelementptr inbounds i8, ptr %0, i64 840
  %28 = load i32, ptr %27, align 8, !tbaa !20
  br label %29

29:                                               ; preds = %26, %24
  %.1 = phi i32 [ %28, %26 ], [ %3, %24 ]
  switch i32 %.1, label %37 [
    i32 3, label %34
    i32 2, label %30
  ]

30:                                               ; preds = %29
  %31 = getelementptr inbounds i8, ptr %0, i64 448
  %32 = load i32, ptr %31, align 8, !tbaa !21
  %33 = and i32 %32, 536870912
  %.not45 = icmp eq i32 %33, 0
  br i1 %.not45, label %37, label %34

34:                                               ; preds = %29, %30
  %35 = tail call i32 @png_cache_unknown_chunk(ptr noundef nonnull %0, i32 noundef %2)
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %.thread, label %39

37:                                               ; preds = %29, %30
  %38 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %39

39:                                               ; preds = %34, %17, %37
  %.2 = phi i32 [ %.1, %37 ], [ %3, %17 ], [ %.1, %34 ]
  switch i32 %.2, label %.thread [
    i32 3, label %43
    i32 2, label %.thread53
  ]

.thread53:                                        ; preds = %19, %23, %39
  %40 = getelementptr inbounds i8, ptr %0, i64 448
  %41 = load i32, ptr %40, align 8, !tbaa !21
  %42 = and i32 %41, 536870912
  %.not47 = icmp eq i32 %42, 0
  br i1 %.not47, label %.thread, label %43

43:                                               ; preds = %39, %.thread53
  %44 = getelementptr inbounds i8, ptr %0, i64 940
  %45 = load i32, ptr %44, align 4, !tbaa !22
  switch i32 %45, label %47 [
    i32 2, label %46
    i32 1, label %.thread
    i32 0, label %49
  ]

46:                                               ; preds = %43
  store i32 1, ptr %44, align 4, !tbaa !22
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.30) #3
  br label %.thread

47:                                               ; preds = %43
  %48 = add i32 %45, -1
  store i32 %48, ptr %44, align 4, !tbaa !22
  br label %49

49:                                               ; preds = %47, %43
  %50 = getelementptr inbounds i8, ptr %0, i64 952
  tail call void @png_set_unknown_chunks(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %50, i32 noundef 1) #3
  br label %.thread

.thread:                                          ; preds = %34, %7, %15, %39, %43, %46, %49, %.thread53
  %51 = phi i1 [ false, %49 ], [ true, %43 ], [ true, %46 ], [ true, %.thread53 ], [ true, %39 ], [ true, %7 ], [ false, %15 ], [ true, %34 ]
  %52 = getelementptr inbounds i8, ptr %0, i64 960
  %53 = load ptr, ptr %52, align 8, !tbaa !23
  %.not48 = icmp eq ptr %53, null
  br i1 %.not48, label %55, label %54

54:                                               ; preds = %.thread
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %53) #3
  br label %55

55:                                               ; preds = %54, %.thread
  store ptr null, ptr %52, align 8, !tbaa !23
  br i1 %51, label %56, label %61

56:                                               ; preds = %55
  %57 = getelementptr inbounds i8, ptr %0, i64 448
  %58 = load i32, ptr %57, align 8, !tbaa !21
  %59 = and i32 %58, 536870912
  %.not49 = icmp eq i32 %59, 0
  br i1 %.not49, label %60, label %61

60:                                               ; preds = %56
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.36) #4
  unreachable

61:                                               ; preds = %56, %55
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i32 @png_cache_unknown_chunk(ptr noalias noundef, i32 noundef) local_unnamed_addr #0

declare void @png_app_warning(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

attributes #0 = { 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 #1 = { noreturn "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 = { nounwind }
attributes #4 = { noreturn 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, !9, i64 832}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !10, 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, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !12, i64 304, !11, i64 416, !11, i64 420, !11, i64 424, !11, i64 428, !10, i64 432, !11, i64 440, !11, i64 444, !11, i64 448, !9, i64 456, !9, i64 464, !10, i64 472, !11, i64 480, !11, i64 484, !9, i64 488, !13, i64 496, !11, i64 500, !13, i64 504, !7, i64 506, !7, i64 507, !7, i64 508, !7, i64 509, !7, i64 510, !7, i64 511, !7, i64 512, !7, i64 513, !7, i64 514, !7, i64 515, !7, i64 516, !7, i64 517, !7, i64 518, !13, i64 520, !7, i64 522, !11, i64 524, !14, i64 528, !14, i64 538, !11, i64 548, !11, i64 552, !9, i64 560, !9, i64 568, !9, i64 576, !9, i64 584, !9, i64 592, !9, i64 600, !15, i64 608, !15, i64 613, !9, i64 624, !14, i64 632, !9, i64 648, !9, i64 656, !9, i64 664, !9, i64 672, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !9, i64 712, !11, i64 720, !11, i64 724, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !11, i64 760, !11, i64 764, !9, i64 768, !9, i64 776, !7, i64 784, !7, i64 785, !11, i64 816, !9, i64 824, !9, i64 832, !11, i64 840, !11, i64 844, !9, i64 848, !7, i64 856, !7, i64 857, !13, i64 858, !13, i64 860, !11, i64 864, !7, i64 868, !9, i64 872, !9, i64 880, !9, i64 888, !9, i64 896, !9, i64 904, !9, i64 912, !9, i64 920, !7, i64 928, !11, i64 932, !11, i64 936, !11, i64 940, !10, i64 944, !16, i64 952, !10, i64 984, !9, i64 992, !10, i64 1000, !11, i64 1008, !11, i64 1012, !9, i64 1016, !7, i64 1024, !17, i64 1056}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !9, i64 0, !11, i64 8, !10, i64 16, !9, i64 24, !11, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !11, i64 88, !10, i64 96, !10, i64 104}
!13 = !{!"short", !7, i64 0}
!14 = !{!"png_color_16_struct", !7, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!15 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!16 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !10, i64 16, !7, i64 24}
!17 = !{!"png_colorspace", !11, i64 0, !18, i64 4, !19, i64 36, !13, i64 72, !13, i64 74}
!18 = !{!"png_xy", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!19 = !{!"png_XYZ", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!20 = !{!6, !11, i64 840}
!21 = !{!6, !11, i64 448}
!22 = !{!6, !11, i64 940}
!23 = !{!6, !9, i64 960}


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