; LLVM IR from mkazhdan/DMG :: Util/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, 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 }
%struct.png_text_struct = type { i32, ptr, ptr, i64 }

@.str.116 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [41 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

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

; 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 noundef, ptr noundef, i64 noundef) #2

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

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

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

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

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

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

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

21:                                               ; preds = %3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %22, ptr noundef @.str.116)
  br label %23

23:                                               ; preds = %21, %3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.png_struct_def, ptr %24, i32 0, i32 12
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = and i64 %26, 4
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %29, label %34

29:                                               ; preds = %23
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.png_struct_def, ptr %30, i32 0, i32 12
  %32 = load i64, ptr %31, align 8, !tbaa !11
  %33 = or i64 %32, 8
  store i64 %33, ptr %31, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %29, %23
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = add i64 %36, 1
  %38 = call ptr @png_malloc_warn(ptr noundef %35, i64 noundef %37)
  store ptr %38, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %43

41:                                               ; preds = %34
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %42, ptr noundef @.str.117)
  store i32 1, ptr %15, align 4
  br label %138

43:                                               ; preds = %34
  %44 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %44, ptr %12, align 8, !tbaa !9
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = load i64, ptr %12, align 8, !tbaa !9
  call void @png_crc_read(ptr noundef %45, ptr noundef %46, i64 noundef %47)
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call i32 @png_crc_finish(ptr noundef %48, i64 noundef 0)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %54

51:                                               ; preds = %43
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %52, ptr noundef %53)
  store i32 1, ptr %15, align 4
  br label %138

54:                                               ; preds = %43
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = load i64, ptr %12, align 8, !tbaa !9
  %57 = getelementptr inbounds i8, ptr %55, i64 %56
  store i8 0, ptr %57, align 1, !tbaa !21
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %58, ptr %9, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %64, %54
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !21
  %62 = icmp ne i8 %61, 0
  br i1 %62, label %63, label %67

63:                                               ; preds = %59
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i32 1
  store ptr %66, ptr %9, align 8, !tbaa !5
  br label %59, !llvm.loop !22

67:                                               ; preds = %59
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load i64, ptr %12, align 8, !tbaa !9
  %71 = getelementptr inbounds i8, ptr %69, i64 %70
  %72 = getelementptr inbounds i8, ptr %71, i64 -2
  %73 = icmp uge ptr %68, %72
  br i1 %73, label %74, label %78

74:                                               ; preds = %67
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %75, ptr noundef @.str.118)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %76, ptr noundef %77)
  store i32 1, ptr %15, align 4
  br label %138

78:                                               ; preds = %67
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i32 1
  store ptr %80, ptr %9, align 8, !tbaa !5
  %81 = load i8, ptr %80, align 1, !tbaa !21
  %82 = sext i8 %81 to i32
  store i32 %82, ptr %10, align 4, !tbaa !24
  %83 = load i32, ptr %10, align 4, !tbaa !24
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %87

85:                                               ; preds = %78
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %86, ptr noundef @.str.119)
  store i32 0, ptr %10, align 4, !tbaa !24
  br label %87

87:                                               ; preds = %85, %78
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i32 1
  store ptr %89, ptr %9, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %87
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = ptrtoint ptr %91 to i64
  %94 = ptrtoint ptr %92 to i64
  %95 = sub i64 %93, %94
  store i64 %95, ptr %13, align 8, !tbaa !9
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = load i32, ptr %10, align 4, !tbaa !24
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = load i64, ptr %6, align 8, !tbaa !9
  %100 = load i64, ptr %13, align 8, !tbaa !9
  %101 = call ptr @png_decompress_chunk(ptr noundef %96, i32 noundef %97, ptr noundef %98, i64 noundef %99, i64 noundef %100, ptr noundef %14)
  store ptr %101, ptr %8, align 8, !tbaa !5
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = call ptr @png_malloc_warn(ptr noundef %102, i64 noundef 32)
  store ptr %103, ptr %7, align 8, !tbaa !5
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = icmp eq ptr %104, null
  br i1 %105, label %106, label %110

106:                                              ; preds = %90
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %107, ptr noundef @.str.120)
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %108, ptr noundef %109)
  store i32 1, ptr %15, align 4
  br label %138

110:                                              ; preds = %90
  %111 = load i32, ptr %10, align 4, !tbaa !24
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.png_text_struct, ptr %112, i32 0, i32 0
  store i32 %111, ptr %113, align 8, !tbaa !25
  %114 = load ptr, ptr %8, align 8, !tbaa !5
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.png_text_struct, ptr %115, i32 0, i32 1
  store ptr %114, ptr %116, align 8, !tbaa !27
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = load i64, ptr %13, align 8, !tbaa !9
  %119 = getelementptr inbounds i8, ptr %117, i64 %118
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.png_text_struct, ptr %120, i32 0, i32 2
  store ptr %119, ptr %121, align 8, !tbaa !28
  %122 = load i64, ptr %14, align 8, !tbaa !9
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.png_text_struct, ptr %123, i32 0, i32 3
  store i64 %122, ptr %124, align 8, !tbaa !29
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = call i32 @png_set_text_2(ptr noundef %125, ptr noundef %126, ptr noundef %127, i32 noundef 1)
  store i32 %128, ptr %11, align 4, !tbaa !24
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %129, ptr noundef %130)
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %131, ptr noundef %132)
  %133 = load i32, ptr %11, align 4, !tbaa !24
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %135, label %137

135:                                              ; preds = %110
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %136, ptr noundef @.str.121)
  br label %137

137:                                              ; preds = %135, %110
  store i32 0, ptr %15, align 4
  br label %138

138:                                              ; preds = %137, %106, %74, %51, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %139 = load i32, ptr %15, align 4
  switch i32 %139, label %141 [
    i32 0, label %140
    i32 1, label %140
  ]

140:                                              ; preds = %138, %138
  ret void

141:                                              ; preds = %138
  unreachable
}

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 = { 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 = !{!12, !10, i64 280}
!12 = !{!"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, !13, i64 304, !6, i64 416, !10, i64 424, !14, i64 432, !14, i64 436, !14, i64 440, !14, i64 444, !14, 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, !15, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !16, i64 616, !16, 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, !16, i64 638, !7, i64 640, !17, i64 644, !18, i64 648, !18, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !14, i64 696, !17, i64 700, !17, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !19, i64 760, !19, i64 765, !6, i64 776, !18, 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, !14, i64 920, !14, 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, !14, i64 1064, !6, i64 1072, !7, i64 1080, !16, i64 1082, !16, i64 1084, !16, 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, !20, i64 1208, !10, i64 1240, !10, i64 1248}
!13 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !10, i64 16, !6, i64 24, !14, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"png_color_16_struct", !7, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !10, i64 16, !7, i64 24}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!14, !14, i64 0}
!25 = !{!26, !14, i64 0}
!26 = !{!"png_text_struct", !14, i64 0, !6, i64 8, !6, i64 16, !10, i64 24}
!27 = !{!26, !6, i64 8}
!28 = !{!26, !6, i64 16}
!29 = !{!26, !10, i64 24}


; 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.116 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.117 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.118 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.119 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.120 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [41 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

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

; 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 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

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

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

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

8:                                                ; preds = %3
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.116) #3
  %.pre = load i64, ptr %5, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %8, %3
  %10 = phi i64 [ %.pre, %8 ], [ %6, %3 ]
  %11 = and i64 %10, 4
  %.not62 = icmp eq i64 %11, 0
  br i1 %.not62, label %14, label %12

12:                                               ; preds = %9
  %13 = or i64 %10, 8
  store i64 %13, ptr %5, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %12, %9
  %15 = add i64 %2, 1
  %16 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %15) #3
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %14
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.117) #3
  br label %50

19:                                               ; preds = %14
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %16, i64 noundef %2)
  %20 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef 0)
  %.not63 = icmp eq i32 %20, 0
  br i1 %.not63, label %22, label %21

21:                                               ; preds = %19
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %16) #3
  br label %50

22:                                               ; preds = %19
  %23 = getelementptr inbounds i8, ptr %16, i64 %2
  store i8 0, ptr %23, align 1, !tbaa !19
  br label %24

24:                                               ; preds = %24, %22
  %.0 = phi ptr [ %16, %22 ], [ %26, %24 ]
  %25 = load i8, ptr %.0, align 1, !tbaa !19
  %.not64 = icmp eq i8 %25, 0
  %26 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %.not64, label %27, label %24, !llvm.loop !20

27:                                               ; preds = %24
  %28 = getelementptr inbounds i8, ptr %23, i64 -2
  %.not65 = icmp ult ptr %.0, %28
  br i1 %.not65, label %30, label %29

29:                                               ; preds = %27
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.118) #3
  tail call void @png_free(ptr noundef %0, ptr noundef nonnull %16) #3
  br label %50

30:                                               ; preds = %27
  %31 = load i8, ptr %26, align 1, !tbaa !19
  %.not66 = icmp eq i8 %31, 0
  br i1 %.not66, label %33, label %32

32:                                               ; preds = %30
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.119) #3
  br label %33

33:                                               ; preds = %32, %30
  %34 = getelementptr inbounds i8, ptr %.0, i64 2
  %35 = ptrtoint ptr %34 to i64
  %36 = ptrtoint ptr %16 to i64
  %37 = sub i64 %35, %36
  %38 = call ptr @png_decompress_chunk(ptr noundef %0, i32 noundef 0, ptr noundef nonnull %16, i64 noundef %2, i64 noundef %37, ptr noundef nonnull %4)
  %39 = call ptr @png_malloc_warn(ptr noundef %0, i64 noundef 32) #3
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %33
  call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.120) #3
  call void @png_free(ptr noundef %0, ptr noundef %38) #3
  br label %50

42:                                               ; preds = %33
  store i32 0, ptr %39, align 8, !tbaa !22
  %43 = getelementptr inbounds i8, ptr %39, i64 8
  store ptr %38, ptr %43, align 8, !tbaa !24
  %44 = getelementptr inbounds i8, ptr %38, i64 %37
  %45 = getelementptr inbounds i8, ptr %39, i64 16
  store ptr %44, ptr %45, align 8, !tbaa !25
  %46 = load i64, ptr %4, align 8, !tbaa !26
  %47 = getelementptr inbounds i8, ptr %39, i64 24
  store i64 %46, ptr %47, align 8, !tbaa !27
  %48 = call i32 @png_set_text_2(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %39, i32 noundef 1) #3
  call void @png_free(ptr noundef %0, ptr noundef nonnull %39) #3
  call void @png_free(ptr noundef %0, ptr noundef %38) #3
  %.not67 = icmp eq i32 %48, 0
  br i1 %.not67, label %50, label %49

49:                                               ; preds = %42
  call void @png_error(ptr noundef %0, ptr noundef nonnull @.str.121) #3
  br label %50

50:                                               ; preds = %42, %49, %41, %29, %21, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret void
}

attributes #0 = { mustprogress 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 = { 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, !10, i64 280}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !11, i64 304, !9, i64 416, !10, i64 424, !12, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, 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, !9, i64 520, !9, i64 528, !9, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !13, i64 568, !10, i64 592, !10, i64 600, !9, i64 608, !14, i64 616, !14, 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, !14, i64 638, !7, i64 640, !15, i64 644, !16, i64 648, !16, i64 658, !9, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !15, i64 700, !15, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !9, i64 744, !9, i64 752, !17, i64 760, !17, i64 765, !9, i64 776, !16, i64 784, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !9, i64 856, !9, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !12, i64 920, !12, i64 924, !10, i64 928, !10, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !7, i64 984, !7, i64 985, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !10, i64 1040, !9, i64 1048, !9, i64 1056, !12, i64 1064, !9, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !9, i64 1160, !9, i64 1168, !9, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !18, i64 1208, !10, i64 1240, !10, i64 1248}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !10, i64 16, !9, i64 24, !12, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, 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, !9, i64 8, !10, i64 16, !7, i64 24}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !12, i64 0}
!23 = !{!"png_text_struct", !12, i64 0, !9, i64 8, !9, i64 16, !10, i64 24}
!24 = !{!23, !9, i64 8}
!25 = !{!23, !9, i64 16}
!26 = !{!10, !10, i64 0}
!27 = !{!23, !10, i64 24}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass