; LLVM IR from Try/Tempest :: Engine/thirdparty/libpng (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, ptr, ptr, i8, i8, i32, i32, i32, i32, %struct.z_stream_s, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, ptr, ptr, ptr, ptr, i64, i32, i32, ptr, i16, i32, i16, i8, i8, 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, ptr, i32, i32, 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, i32, [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.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_IHDR(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca [13 x i8], align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = 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 13, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.png_struct_def, ptr %15, i32 0, i32 15
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = and i32 %17, 1
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %22

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

22:                                               ; preds = %3
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 13
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %26, ptr noundef @.str.6) #5
  unreachable

27:                                               ; preds = %22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 15
  %30 = load i32, ptr %29, align 4, !tbaa !11
  %31 = or i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !11
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 0
  call void @png_crc_read(ptr noundef %32, ptr noundef %33, i32 noundef 13)
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call i32 @png_crc_finish(ptr noundef %34, i32 noundef 0)
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 0
  %38 = call i32 @png_get_uint_31(ptr noundef %36, ptr noundef %37)
  store i32 %38, ptr %8, align 4, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 0
  %41 = getelementptr inbounds i8, ptr %40, i64 4
  %42 = call i32 @png_get_uint_31(ptr noundef %39, ptr noundef %41)
  store i32 %42, ptr %9, align 4, !tbaa !9
  %43 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 8
  %44 = load i8, ptr %43, align 1, !tbaa !22
  %45 = zext i8 %44 to i32
  store i32 %45, ptr %10, align 4, !tbaa !9
  %46 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 9
  %47 = load i8, ptr %46, align 1, !tbaa !22
  %48 = zext i8 %47 to i32
  store i32 %48, ptr %11, align 4, !tbaa !9
  %49 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 10
  %50 = load i8, ptr %49, align 1, !tbaa !22
  %51 = zext i8 %50 to i32
  store i32 %51, ptr %12, align 4, !tbaa !9
  %52 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 11
  %53 = load i8, ptr %52, align 1, !tbaa !22
  %54 = zext i8 %53 to i32
  store i32 %54, ptr %13, align 4, !tbaa !9
  %55 = getelementptr inbounds [13 x i8], ptr %7, i64 0, i64 12
  %56 = load i8, ptr %55, align 1, !tbaa !22
  %57 = zext i8 %56 to i32
  store i32 %57, ptr %14, align 4, !tbaa !9
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.png_struct_def, ptr %59, i32 0, i32 37
  store i32 %58, ptr %60, align 8, !tbaa !23
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.png_struct_def, ptr %62, i32 0, i32 38
  store i32 %61, ptr %63, align 4, !tbaa !24
  %64 = load i32, ptr %10, align 4, !tbaa !9
  %65 = trunc i32 %64 to i8
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.png_struct_def, ptr %66, i32 0, i32 62
  store i8 %65, ptr %67, align 8, !tbaa !25
  %68 = load i32, ptr %14, align 4, !tbaa !9
  %69 = trunc i32 %68 to i8
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.png_struct_def, ptr %70, i32 0, i32 58
  store i8 %69, ptr %71, align 4, !tbaa !26
  %72 = load i32, ptr %11, align 4, !tbaa !9
  %73 = trunc i32 %72 to i8
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.png_struct_def, ptr %74, i32 0, i32 61
  store i8 %73, ptr %75, align 1, !tbaa !27
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = trunc i32 %76 to i8
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.png_struct_def, ptr %78, i32 0, i32 123
  store i8 %77, ptr %79, align 4, !tbaa !28
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = trunc i32 %80 to i8
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.png_struct_def, ptr %82, i32 0, i32 131
  store i8 %81, ptr %83, align 8, !tbaa !29
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_struct_def, ptr %84, i32 0, i32 61
  %86 = load i8, ptr %85, align 1, !tbaa !27
  %87 = zext i8 %86 to i32
  switch i32 %87, label %88 [
    i32 0, label %89
    i32 3, label %89
    i32 2, label %92
    i32 4, label %95
    i32 6, label %98
  ]

88:                                               ; preds = %27
  br label %89

89:                                               ; preds = %88, %27, %27
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_struct_def, ptr %90, i32 0, i32 65
  store i8 1, ptr %91, align 1, !tbaa !30
  br label %101

92:                                               ; preds = %27
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_struct_def, ptr %93, i32 0, i32 65
  store i8 3, ptr %94, align 1, !tbaa !30
  br label %101

95:                                               ; preds = %27
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.png_struct_def, ptr %96, i32 0, i32 65
  store i8 2, ptr %97, align 1, !tbaa !30
  br label %101

98:                                               ; preds = %27
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_struct_def, ptr %99, i32 0, i32 65
  store i8 4, ptr %100, align 1, !tbaa !30
  br label %101

101:                                              ; preds = %98, %95, %92, %89
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.png_struct_def, ptr %102, i32 0, i32 62
  %104 = load i8, ptr %103, align 8, !tbaa !25
  %105 = zext i8 %104 to i32
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.png_struct_def, ptr %106, i32 0, i32 65
  %108 = load i8, ptr %107, align 1, !tbaa !30
  %109 = zext i8 %108 to i32
  %110 = mul nsw i32 %105, %109
  %111 = trunc i32 %110 to i8
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.png_struct_def, ptr %112, i32 0, i32 64
  store i8 %111, ptr %113, align 2, !tbaa !31
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.png_struct_def, ptr %114, i32 0, i32 64
  %116 = load i8, ptr %115, align 2, !tbaa !31
  %117 = zext i8 %116 to i32
  %118 = icmp sge i32 %117, 8
  br i1 %118, label %119, label %130

119:                                              ; preds = %101
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_struct_def, ptr %120, i32 0, i32 37
  %122 = load i32, ptr %121, align 8, !tbaa !23
  %123 = zext i32 %122 to i64
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_struct_def, ptr %124, i32 0, i32 64
  %126 = load i8, ptr %125, align 2, !tbaa !31
  %127 = zext i8 %126 to i64
  %128 = lshr i64 %127, 3
  %129 = mul i64 %123, %128
  br label %142

130:                                              ; preds = %101
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.png_struct_def, ptr %131, i32 0, i32 37
  %133 = load i32, ptr %132, align 8, !tbaa !23
  %134 = zext i32 %133 to i64
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.png_struct_def, ptr %135, i32 0, i32 64
  %137 = load i8, ptr %136, align 2, !tbaa !31
  %138 = zext i8 %137 to i64
  %139 = mul i64 %134, %138
  %140 = add i64 %139, 7
  %141 = lshr i64 %140, 3
  br label %142

142:                                              ; preds = %130, %119
  %143 = phi i64 [ %129, %119 ], [ %141, %130 ]
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_struct_def, ptr %144, i32 0, i32 41
  store i64 %143, ptr %145, align 8, !tbaa !32
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = load i32, ptr %8, align 4, !tbaa !9
  %149 = load i32, ptr %9, align 4, !tbaa !9
  %150 = load i32, ptr %10, align 4, !tbaa !9
  %151 = load i32, ptr %11, align 4, !tbaa !9
  %152 = load i32, ptr %14, align 4, !tbaa !9
  %153 = load i32, ptr %12, align 4, !tbaa !9
  %154 = load i32, ptr %13, align 4, !tbaa !9
  call void @png_set_IHDR(ptr noundef %146, ptr noundef %147, i32 noundef %148, i32 noundef %149, i32 noundef %150, i32 noundef %151, i32 noundef %152, i32 noundef %153, i32 noundef %154)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 13, ptr %7) #4
  ret void
}

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 300}
!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, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !14, i64 320, !6, i64 432, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !10, i64 460, !10, i64 464, !10, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !10, i64 512, !10, i64 516, !13, i64 520, !10, i64 528, !10, i64 532, !10, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !13, i64 576, !10, i64 584, !10, i64 588, !6, i64 592, !15, i64 600, !10, i64 604, !15, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !15, i64 626, !7, i64 628, !10, i64 632, !16, i64 636, !16, i64 646, !6, i64 656, !10, i64 664, !10, i64 668, !10, i64 672, !10, i64 676, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !17, i64 728, !17, i64 733, !6, i64 744, !16, i64 752, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !10, i64 840, !10, i64 844, !13, i64 848, !13, i64 856, !13, i64 864, !13, i64 872, !10, i64 880, !10, i64 884, !6, i64 888, !6, i64 896, !10, i64 904, !7, i64 908, !10, i64 940, !6, i64 944, !6, i64 952, !10, i64 960, !10, i64 964, !6, i64 968, !7, i64 976, !7, i64 977, !15, i64 978, !15, i64 980, !10, i64 984, !7, i64 988, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !6, i64 1040, !7, i64 1048, !10, i64 1052, !10, i64 1056, !10, i64 1060, !13, i64 1064, !18, i64 1072, !13, i64 1104, !6, i64 1112, !13, i64 1120, !10, i64 1128, !10, i64 1132, !6, i64 1136, !7, i64 1144, !19, i64 1176}
!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 = !{!7, !7, i64 0}
!23 = !{!12, !10, i64 504}
!24 = !{!12, !10, i64 508}
!25 = !{!12, !7, i64 616}
!26 = !{!12, !7, i64 612}
!27 = !{!12, !7, i64 615}
!28 = !{!12, !7, i64 988}
!29 = !{!12, !7, i64 1048}
!30 = !{!12, !7, i64 619}
!31 = !{!12, !7, i64 618}
!32 = !{!12, !13, i64 520}


; 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.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

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

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

; 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 #2

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_IHDR(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca [13 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 13, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 300
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = and i32 %6, 1
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %9, label %8

8:                                                ; preds = %3
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.5) #5
  unreachable

9:                                                ; preds = %3
  %.not45 = icmp eq i32 %2, 13
  br i1 %.not45, label %11, label %10

10:                                               ; preds = %9
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.6) #5
  unreachable

11:                                               ; preds = %9
  %12 = or disjoint i32 %6, 1
  store i32 %12, ptr %5, align 4, !tbaa !5
  call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %4, i32 noundef 13)
  %13 = call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %14 = call i32 @png_get_uint_31(ptr noundef nonnull %0, ptr noundef nonnull %4)
  %15 = getelementptr inbounds i8, ptr %4, i64 4
  %16 = call i32 @png_get_uint_31(ptr noundef nonnull %0, ptr noundef nonnull %15)
  %17 = getelementptr inbounds i8, ptr %4, i64 8
  %18 = load i8, ptr %17, align 1, !tbaa !20
  %19 = getelementptr inbounds i8, ptr %4, i64 9
  %20 = load i8, ptr %19, align 1, !tbaa !20
  %21 = getelementptr inbounds i8, ptr %4, i64 10
  %22 = load i8, ptr %21, align 1, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %4, i64 11
  %24 = load i8, ptr %23, align 1, !tbaa !20
  %25 = getelementptr inbounds i8, ptr %4, i64 12
  %26 = load i8, ptr %25, align 1, !tbaa !20
  %27 = getelementptr inbounds i8, ptr %0, i64 504
  store i32 %14, ptr %27, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %0, i64 508
  store i32 %16, ptr %28, align 4, !tbaa !22
  %29 = getelementptr inbounds i8, ptr %0, i64 616
  store i8 %18, ptr %29, align 8, !tbaa !23
  %30 = getelementptr inbounds i8, ptr %0, i64 612
  store i8 %26, ptr %30, align 4, !tbaa !24
  %31 = getelementptr inbounds i8, ptr %0, i64 615
  store i8 %20, ptr %31, align 1, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %0, i64 988
  store i8 %24, ptr %32, align 4, !tbaa !26
  %33 = getelementptr inbounds i8, ptr %0, i64 1048
  store i8 %22, ptr %33, align 8, !tbaa !27
  %34 = getelementptr inbounds i8, ptr %0, i64 619
  %35 = icmp ult i8 %20, 7
  %switch.cast = zext i8 %20 to i56
  %switch.shiftamt = shl nuw nsw i56 %switch.cast, 3
  %switch.downshift = lshr i56 1127008025379073, %switch.shiftamt
  %switch.masked = trunc i56 %switch.downshift to i8
  %.sink = select i1 %35, i8 %switch.masked, i8 1
  store i8 %.sink, ptr %34, align 1, !tbaa !28
  %36 = mul i8 %.sink, %18
  %37 = getelementptr inbounds i8, ptr %0, i64 618
  store i8 %36, ptr %37, align 2, !tbaa !29
  %38 = icmp ugt i8 %36, 7
  %39 = zext i32 %14 to i64
  br i1 %38, label %40, label %44

40:                                               ; preds = %11
  %41 = lshr i8 %36, 3
  %42 = zext nneg i8 %41 to i64
  %43 = mul nuw nsw i64 %42, %39
  br label %49

44:                                               ; preds = %11
  %45 = zext nneg i8 %36 to i64
  %46 = mul nuw nsw i64 %45, %39
  %47 = add nuw nsw i64 %46, 7
  %48 = lshr i64 %47, 3
  br label %49

49:                                               ; preds = %44, %40
  %50 = phi i64 [ %43, %40 ], [ %48, %44 ]
  %51 = zext i8 %26 to i32
  %52 = zext i8 %24 to i32
  %53 = zext i8 %22 to i32
  %54 = zext i8 %20 to i32
  %55 = zext i8 %18 to i32
  %56 = getelementptr inbounds i8, ptr %0, i64 520
  store i64 %50, ptr %56, align 8, !tbaa !30
  call void @png_set_IHDR(ptr noundef nonnull %0, ptr noundef %1, i32 noundef %14, i32 noundef %16, i32 noundef %55, i32 noundef %54, i32 noundef %51, i32 noundef %53, i32 noundef %52) #4
  call void @llvm.lifetime.end.p0(i64 13, ptr nonnull %4) #4
  ret void
}

declare void @png_set_IHDR(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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, !11, i64 300}
!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, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !11, i64 304, !11, i64 308, !11, i64 312, !12, i64 320, !9, i64 432, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !11, i64 460, !11, i64 464, !11, i64 468, !11, i64 472, !11, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !11, i64 508, !11, i64 512, !11, i64 516, !10, i64 520, !11, i64 528, !11, i64 532, !11, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !9, i64 568, !10, i64 576, !11, i64 584, !11, i64 588, !9, i64 592, !13, i64 600, !11, i64 604, !13, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !13, i64 626, !7, i64 628, !11, i64 632, !14, i64 636, !14, i64 646, !9, i64 656, !11, i64 664, !11, i64 668, !11, i64 672, !11, i64 676, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !9, i64 712, !9, i64 720, !15, i64 728, !15, i64 733, !9, i64 744, !14, i64 752, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !11, i64 840, !11, i64 844, !10, i64 848, !10, i64 856, !10, i64 864, !10, i64 872, !11, i64 880, !11, i64 884, !9, i64 888, !9, i64 896, !11, i64 904, !7, i64 908, !11, i64 940, !9, i64 944, !9, i64 952, !11, i64 960, !11, i64 964, !9, i64 968, !7, i64 976, !7, i64 977, !13, i64 978, !13, i64 980, !11, i64 984, !7, i64 988, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !9, i64 1040, !7, i64 1048, !11, i64 1052, !11, i64 1056, !11, i64 1060, !10, i64 1064, !16, i64 1072, !10, i64 1104, !9, i64 1112, !10, i64 1120, !11, i64 1128, !11, i64 1132, !9, i64 1136, !7, i64 1144, !17, i64 1176}
!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 = !{!7, !7, i64 0}
!21 = !{!6, !11, i64 504}
!22 = !{!6, !11, i64 508}
!23 = !{!6, !7, i64 616}
!24 = !{!6, !7, i64 612}
!25 = !{!6, !7, i64 615}
!26 = !{!6, !7, i64 988}
!27 = !{!6, !7, i64 1048}
!28 = !{!6, !7, i64 619}
!29 = !{!6, !7, i64 618}
!30 = !{!6, !10, i64 520}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass