; LLVM IR from EyalAr/lwip :: src/lib/png (pngset)

; 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_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_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_time_struct = type { i16, i8, 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_sPLT_struct = type { ptr, i8, ptr, i32 }

@.str.25 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

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

declare noalias ptr @png_realloc_array(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i64 noundef) #3

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

declare noalias ptr @png_malloc_base(ptr noundef, i64 noundef) #3

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

14:                                               ; preds = %4
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %23, label %17

17:                                               ; preds = %14
  %18 = load i32, ptr %8, align 4, !tbaa !9
  %19 = icmp sle i32 %18, 0
  br i1 %19, label %23, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %20, %17, %14, %4
  store i32 1, ptr %10, align 4
  br label %157

24:                                               ; preds = %20
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.png_info_def, ptr %26, i32 0, i32 45
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.png_info_def, ptr %29, i32 0, i32 46
  %31 = load i32, ptr %30, align 8, !tbaa !21
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = call noalias ptr @png_realloc_array(ptr noundef %25, ptr noundef %28, i32 noundef %31, i32 noundef %32, i64 noundef 32)
  store ptr %33, ptr %9, align 8, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %38

36:                                               ; preds = %24
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_chunk_report(ptr noundef %37, ptr noundef @.str.25, i32 noundef 1)
  store i32 1, ptr %10, align 4
  br label %157

38:                                               ; preds = %24
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.png_info_def, ptr %40, i32 0, i32 45
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  call void @png_free(ptr noundef %39, ptr noundef %42)
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_info_def, ptr %44, i32 0, i32 45
  store ptr %43, ptr %45, align 8, !tbaa !11
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.png_info_def, ptr %46, i32 0, i32 42
  %48 = load i32, ptr %47, align 4, !tbaa !22
  %49 = or i32 %48, 32
  store i32 %49, ptr %47, align 4, !tbaa !22
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.png_info_def, ptr %50, i32 0, i32 46
  %52 = load i32, ptr %51, align 8, !tbaa !21
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = sext i32 %52 to i64
  %55 = getelementptr inbounds %struct.png_sPLT_struct, ptr %53, i64 %54
  store ptr %55, ptr %9, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %145, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.png_sPLT_struct, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = icmp eq ptr %59, null
  br i1 %60, label %66, label %61

61:                                               ; preds = %56
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.png_sPLT_struct, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !25
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %68

66:                                               ; preds = %61, %56
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_app_error(ptr noundef %67, ptr noundef @.str.26)
  store i32 3, ptr %10, align 4
  br label %142

68:                                               ; preds = %61
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.png_sPLT_struct, ptr %69, i32 0, i32 1
  %71 = load i8, ptr %70, align 8, !tbaa !26
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.png_sPLT_struct, ptr %72, i32 0, i32 1
  store i8 %71, ptr %73, align 8, !tbaa !26
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.png_sPLT_struct, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  %77 = call i64 @strlen(ptr noundef %76) #6
  %78 = add i64 %77, 1
  store i64 %78, ptr %11, align 8, !tbaa !27
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i64, ptr %11, align 8, !tbaa !27
  %81 = call noalias ptr @png_malloc_base(ptr noundef %79, i64 noundef %80)
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.png_sPLT_struct, ptr %82, i32 0, i32 0
  store ptr %81, ptr %83, align 8, !tbaa !23
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_sPLT_struct, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !23
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %68
  store i32 2, ptr %10, align 4
  br label %142

89:                                               ; preds = %68
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.png_sPLT_struct, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !23
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.png_sPLT_struct, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !23
  %96 = load i64, ptr %11, align 8, !tbaa !27
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %92, ptr align 1 %95, i64 %96, i1 false)
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.png_sPLT_struct, ptr %98, i32 0, i32 3
  %100 = load i32, ptr %99, align 8, !tbaa !28
  %101 = call noalias ptr @png_malloc_array(ptr noundef %97, i32 noundef %100, i64 noundef 10)
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.png_sPLT_struct, ptr %102, i32 0, i32 2
  store ptr %101, ptr %103, align 8, !tbaa !25
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_sPLT_struct, ptr %104, i32 0, i32 2
  %106 = load ptr, ptr %105, align 8, !tbaa !25
  %107 = icmp eq ptr %106, null
  br i1 %107, label %108, label %115

108:                                              ; preds = %89
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.png_sPLT_struct, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !23
  call void @png_free(ptr noundef %109, ptr noundef %112)
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.png_sPLT_struct, ptr %113, i32 0, i32 0
  store ptr null, ptr %114, align 8, !tbaa !23
  store i32 2, ptr %10, align 4
  br label %142

115:                                              ; preds = %89
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.png_sPLT_struct, ptr %116, i32 0, i32 3
  %118 = load i32, ptr %117, align 8, !tbaa !28
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.png_sPLT_struct, ptr %119, i32 0, i32 3
  store i32 %118, ptr %120, align 8, !tbaa !28
  %121 = load ptr, ptr %9, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.png_sPLT_struct, ptr %121, i32 0, i32 2
  %123 = load ptr, ptr %122, align 8, !tbaa !25
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_sPLT_struct, ptr %124, i32 0, i32 2
  %126 = load ptr, ptr %125, align 8, !tbaa !25
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.png_sPLT_struct, ptr %127, i32 0, i32 3
  %129 = load i32, ptr %128, align 8, !tbaa !28
  %130 = sext i32 %129 to i64
  %131 = mul i64 %130, 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %123, ptr align 2 %126, i64 %131, i1 false)
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_info_def, ptr %132, i32 0, i32 2
  %134 = load i32, ptr %133, align 8, !tbaa !29
  %135 = or i32 %134, 8192
  store i32 %135, ptr %133, align 8, !tbaa !29
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.png_info_def, ptr %136, i32 0, i32 46
  %138 = load i32, ptr %137, align 8, !tbaa !21
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %137, align 8, !tbaa !21
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.png_sPLT_struct, ptr %140, i32 1
  store ptr %141, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %10, align 4
  br label %142

142:                                              ; preds = %115, %108, %88, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  %143 = load i32, ptr %10, align 4
  switch i32 %143, label %160 [
    i32 0, label %144
    i32 3, label %145
    i32 2, label %151
  ]

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144, %142
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.png_sPLT_struct, ptr %146, i32 1
  store ptr %147, ptr %7, align 8, !tbaa !5
  %148 = load i32, ptr %8, align 4, !tbaa !9
  %149 = add nsw i32 %148, -1
  store i32 %149, ptr %8, align 4, !tbaa !9
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %56, label %151, !llvm.loop !30

151:                                              ; preds = %145, %142
  %152 = load i32, ptr %8, align 4, !tbaa !9
  %153 = icmp sgt i32 %152, 0
  br i1 %153, label %154, label %156

154:                                              ; preds = %151
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_chunk_report(ptr noundef %155, ptr noundef @.str.27, i32 noundef 1)
  br label %156

156:                                              ; preds = %154, %151
  store i32 0, ptr %10, align 4
  br label %157

157:                                              ; preds = %156, %36, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  %158 = load i32, ptr %10, align 4
  switch i32 %158, label %160 [
    i32 0, label %159
    i32 1, label %159
  ]

159:                                              ; preds = %157, %157
  ret void

160:                                              ; preds = %157, %142
  unreachable
}

declare noalias ptr @png_malloc_array(ptr noundef, i32 noundef, i64 noundef) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind willreturn memory(read) "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 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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 304}
!12 = !{!"png_info_def", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !6, i64 24, !14, i64 32, !14, 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, !15, i64 52, !6, i64 128, !6, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !18, i64 168, !19, i64 176, !6, i64 184, !20, i64 192, !20, 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}
!13 = !{!"long", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!"png_colorspace", !10, i64 0, !16, i64 4, !17, i64 36, !14, i64 72, !14, i64 74}
!16 = !{!"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}
!17 = !{!"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}
!18 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, i64 8}
!21 = !{!12, !10, i64 312}
!22 = !{!12, !10, i64 284}
!23 = !{!24, !6, i64 0}
!24 = !{!"png_sPLT_struct", !6, i64 0, !7, i64 8, !6, i64 16, !10, i64 24}
!25 = !{!24, !6, i64 16}
!26 = !{!24, !7, i64 8}
!27 = !{!13, !13, i64 0}
!28 = !{!24, !10, i64 24}
!29 = !{!12, !10, i64 8}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; 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_sPLT_struct = type { ptr, i8, ptr, i32 }

@.str.25 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [19 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

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

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

declare noalias ptr @png_realloc_array(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

declare void @png_chunk_report(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare noalias ptr @png_malloc_base(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @png_set_sPLT(ptr noalias noundef %0, ptr noalias noundef %1, ptr noundef readonly %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %1, null
  %or.cond = or i1 %5, %6
  %7 = icmp slt i32 %3, 1
  %or.cond3 = or i1 %or.cond, %7
  %8 = icmp eq ptr %2, null
  %or.cond5 = or i1 %8, %or.cond3
  br i1 %or.cond5, label %.thread70, label %9

9:                                                ; preds = %4
  %10 = getelementptr inbounds i8, ptr %1, i64 304
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 312
  %13 = load i32, ptr %12, align 8, !tbaa !19
  %14 = tail call noalias ptr @png_realloc_array(ptr noundef nonnull %0, ptr noundef %11, i32 noundef %13, i32 noundef %3, i64 noundef 32) #4
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %9
  tail call void @png_chunk_report(ptr noundef nonnull %0, ptr noundef nonnull @.str.25, i32 noundef 1) #4
  br label %.thread70

17:                                               ; preds = %9
  %18 = load ptr, ptr %10, align 8, !tbaa !5
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %18) #4
  store ptr %14, ptr %10, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 284
  %20 = load i32, ptr %19, align 4, !tbaa !20
  %21 = or i32 %20, 32
  store i32 %21, ptr %19, align 4, !tbaa !20
  %22 = load i32, ptr %12, align 8, !tbaa !19
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds %struct.png_sPLT_struct, ptr %14, i64 %23
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  br label %26

26:                                               ; preds = %62, %17
  %.056 = phi i32 [ %3, %17 ], [ %64, %62 ]
  %.055 = phi ptr [ %24, %17 ], [ %.1, %62 ]
  %.0 = phi ptr [ %2, %17 ], [ %63, %62 ]
  %27 = load ptr, ptr %.0, align 8, !tbaa !21
  %28 = icmp eq ptr %27, null
  br i1 %28, label %33, label %29

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %.0, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %29, %26
  tail call void @png_app_error(ptr noundef %0, ptr noundef nonnull @.str.26) #4
  br label %62

34:                                               ; preds = %29
  %35 = getelementptr inbounds i8, ptr %.0, i64 8
  %36 = load i8, ptr %35, align 8, !tbaa !24
  %37 = getelementptr inbounds i8, ptr %.055, i64 8
  store i8 %36, ptr %37, align 8, !tbaa !24
  %38 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #5
  %39 = add i64 %38, 1
  %40 = tail call noalias ptr @png_malloc_base(ptr noundef %0, i64 noundef %39) #4
  store ptr %40, ptr %.055, align 8, !tbaa !21
  %41 = icmp eq ptr %40, null
  br i1 %41, label %.loopexit, label %42

42:                                               ; preds = %34
  %43 = load ptr, ptr %.0, align 8, !tbaa !21
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %40, ptr align 1 %43, i64 %39, i1 false)
  %44 = getelementptr inbounds i8, ptr %.0, i64 24
  %45 = load i32, ptr %44, align 8, !tbaa !25
  %46 = tail call noalias ptr @png_malloc_array(ptr noundef %0, i32 noundef %45, i64 noundef 10) #4
  %47 = getelementptr inbounds i8, ptr %.055, i64 16
  store ptr %46, ptr %47, align 8, !tbaa !23
  %48 = icmp eq ptr %46, null
  br i1 %48, label %49, label %51

49:                                               ; preds = %42
  %50 = load ptr, ptr %.055, align 8, !tbaa !21
  tail call void @png_free(ptr noundef %0, ptr noundef %50) #4
  store ptr null, ptr %.055, align 8, !tbaa !21
  br label %.loopexit

51:                                               ; preds = %42
  %52 = load i32, ptr %44, align 8, !tbaa !25
  %53 = getelementptr inbounds i8, ptr %.055, i64 24
  store i32 %52, ptr %53, align 8, !tbaa !25
  %54 = load ptr, ptr %30, align 8, !tbaa !23
  %55 = sext i32 %52 to i64
  %56 = mul nsw i64 %55, 10
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 2 %46, ptr align 2 %54, i64 %56, i1 false)
  %57 = load i32, ptr %25, align 8, !tbaa !26
  %58 = or i32 %57, 8192
  store i32 %58, ptr %25, align 8, !tbaa !26
  %59 = load i32, ptr %12, align 8, !tbaa !19
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %12, align 8, !tbaa !19
  %61 = getelementptr inbounds i8, ptr %.055, i64 32
  br label %62

62:                                               ; preds = %33, %51
  %.1 = phi ptr [ %.055, %33 ], [ %61, %51 ]
  %63 = getelementptr inbounds i8, ptr %.0, i64 32
  %64 = add nsw i32 %.056, -1
  %.not = icmp eq i32 %64, 0
  br i1 %.not, label %.thread70, label %26, !llvm.loop !27

.loopexit:                                        ; preds = %34, %49
  %65 = icmp sgt i32 %.056, 0
  br i1 %65, label %66, label %.thread70

66:                                               ; preds = %.loopexit
  tail call void @png_chunk_report(ptr noundef %0, ptr noundef nonnull @.str.27, i32 noundef 1) #4
  br label %.thread70

.thread70:                                        ; preds = %62, %.loopexit, %66, %4, %16
  ret void
}

declare noalias ptr @png_malloc_array(ptr noundef, i32 noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }

!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 304}
!6 = !{!"png_info_def", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !12, i64 34, !8, i64 36, !8, i64 37, !8, i64 38, !8, i64 39, !8, i64 40, !8, i64 41, !8, i64 42, !8, i64 43, !8, i64 44, !13, i64 52, !11, i64 128, !11, i64 136, !7, i64 144, !7, i64 148, !7, i64 152, !11, i64 160, !16, i64 168, !17, i64 176, !11, i64 184, !18, i64 192, !18, i64 202, !7, i64 212, !7, i64 216, !8, i64 220, !7, i64 224, !7, i64 228, !8, i64 232, !11, i64 240, !11, i64 248, !7, i64 256, !7, i64 260, !11, i64 264, !11, i64 272, !8, i64 280, !8, i64 281, !7, i64 284, !11, i64 288, !7, i64 296, !11, i64 304, !7, i64 312, !8, i64 316, !11, i64 320, !11, i64 328, !11, i64 336}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"png_colorspace", !7, i64 0, !14, i64 4, !15, i64 36, !12, i64 72, !12, i64 74}
!14 = !{!"png_xy", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28}
!15 = !{!"png_XYZ", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32}
!16 = !{!"png_time_struct", !12, i64 0, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !8, i64 6}
!17 = !{!"png_color_8_struct", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4}
!18 = !{!"png_color_16_struct", !8, i64 0, !12, i64 2, !12, i64 4, !12, i64 6, !12, i64 8}
!19 = !{!6, !7, i64 312}
!20 = !{!6, !7, i64 284}
!21 = !{!22, !11, i64 0}
!22 = !{!"png_sPLT_struct", !11, i64 0, !8, i64 8, !11, i64 16, !7, i64 24}
!23 = !{!22, !11, i64 16}
!24 = !{!22, !8, i64 8}
!25 = !{!22, !7, i64 24}
!26 = !{!6, !7, i64 8}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass