; LLVM IR from rdguez-mariano/fast_imas_IPOL :: io_png/libs/png (pngread)

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%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, ptr }
%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 }

@png_libpng_ver = external constant [18 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 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_warning(ptr noundef, ptr noundef) #1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_read_init_3(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 [1 x %struct.__jmp_buf_tag], align 16
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = 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 200, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %12, ptr %9, align 8, !tbaa !5
  %13 = load ptr, ptr %9, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %3
  store i32 1, ptr %10, align 4
  br label %108

16:                                               ; preds = %3
  br label %17

17:                                               ; preds = %35, %16
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load i32, ptr %8, align 4, !tbaa !11
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %18, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !13
  %23 = sext i8 %22 to i32
  %24 = load i32, ptr %8, align 4, !tbaa !11
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [18 x i8], ptr @png_libpng_ver, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !13
  %28 = sext i8 %27 to i32
  %29 = icmp ne i32 %23, %28
  br i1 %29, label %30, label %34

30:                                               ; preds = %17
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.png_struct_def, ptr %31, i32 0, i32 2
  store ptr null, ptr %32, align 8, !tbaa !14
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_warning(ptr noundef %33, ptr noundef @.str.10)
  br label %42

34:                                               ; preds = %17
  br label %35

35:                                               ; preds = %34
  %36 = load i32, ptr %8, align 4, !tbaa !11
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %8, align 4, !tbaa !11
  %38 = sext i32 %36 to i64
  %39 = getelementptr inbounds [18 x i8], ptr @png_libpng_ver, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %17, label %42, !llvm.loop !23

42:                                               ; preds = %35, %30
  %43 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %7, i64 0, i64 0
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.png_struct_def, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %45, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %43, ptr align 8 %46, i64 200, i1 false)
  %47 = load i64, ptr %6, align 8, !tbaa !9
  %48 = icmp ugt i64 1264, %47
  br i1 %48, label %49, label %55

49:                                               ; preds = %42
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_destroy_struct(ptr noundef %50)
  %51 = call ptr @png_create_struct(i32 noundef 1)
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %51, ptr %52, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  store ptr %54, ptr %9, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %49, %42
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %56, i8 0, i64 1264, i1 false)
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.png_struct_def, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %59, ptr align 16 %60, i64 200, i1 false)
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 132
  store i64 1000000, ptr %62, align 8, !tbaa !25
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.png_struct_def, ptr %63, i32 0, i32 133
  store i64 1000000, ptr %64, align 8, !tbaa !26
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.png_struct_def, ptr %65, i32 0, i32 17
  store i64 8192, ptr %66, align 8, !tbaa !27
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.png_struct_def, ptr %68, i32 0, i32 17
  %70 = load i64, ptr %69, align 8, !tbaa !27
  %71 = call ptr @png_malloc(ptr noundef %67, i64 noundef %70)
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.png_struct_def, ptr %72, i32 0, i32 16
  store ptr %71, ptr %73, align 8, !tbaa !28
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.png_struct_def, ptr %74, i32 0, i32 15
  %76 = getelementptr inbounds %struct.z_stream_s, ptr %75, i32 0, i32 8
  store ptr @png_zalloc, ptr %76, align 8, !tbaa !29
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.png_struct_def, ptr %77, i32 0, i32 15
  %79 = getelementptr inbounds %struct.z_stream_s, ptr %78, i32 0, i32 9
  store ptr @png_zfree, ptr %79, align 8, !tbaa !30
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 15
  %83 = getelementptr inbounds %struct.z_stream_s, ptr %82, i32 0, i32 10
  store ptr %80, ptr %83, align 8, !tbaa !31
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.png_struct_def, ptr %84, i32 0, i32 15
  %86 = call i32 @inflateInit_(ptr noundef %85, ptr noundef @.str.3, i32 noundef 112)
  switch i32 %86, label %91 [
    i32 0, label %93
    i32 -4, label %87
    i32 -2, label %87
    i32 -6, label %89
  ]

87:                                               ; preds = %55, %55
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %88, ptr noundef @.str.11)
  br label %93

89:                                               ; preds = %55
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %90, ptr noundef @.str.12)
  br label %93

91:                                               ; preds = %55
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_error(ptr noundef %92, ptr noundef @.str.6)
  br label %93

93:                                               ; preds = %91, %89, %87, %55
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.png_struct_def, ptr %94, i32 0, i32 16
  %96 = load ptr, ptr %95, align 8, !tbaa !28
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.png_struct_def, ptr %97, i32 0, i32 15
  %99 = getelementptr inbounds %struct.z_stream_s, ptr %98, i32 0, i32 3
  store ptr %96, ptr %99, align 8, !tbaa !32
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.png_struct_def, ptr %100, i32 0, i32 17
  %102 = load i64, ptr %101, align 8, !tbaa !27
  %103 = trunc i64 %102 to i32
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.png_struct_def, ptr %104, i32 0, i32 15
  %106 = getelementptr inbounds %struct.z_stream_s, ptr %105, i32 0, i32 4
  store i32 %103, ptr %106, align 8, !tbaa !33
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_set_read_fn(ptr noundef %107, ptr noundef null, ptr noundef null)
  store i32 0, ptr %10, align 4
  br label %108

108:                                              ; preds = %93, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr %7) #5
  %109 = load i32, ptr %10, align 4
  switch i32 %109, label %111 [
    i32 0, label %110
    i32 1, label %110
  ]

110:                                              ; preds = %108, %108
  ret void

111:                                              ; preds = %108
  unreachable
}

; 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) #3

declare void @png_destroy_struct(ptr noundef) #1

declare ptr @png_create_struct(i32 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 208}
!15 = !{!"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, !16, i64 304, !6, 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, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !17, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !18, i64 616, !18, 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, !18, i64 638, !7, i64 640, !19, i64 644, !20, i64 648, !20, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !19, i64 700, !19, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !21, i64 760, !21, i64 765, !6, i64 776, !20, 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, !12, i64 920, !12, 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, !12, i64 1064, !6, i64 1072, !7, i64 1080, !18, i64 1082, !18, i64 1084, !18, 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, !22, i64 1208, !10, i64 1240, !10, i64 1248, !6, i64 1256}
!16 = !{!"z_stream_s", !6, i64 0, !12, i64 8, !10, i64 16, !6, i64 24, !12, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!17 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!18 = !{!"short", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!"png_color_16_struct", !7, i64 0, !18, i64 2, !18, i64 4, !18, i64 6, !18, i64 8}
!21 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!22 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !10, i64 16, !7, i64 24}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!15, !10, i64 1192}
!26 = !{!15, !10, i64 1200}
!27 = !{!15, !10, i64 424}
!28 = !{!15, !6, i64 416}
!29 = !{!15, !6, i64 368}
!30 = !{!15, !6, i64 376}
!31 = !{!15, !6, i64 384}
!32 = !{!15, !6, i64 328}
!33 = !{!15, !12, i64 336}


; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@png_libpng_ver = external local_unnamed_addr constant [18 x i8], align 16
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [13 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_warning(ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_read_init_3(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #2 {
  %.sroa.0 = alloca %struct.__jmp_buf_tag, align 16
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %.sroa.0)
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %36, label %.preheader

.preheader:                                       ; preds = %3, %12
  %indvars.iv = phi i64 [ %indvars.iv.next, %12 ], [ 0, %3 ]
  %6 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  %7 = load i8, ptr %6, align 1, !tbaa !9
  %8 = getelementptr inbounds [18 x i8], ptr @png_libpng_ver, i64 0, i64 %indvars.iv
  %9 = load i8, ptr %8, align 1, !tbaa !9
  %.not = icmp eq i8 %7, %9
  br i1 %.not, label %12, label %10

10:                                               ; preds = %.preheader
  %11 = getelementptr inbounds i8, ptr %4, i64 208
  store ptr null, ptr %11, align 8, !tbaa !10
  tail call void @png_warning(ptr noundef nonnull %4, ptr noundef nonnull @.str.10) #5
  br label %.loopexit

12:                                               ; preds = %.preheader
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not34 = icmp eq i8 %7, 0
  br i1 %.not34, label %.loopexit, label %.preheader, !llvm.loop !21

.loopexit:                                        ; preds = %12, %10
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(200) %.sroa.0, ptr noundef nonnull align 8 dereferenceable(200) %4, i64 200, i1 false)
  %13 = icmp ult i64 %2, 1264
  br i1 %13, label %14, label %16

14:                                               ; preds = %.loopexit
  tail call void @png_destroy_struct(ptr noundef nonnull %4) #5
  %15 = tail call ptr @png_create_struct(i32 noundef 1) #5
  store ptr %15, ptr %0, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %14, %.loopexit
  %.0 = phi ptr [ %15, %14 ], [ %4, %.loopexit ]
  %17 = getelementptr i8, ptr %.0, i64 200
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1064) %17, i8 0, i64 1064, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(200) %.0, ptr noundef nonnull align 16 dereferenceable(200) %.sroa.0, i64 200, i1 false)
  %18 = getelementptr inbounds i8, ptr %.0, i64 1192
  store i64 1000000, ptr %18, align 8, !tbaa !23
  %19 = getelementptr inbounds i8, ptr %.0, i64 1200
  store i64 1000000, ptr %19, align 8, !tbaa !24
  %20 = getelementptr inbounds i8, ptr %.0, i64 424
  store i64 8192, ptr %20, align 8, !tbaa !25
  %21 = tail call ptr @png_malloc(ptr noundef %.0, i64 noundef 8192) #5
  %22 = getelementptr inbounds i8, ptr %.0, i64 416
  store ptr %21, ptr %22, align 8, !tbaa !26
  %23 = getelementptr inbounds i8, ptr %.0, i64 304
  %24 = getelementptr inbounds i8, ptr %.0, i64 368
  store ptr @png_zalloc, ptr %24, align 8, !tbaa !27
  %25 = getelementptr inbounds i8, ptr %.0, i64 376
  store ptr @png_zfree, ptr %25, align 8, !tbaa !28
  %26 = getelementptr inbounds i8, ptr %.0, i64 384
  store ptr %.0, ptr %26, align 8, !tbaa !29
  %27 = tail call i32 @inflateInit_(ptr noundef nonnull %23, ptr noundef nonnull @.str.3, i32 noundef 112) #5
  switch i32 %27, label %29 [
    i32 0, label %30
    i32 -4, label %.sink.split
    i32 -2, label %.sink.split
    i32 -6, label %28
  ]

28:                                               ; preds = %16
  br label %.sink.split

29:                                               ; preds = %16
  br label %.sink.split

.sink.split:                                      ; preds = %16, %16, %28, %29
  %.str.6.sink = phi ptr [ @.str.6, %29 ], [ @.str.12, %28 ], [ @.str.11, %16 ], [ @.str.11, %16 ]
  tail call void @png_error(ptr noundef nonnull %.0, ptr noundef nonnull %.str.6.sink) #5
  br label %30

30:                                               ; preds = %.sink.split, %16
  %31 = load ptr, ptr %22, align 8, !tbaa !26
  %32 = getelementptr inbounds i8, ptr %.0, i64 328
  store ptr %31, ptr %32, align 8, !tbaa !30
  %33 = load i64, ptr %20, align 8, !tbaa !25
  %34 = trunc i64 %33 to i32
  %35 = getelementptr inbounds i8, ptr %.0, i64 336
  store i32 %34, ptr %35, align 8, !tbaa !31
  tail call void @png_set_read_fn(ptr noundef nonnull %.0, ptr noundef null, ptr noundef null) #5
  br label %36

36:                                               ; preds = %3, %30
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %.sroa.0)
  ret void
}

; 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) #3

declare void @png_destroy_struct(ptr noundef) local_unnamed_addr #1

declare ptr @png_create_struct(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 208}
!11 = !{!"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, !12, i64 280, !12, i64 288, !12, i64 296, !13, i64 304, !6, i64 416, !12, i64 424, !14, i64 432, !14, i64 436, !14, i64 440, !14, i64 444, !14, i64 448, !12, i64 456, !12, i64 464, !12, i64 472, !12, i64 480, !12, i64 488, !12, i64 496, !12, i64 504, !12, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !15, i64 568, !12, i64 592, !12, 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, !12, i64 680, !12, 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, !12, i64 872, !12, i64 880, !12, i64 888, !12, i64 896, !12, i64 904, !12, i64 912, !14, i64 920, !14, i64 924, !12, i64 928, !12, 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, !12, 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, !12, i64 1088, !12, i64 1096, !7, i64 1104, !7, i64 1105, !12, i64 1112, !12, 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, !12, i64 1192, !12, i64 1200, !20, i64 1208, !12, i64 1240, !12, i64 1248, !6, i64 1256}
!12 = !{!"long", !7, i64 0}
!13 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !12, i64 16, !6, i64 24, !14, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !12, i64 96, !12, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!"png_row_info_struct", !12, i64 0, !12, 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, !12, i64 16, !7, i64 24}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!11, !12, i64 1192}
!24 = !{!11, !12, i64 1200}
!25 = !{!11, !12, i64 424}
!26 = !{!11, !6, i64 416}
!27 = !{!11, !6, i64 368}
!28 = !{!11, !6, i64 376}
!29 = !{!11, !6, i64 384}
!30 = !{!11, !6, i64 328}
!31 = !{!11, !14, i64 336}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass