; 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_color_struct = type { i8, i8, i8 }
%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 }
%struct.png_info_def = type { i32, i32, i32, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], %struct.png_colorspace, ptr, ptr, i32, 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, ptr, i32, i32, ptr, ptr, i8, i8, i32, ptr, i32, ptr, i32, i8, ptr, ptr, ptr }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }

@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 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 void @png_crc_read(ptr noalias noundef, ptr noundef, i32 noundef) #1

; 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

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

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

20:                                               ; preds = %3
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.png_struct_def, ptr %21, i32 0, i32 13
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = and i32 %23, 2
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %28

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

28:                                               ; preds = %20
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_struct_def, ptr %29, i32 0, i32 13
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = and i32 %31, 4
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %28
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = call i32 @png_crc_finish(ptr noundef %35, i32 noundef %36)
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %38, ptr noundef @.str.4)
  store i32 1, ptr %11, align 4
  br label %160

39:                                               ; preds = %28
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.png_struct_def, ptr %42, i32 0, i32 13
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %45 = or i32 %44, 2
  store i32 %45, ptr %43, align 4, !tbaa !11
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.png_struct_def, ptr %46, i32 0, i32 40
  %48 = load i8, ptr %47, align 1, !tbaa !22
  %49 = zext i8 %48 to i32
  %50 = and i32 %49, 2
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %41
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = call i32 @png_crc_finish(ptr noundef %53, i32 noundef %54)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %56, ptr noundef @.str.8)
  store i32 1, ptr %11, align 4
  br label %160

57:                                               ; preds = %41
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = icmp ugt i32 %58, 768
  br i1 %59, label %64, label %60

60:                                               ; preds = %57
  %61 = load i32, ptr %6, align 4, !tbaa !9
  %62 = urem i32 %61, 3
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %78

64:                                               ; preds = %60, %57
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = call i32 @png_crc_finish(ptr noundef %65, i32 noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 40
  %70 = load i8, ptr %69, align 1, !tbaa !22
  %71 = zext i8 %70 to i32
  %72 = icmp ne i32 %71, 3
  br i1 %72, label %73, label %75

73:                                               ; preds = %64
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %74, ptr noundef @.str.5)
  br label %77

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

77:                                               ; preds = %73
  store i32 1, ptr %11, align 4
  br label %160

78:                                               ; preds = %60
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = sdiv i32 %79, 3
  store i32 %80, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  %81 = getelementptr inbounds [256 x %struct.png_color_struct], ptr %7, i64 0, i64 0
  store ptr %81, ptr %10, align 8, !tbaa !5
  br label %82

82:                                               ; preds = %101, %78
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %86, label %106

86:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 3, ptr %12) #4
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  call void @png_crc_read(ptr noundef %87, ptr noundef %88, i32 noundef 3)
  %89 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 0
  %90 = load i8, ptr %89, align 1, !tbaa !23
  %91 = load ptr, ptr %10, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.png_color_struct, ptr %91, i32 0, i32 0
  store i8 %90, ptr %92, align 1, !tbaa !24
  %93 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 1
  %94 = load i8, ptr %93, align 1, !tbaa !23
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.png_color_struct, ptr %95, i32 0, i32 1
  store i8 %94, ptr %96, align 1, !tbaa !26
  %97 = getelementptr inbounds [3 x i8], ptr %12, i64 0, i64 2
  %98 = load i8, ptr %97, align 1, !tbaa !23
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_color_struct, ptr %99, i32 0, i32 2
  store i8 %98, ptr %100, align 1, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 3, ptr %12) #4
  br label %101

101:                                              ; preds = %86
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %9, align 4, !tbaa !9
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_color_struct, ptr %104, i32 1
  store ptr %105, ptr %10, align 8, !tbaa !5
  br label %82, !llvm.loop !28

106:                                              ; preds = %82
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = call i32 @png_crc_finish(ptr noundef %107, i32 noundef 0)
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds [256 x %struct.png_color_struct], ptr %7, i64 0, i64 0
  %112 = load i32, ptr %8, align 4, !tbaa !9
  call void @png_set_PLTE(ptr noundef %109, ptr noundef %110, ptr noundef %111, i32 noundef %112)
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.png_struct_def, ptr %113, i32 0, i32 34
  %115 = load i16, ptr %114, align 8, !tbaa !30
  %116 = zext i16 %115 to i32
  %117 = icmp sgt i32 %116, 0
  br i1 %117, label %127, label %118

118:                                              ; preds = %106
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %137

121:                                              ; preds = %118
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.png_info_def, ptr %122, i32 0, i32 2
  %124 = load i32, ptr %123, align 8, !tbaa !31
  %125 = and i32 %124, 16
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %137

127:                                              ; preds = %121, %106
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.png_struct_def, ptr %128, i32 0, i32 34
  store i16 0, ptr %129, align 8, !tbaa !30
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %135

132:                                              ; preds = %127
  %133 = load ptr, ptr %5, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_info_def, ptr %133, i32 0, i32 6
  store i16 0, ptr %134, align 2, !tbaa !34
  br label %135

135:                                              ; preds = %132, %127
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %136, ptr noundef @.str.9)
  br label %137

137:                                              ; preds = %135, %121, %118
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = icmp ne ptr %138, null
  br i1 %139, label %140, label %148

140:                                              ; preds = %137
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_info_def, ptr %141, i32 0, i32 2
  %143 = load i32, ptr %142, align 8, !tbaa !31
  %144 = and i32 %143, 64
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %148

146:                                              ; preds = %140
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %147, ptr noundef @.str.10)
  br label %148

148:                                              ; preds = %146, %140, %137
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %159

151:                                              ; preds = %148
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.png_info_def, ptr %152, i32 0, i32 2
  %154 = load i32, ptr %153, align 8, !tbaa !31
  %155 = and i32 %154, 32
  %156 = icmp ne i32 %155, 0
  br i1 %156, label %157, label %159

157:                                              ; preds = %151
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %158, ptr noundef @.str.11)
  br label %159

159:                                              ; preds = %157, %151, %148
  store i32 0, ptr %11, align 4
  br label %160

160:                                              ; preds = %159, %77, %52, %34
  call void @llvm.lifetime.end.p0(i64 8, 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 768, ptr %7) #4
  %161 = load i32, ptr %11, align 4
  switch i32 %161, label %163 [
    i32 0, label %162
    i32 1, label %162
  ]

162:                                              ; preds = %160, %160
  ret void

163:                                              ; preds = %160
  unreachable
}

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

declare void @png_set_PLTE(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, !10, i64 284}
!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, !7, i64 511}
!23 = !{!7, !7, i64 0}
!24 = !{!25, !7, i64 0}
!25 = !{!"png_color_struct", !7, i64 0, !7, i64 1, !7, i64 2}
!26 = !{!25, !7, i64 1}
!27 = !{!25, !7, i64 2}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!12, !15, i64 504}
!31 = !{!32, !10, i64 8}
!32 = !{!"png_info_def", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !6, i64 24, !15, i64 32, !15, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !19, i64 52, !6, i64 128, !6, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !33, i64 168, !17, i64 176, !6, i64 184, !16, i64 192, !16, i64 202, !10, i64 212, !10, i64 216, !7, i64 220, !10, i64 224, !10, i64 228, !7, i64 232, !6, i64 240, !6, i64 248, !10, i64 256, !10, i64 260, !6, i64 264, !6, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !6, i64 288, !10, i64 296, !6, i64 304, !10, i64 312, !7, i64 316, !6, i64 320, !6, i64 328, !6, i64 336}
!33 = !{!"png_time_struct", !15, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!34 = !{!32, !15, i64 34}


; 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"

%struct.png_color_struct = type { i8, i8, i8 }

@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: mustprogress 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 void @png_crc_read(ptr noalias noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

; 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_PLTE(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca [256 x %struct.png_color_struct], align 16
  %5 = alloca [3 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %4) #4
  %6 = getelementptr inbounds i8, ptr %0, i64 284
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = and i32 %7, 1
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %11

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

11:                                               ; preds = %3
  %12 = and i32 %7, 2
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %14, label %13

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

14:                                               ; preds = %11
  %15 = and i32 %7, 4
  %.not49 = icmp eq i32 %15, 0
  br i1 %.not49, label %18, label %16

16:                                               ; preds = %14
  %17 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.4) #4
  br label %.critedge

18:                                               ; preds = %14
  %19 = or disjoint i32 %7, 2
  store i32 %19, ptr %6, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 511
  %21 = load i8, ptr %20, align 1, !tbaa !20
  %22 = and i8 %21, 2
  %23 = icmp eq i8 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %18
  %25 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #4
  br label %.critedge

26:                                               ; preds = %18
  %27 = icmp ult i32 %2, 769
  %28 = urem i32 %2, 3
  %.not50 = icmp eq i32 %28, 0
  %or.cond = and i1 %27, %.not50
  br i1 %or.cond, label %34, label %29

29:                                               ; preds = %26
  %30 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  %31 = load i8, ptr %20, align 1, !tbaa !20
  %.not58 = icmp eq i8 %31, 3
  br i1 %.not58, label %33, label %32

32:                                               ; preds = %29
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.5) #4
  br label %.critedge

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

34:                                               ; preds = %26
  %.lhs.trunc = trunc nuw i32 %2 to i16
  %35 = udiv i16 %.lhs.trunc, 3
  %.zext = zext nneg i16 %35 to i32
  %.not68 = icmp ult i32 %2, 3
  br i1 %.not68, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %34
  %36 = getelementptr inbounds i8, ptr %5, i64 1
  %37 = getelementptr inbounds i8, ptr %5, i64 2
  br label %38

38:                                               ; preds = %.lr.ph, %38
  %.067 = phi ptr [ %4, %.lr.ph ], [ %45, %38 ]
  %.04566 = phi i32 [ 0, %.lr.ph ], [ %44, %38 ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %5) #4
  call void @png_crc_read(ptr noundef %0, ptr noundef nonnull %5, i32 noundef 3)
  %39 = load i8, ptr %5, align 1, !tbaa !21
  store i8 %39, ptr %.067, align 1, !tbaa !22
  %40 = load i8, ptr %36, align 1, !tbaa !21
  %41 = getelementptr inbounds i8, ptr %.067, i64 1
  store i8 %40, ptr %41, align 1, !tbaa !24
  %42 = load i8, ptr %37, align 1, !tbaa !21
  %43 = getelementptr inbounds i8, ptr %.067, i64 2
  store i8 %42, ptr %43, align 1, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %5) #4
  %44 = add nuw nsw i32 %.04566, 1
  %45 = getelementptr inbounds i8, ptr %.067, i64 3
  %exitcond.not = icmp eq i32 %44, %.zext
  br i1 %exitcond.not, label %._crit_edge, label %38, !llvm.loop !26

._crit_edge:                                      ; preds = %38, %34
  %46 = call i32 @png_crc_finish(ptr noundef %0, i32 noundef 0)
  call void @png_set_PLTE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %4, i32 noundef %.zext) #4
  %47 = getelementptr inbounds i8, ptr %0, i64 504
  %48 = load i16, ptr %47, align 8, !tbaa !28
  %.not51 = icmp eq i16 %48, 0
  br i1 %.not51, label %49, label %54

49:                                               ; preds = %._crit_edge
  %.not52 = icmp eq ptr %1, null
  br i1 %.not52, label %.critedge, label %50

50:                                               ; preds = %49
  %51 = getelementptr inbounds i8, ptr %1, i64 8
  %52 = load i32, ptr %51, align 8, !tbaa !29
  %53 = and i32 %52, 16
  %.not53 = icmp eq i32 %53, 0
  br i1 %.not53, label %.thread62, label %.thread

.thread:                                          ; preds = %50
  store i16 0, ptr %47, align 8, !tbaa !28
  br label %55

54:                                               ; preds = %._crit_edge
  store i16 0, ptr %47, align 8, !tbaa !28
  %.not54 = icmp eq ptr %1, null
  br i1 %.not54, label %.thread64, label %55

.thread64:                                        ; preds = %54
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.9) #4
  br label %.critedge

55:                                               ; preds = %54, %.thread
  %56 = getelementptr inbounds i8, ptr %1, i64 34
  store i16 0, ptr %56, align 2, !tbaa !32
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.9) #4
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 8
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !29
  br label %.thread62

.thread62:                                        ; preds = %50, %55
  %57 = phi i32 [ %52, %50 ], [ %.pre, %55 ]
  %58 = getelementptr inbounds i8, ptr %1, i64 8
  %59 = and i32 %57, 64
  %.not56 = icmp eq i32 %59, 0
  br i1 %.not56, label %61, label %60

60:                                               ; preds = %.thread62
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.10) #4
  br label %61

61:                                               ; preds = %.thread62, %60
  %62 = load i32, ptr %58, align 8, !tbaa !29
  %63 = and i32 %62, 32
  %.not57 = icmp eq i32 %63, 0
  br i1 %.not57, label %.critedge, label %64

64:                                               ; preds = %61
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.11) #4
  br label %.critedge

.critedge:                                        ; preds = %49, %.thread64, %61, %64, %32, %24, %16
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %4) #4
  ret void
}

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

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

attributes #0 = { mustprogress 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 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 284}
!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, !7, i64 511}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !7, i64 0}
!23 = !{!"png_color_struct", !7, i64 0, !7, i64 1, !7, i64 2}
!24 = !{!23, !7, i64 1}
!25 = !{!23, !7, i64 2}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!6, !13, i64 504}
!29 = !{!30, !11, i64 8}
!30 = !{!"png_info_def", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 16, !9, i64 24, !13, i64 32, !13, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !17, i64 52, !9, i64 128, !9, i64 136, !11, i64 144, !11, i64 148, !11, i64 152, !9, i64 160, !31, i64 168, !15, i64 176, !9, i64 184, !14, i64 192, !14, i64 202, !11, i64 212, !11, i64 216, !7, i64 220, !11, i64 224, !11, i64 228, !7, i64 232, !9, i64 240, !9, i64 248, !11, i64 256, !11, i64 260, !9, i64 264, !9, i64 272, !7, i64 280, !7, i64 281, !11, i64 284, !9, i64 288, !11, i64 296, !9, i64 304, !11, i64 312, !7, i64 316, !9, i64 320, !9, i64 328, !9, i64 336}
!31 = !{!"png_time_struct", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!32 = !{!30, !13, i64 34}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass