; LLVM IR from niessner/Matterport :: code/gaps/pkgs/png (pngpread)

; 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, ptr, i8, i8, i32, i32, i32, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i32, i32, 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, i32, i32, 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, i32, i32, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i32, ptr, i8, i16, i16, i16, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, %struct.png_unknown_chunk_t, i32, i32, ptr, i32 }
%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 { i32, 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 }

@.str.6 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 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: 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) #2

; Function Attrs: nounwind uwtable
define dso_local void @png_push_save_buffer(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.png_struct_def, ptr %9, i32 0, i32 89
  %11 = load i64, ptr %10, align 8, !tbaa !9
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %13, label %48

13:                                               ; preds = %1
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.png_struct_def, ptr %14, i32 0, i32 83
  %16 = load ptr, ptr %15, align 8, !tbaa !20
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.png_struct_def, ptr %17, i32 0, i32 84
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = icmp ne ptr %16, %19
  br i1 %20, label %21, label %47

21:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.png_struct_def, ptr %22, i32 0, i32 89
  %24 = load i64, ptr %23, align 8, !tbaa !9
  store i64 %24, ptr %4, align 8, !tbaa !22
  store i64 0, ptr %3, align 8, !tbaa !22
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 83
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  store ptr %27, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_struct_def, ptr %28, i32 0, i32 84
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  store ptr %30, ptr %6, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %39, %21
  %32 = load i64, ptr %3, align 8, !tbaa !22
  %33 = load i64, ptr %4, align 8, !tbaa !22
  %34 = icmp ult i64 %32, %33
  br i1 %34, label %35, label %46

35:                                               ; preds = %31
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = load i8, ptr %36, align 1, !tbaa !23
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  store i8 %37, ptr %38, align 1, !tbaa !23
  br label %39

39:                                               ; preds = %35
  %40 = load i64, ptr %3, align 8, !tbaa !22
  %41 = add i64 %40, 1
  store i64 %41, ptr %3, align 8, !tbaa !22
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %42, i32 1
  store ptr %43, ptr %5, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %44, i32 1
  store ptr %45, ptr %6, align 8, !tbaa !5
  br label %31, !llvm.loop !24

46:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %47

47:                                               ; preds = %46, %13
  br label %48

48:                                               ; preds = %47, %1
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_struct_def, ptr %49, i32 0, i32 89
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.png_struct_def, ptr %52, i32 0, i32 92
  %54 = load i64, ptr %53, align 8, !tbaa !26
  %55 = add i64 %51, %54
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.png_struct_def, ptr %56, i32 0, i32 90
  %58 = load i64, ptr %57, align 8, !tbaa !27
  %59 = icmp ugt i64 %55, %58
  br i1 %59, label %60, label %110

60:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.png_struct_def, ptr %61, i32 0, i32 89
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.png_struct_def, ptr %64, i32 0, i32 92
  %66 = load i64, ptr %65, align 8, !tbaa !26
  %67 = add i64 %66, 256
  %68 = sub i64 -1, %67
  %69 = icmp ugt i64 %63, %68
  br i1 %69, label %70, label %72

70:                                               ; preds = %60
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  call void @png_error(ptr noundef %71, ptr noundef @.str.6)
  br label %72

72:                                               ; preds = %70, %60
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.png_struct_def, ptr %73, i32 0, i32 89
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.png_struct_def, ptr %76, i32 0, i32 92
  %78 = load i64, ptr %77, align 8, !tbaa !26
  %79 = add i64 %75, %78
  %80 = add i64 %79, 256
  store i64 %80, ptr %7, align 8, !tbaa !22
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 84
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  store ptr %83, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = load i64, ptr %7, align 8, !tbaa !22
  %86 = call ptr @png_malloc_warn(ptr noundef %84, i64 noundef %85)
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.png_struct_def, ptr %87, i32 0, i32 84
  store ptr %86, ptr %88, align 8, !tbaa !21
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.png_struct_def, ptr %89, i32 0, i32 84
  %91 = load ptr, ptr %90, align 8, !tbaa !21
  %92 = icmp eq ptr %91, null
  br i1 %92, label %93, label %97

93:                                               ; preds = %72
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %94, ptr noundef %95)
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  call void @png_error(ptr noundef %96, ptr noundef @.str.7)
  br label %97

97:                                               ; preds = %93, %72
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.png_struct_def, ptr %98, i32 0, i32 84
  %100 = load ptr, ptr %99, align 8, !tbaa !21
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.png_struct_def, ptr %102, i32 0, i32 89
  %104 = load i64, ptr %103, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %100, ptr align 1 %101, i64 %104, i1 false)
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  call void @png_free(ptr noundef %105, ptr noundef %106)
  %107 = load i64, ptr %7, align 8, !tbaa !22
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.png_struct_def, ptr %108, i32 0, i32 90
  store i64 %107, ptr %109, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %110

110:                                              ; preds = %97, %48
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.png_struct_def, ptr %111, i32 0, i32 92
  %113 = load i64, ptr %112, align 8, !tbaa !26
  %114 = icmp ne i64 %113, 0
  br i1 %114, label %115, label %138

115:                                              ; preds = %110
  %116 = load ptr, ptr %2, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.png_struct_def, ptr %116, i32 0, i32 84
  %118 = load ptr, ptr %117, align 8, !tbaa !21
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.png_struct_def, ptr %119, i32 0, i32 89
  %121 = load i64, ptr %120, align 8, !tbaa !9
  %122 = getelementptr inbounds i8, ptr %118, i64 %121
  %123 = load ptr, ptr %2, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.png_struct_def, ptr %123, i32 0, i32 85
  %125 = load ptr, ptr %124, align 8, !tbaa !28
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.png_struct_def, ptr %126, i32 0, i32 92
  %128 = load i64, ptr %127, align 8, !tbaa !26
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %122, ptr align 1 %125, i64 %128, i1 false)
  %129 = load ptr, ptr %2, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.png_struct_def, ptr %129, i32 0, i32 92
  %131 = load i64, ptr %130, align 8, !tbaa !26
  %132 = load ptr, ptr %2, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_struct_def, ptr %132, i32 0, i32 89
  %134 = load i64, ptr %133, align 8, !tbaa !9
  %135 = add i64 %134, %131
  store i64 %135, ptr %133, align 8, !tbaa !9
  %136 = load ptr, ptr %2, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.png_struct_def, ptr %136, i32 0, i32 92
  store i64 0, ptr %137, align 8, !tbaa !26
  br label %138

138:                                              ; preds = %115, %110
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.png_struct_def, ptr %139, i32 0, i32 84
  %141 = load ptr, ptr %140, align 8, !tbaa !21
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.png_struct_def, ptr %142, i32 0, i32 83
  store ptr %141, ptr %143, align 8, !tbaa !20
  %144 = load ptr, ptr %2, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_struct_def, ptr %144, i32 0, i32 91
  store i64 0, ptr %145, align 8, !tbaa !29
  ret void
}

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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, !13, i64 832}
!10 = !{!"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, !6, i64 272, !7, i64 280, !7, i64 281, !11, i64 284, !11, i64 288, !11, i64 292, !12, i64 296, !6, i64 408, !13, i64 416, !11, i64 424, !11, i64 428, !11, i64 432, !11, i64 436, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !13, i64 464, !13, i64 472, !11, i64 480, !11, i64 484, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !14, i64 536, !11, i64 560, !11, i64 564, !6, i64 568, !15, i64 576, !15, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !15, i64 598, !7, i64 600, !16, i64 604, !17, i64 608, !17, i64 618, !6, i64 632, !11, i64 640, !11, i64 644, !11, i64 648, !16, i64 652, !16, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !18, i64 712, !18, i64 717, !6, i64 728, !17, i64 736, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !11, i64 824, !11, i64 828, !13, i64 832, !13, i64 840, !13, i64 848, !13, i64 856, !11, i64 864, !11, i64 868, !13, i64 872, !13, i64 880, !6, i64 888, !6, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !7, i64 928, !7, i64 929, !6, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !11, i64 984, !6, i64 992, !6, i64 1000, !11, i64 1008, !6, i64 1016, !7, i64 1024, !15, i64 1026, !15, i64 1028, !15, i64 1030, !11, i64 1032, !11, i64 1036, !7, i64 1040, !6, i64 1048, !6, i64 1056, !6, i64 1064, !6, i64 1072, !6, i64 1080, !6, i64 1088, !6, i64 1096, !7, i64 1104, !11, i64 1108, !11, i64 1112, !11, i64 1116, !19, i64 1120, !11, i64 1152, !11, i64 1156, !6, i64 1160, !11, i64 1168}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !6, i64 0, !11, i64 8, !13, i64 16, !6, i64 24, !11, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !11, i64 88, !13, i64 96, !13, i64 104}
!13 = !{!"long", !7, i64 0}
!14 = !{!"png_row_info_struct", !11, i64 0, !13, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!15 = !{!"short", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!18 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!19 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!20 = !{!10, !6, i64 792}
!21 = !{!10, !6, i64 800}
!22 = !{!13, !13, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!10, !13, i64 856}
!27 = !{!10, !13, i64 840}
!28 = !{!10, !6, i64 808}
!29 = !{!10, !13, i64 848}


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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_push_save_buffer(ptr noundef %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 832
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %.loopexit, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 792
  %6 = load ptr, ptr %5, align 8, !tbaa !19
  %7 = getelementptr inbounds i8, ptr %0, i64 800
  %8 = load ptr, ptr %7, align 8, !tbaa !20
  %.not52 = icmp eq ptr %6, %8
  br i1 %.not52, label %.loopexit, label %iter.check

iter.check:                                       ; preds = %4
  %9 = ptrtoint ptr %8 to i64
  %10 = ptrtoint ptr %6 to i64
  %min.iters.check = icmp ult i64 %3, 8
  %11 = sub i64 %9, %10
  %diff.check = icmp ult i64 %11, 32
  %or.cond = or i1 %min.iters.check, %diff.check
  br i1 %or.cond, label %.preheader.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check60 = icmp ult i64 %3, 32
  br i1 %min.iters.check60, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %3, -32
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %next.gep = getelementptr i8, ptr %6, i64 %index
  %next.gep62 = getelementptr i8, ptr %8, i64 %index
  %12 = getelementptr i8, ptr %next.gep, i64 16
  %wide.load = load <16 x i8>, ptr %next.gep, align 1, !tbaa !21
  %wide.load64 = load <16 x i8>, ptr %12, align 1, !tbaa !21
  %13 = getelementptr i8, ptr %next.gep62, i64 16
  store <16 x i8> %wide.load, ptr %next.gep62, align 1, !tbaa !21
  store <16 x i8> %wide.load64, ptr %13, align 1, !tbaa !21
  %index.next = add nuw i64 %index, 32
  %14 = icmp eq i64 %index.next, %n.vec
  br i1 %14, label %middle.block, label %vector.body, !llvm.loop !22

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %3, %n.vec
  br i1 %cmp.n, label %.loopexit.loopexit, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %ind.end70 = getelementptr i8, ptr %8, i64 %n.vec
  %ind.end67 = getelementptr i8, ptr %6, i64 %n.vec
  %n.vec.remaining = and i64 %3, 24
  %min.epilog.iters.check = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check, label %.preheader.preheader, label %vec.epilog.ph

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec66 = and i64 %3, -8
  %ind.end = getelementptr i8, ptr %6, i64 %n.vec66
  %ind.end69 = getelementptr i8, ptr %8, i64 %n.vec66
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index72 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next76, %vec.epilog.vector.body ]
  %next.gep73 = getelementptr i8, ptr %6, i64 %index72
  %next.gep74 = getelementptr i8, ptr %8, i64 %index72
  %wide.load75 = load <8 x i8>, ptr %next.gep73, align 1, !tbaa !21
  store <8 x i8> %wide.load75, ptr %next.gep74, align 1, !tbaa !21
  %index.next76 = add nuw i64 %index72, 8
  %15 = icmp eq i64 %index.next76, %n.vec66
  br i1 %15, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !26

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n77 = icmp eq i64 %3, %n.vec66
  br i1 %cmp.n77, label %.loopexit.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %.056.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec66, %vec.epilog.middle.block ]
  %.04655.ph = phi ptr [ %6, %iter.check ], [ %ind.end67, %vec.epilog.iter.check ], [ %ind.end, %vec.epilog.middle.block ]
  %.04754.ph = phi ptr [ %8, %iter.check ], [ %ind.end70, %vec.epilog.iter.check ], [ %ind.end69, %vec.epilog.middle.block ]
  %xtraiter = and i64 %3, 7
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader.prol.loopexit, label %.preheader.prol

.preheader.prol:                                  ; preds = %.preheader.preheader, %.preheader.prol
  %.056.prol = phi i64 [ %17, %.preheader.prol ], [ %.056.ph, %.preheader.preheader ]
  %.04655.prol = phi ptr [ %18, %.preheader.prol ], [ %.04655.ph, %.preheader.preheader ]
  %.04754.prol = phi ptr [ %19, %.preheader.prol ], [ %.04754.ph, %.preheader.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.preheader.prol ], [ 0, %.preheader.preheader ]
  %16 = load i8, ptr %.04655.prol, align 1, !tbaa !21
  store i8 %16, ptr %.04754.prol, align 1, !tbaa !21
  %17 = add nuw i64 %.056.prol, 1
  %18 = getelementptr inbounds i8, ptr %.04655.prol, i64 1
  %19 = getelementptr inbounds i8, ptr %.04754.prol, i64 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.preheader.prol.loopexit, label %.preheader.prol, !llvm.loop !27

.preheader.prol.loopexit:                         ; preds = %.preheader.prol, %.preheader.preheader
  %.056.unr = phi i64 [ %.056.ph, %.preheader.preheader ], [ %17, %.preheader.prol ]
  %.04655.unr = phi ptr [ %.04655.ph, %.preheader.preheader ], [ %18, %.preheader.prol ]
  %.04754.unr = phi ptr [ %.04754.ph, %.preheader.preheader ], [ %19, %.preheader.prol ]
  %20 = sub i64 %.056.ph, %3
  %21 = icmp ugt i64 %20, -8
  br i1 %21, label %.loopexit.loopexit, label %.preheader

.preheader:                                       ; preds = %.preheader.prol.loopexit, %.preheader
  %.056 = phi i64 [ %44, %.preheader ], [ %.056.unr, %.preheader.prol.loopexit ]
  %.04655 = phi ptr [ %45, %.preheader ], [ %.04655.unr, %.preheader.prol.loopexit ]
  %.04754 = phi ptr [ %46, %.preheader ], [ %.04754.unr, %.preheader.prol.loopexit ]
  %22 = load i8, ptr %.04655, align 1, !tbaa !21
  store i8 %22, ptr %.04754, align 1, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %.04655, i64 1
  %24 = getelementptr inbounds i8, ptr %.04754, i64 1
  %25 = load i8, ptr %23, align 1, !tbaa !21
  store i8 %25, ptr %24, align 1, !tbaa !21
  %26 = getelementptr inbounds i8, ptr %.04655, i64 2
  %27 = getelementptr inbounds i8, ptr %.04754, i64 2
  %28 = load i8, ptr %26, align 1, !tbaa !21
  store i8 %28, ptr %27, align 1, !tbaa !21
  %29 = getelementptr inbounds i8, ptr %.04655, i64 3
  %30 = getelementptr inbounds i8, ptr %.04754, i64 3
  %31 = load i8, ptr %29, align 1, !tbaa !21
  store i8 %31, ptr %30, align 1, !tbaa !21
  %32 = getelementptr inbounds i8, ptr %.04655, i64 4
  %33 = getelementptr inbounds i8, ptr %.04754, i64 4
  %34 = load i8, ptr %32, align 1, !tbaa !21
  store i8 %34, ptr %33, align 1, !tbaa !21
  %35 = getelementptr inbounds i8, ptr %.04655, i64 5
  %36 = getelementptr inbounds i8, ptr %.04754, i64 5
  %37 = load i8, ptr %35, align 1, !tbaa !21
  store i8 %37, ptr %36, align 1, !tbaa !21
  %38 = getelementptr inbounds i8, ptr %.04655, i64 6
  %39 = getelementptr inbounds i8, ptr %.04754, i64 6
  %40 = load i8, ptr %38, align 1, !tbaa !21
  store i8 %40, ptr %39, align 1, !tbaa !21
  %41 = getelementptr inbounds i8, ptr %.04655, i64 7
  %42 = getelementptr inbounds i8, ptr %.04754, i64 7
  %43 = load i8, ptr %41, align 1, !tbaa !21
  store i8 %43, ptr %42, align 1, !tbaa !21
  %44 = add nuw i64 %.056, 8
  %45 = getelementptr inbounds i8, ptr %.04655, i64 8
  %46 = getelementptr inbounds i8, ptr %.04754, i64 8
  %exitcond.not.7 = icmp eq i64 %44, %3
  br i1 %exitcond.not.7, label %.loopexit.loopexit, label %.preheader, !llvm.loop !29

.loopexit.loopexit:                               ; preds = %.preheader.prol.loopexit, %.preheader, %vec.epilog.middle.block, %middle.block
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %4, %1
  %47 = phi i64 [ %.pre, %.loopexit.loopexit ], [ %3, %4 ], [ 0, %1 ]
  %48 = getelementptr inbounds i8, ptr %0, i64 856
  %49 = load i64, ptr %48, align 8, !tbaa !30
  %50 = add i64 %49, %47
  %51 = getelementptr inbounds i8, ptr %0, i64 840
  %52 = load i64, ptr %51, align 8, !tbaa !31
  %53 = icmp ugt i64 %50, %52
  br i1 %53, label %54, label %71

54:                                               ; preds = %.loopexit
  %55 = sub i64 -257, %49
  %56 = icmp ugt i64 %47, %55
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.6) #3
  %.pre57 = load i64, ptr %2, align 8, !tbaa !5
  %.pre58 = load i64, ptr %48, align 8, !tbaa !30
  br label %58

58:                                               ; preds = %57, %54
  %59 = phi i64 [ %.pre58, %57 ], [ %49, %54 ]
  %60 = phi i64 [ %.pre57, %57 ], [ %47, %54 ]
  %61 = add i64 %60, 256
  %62 = add i64 %61, %59
  %63 = getelementptr inbounds i8, ptr %0, i64 800
  %64 = load ptr, ptr %63, align 8, !tbaa !20
  %65 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %62) #3
  store ptr %65, ptr %63, align 8, !tbaa !20
  %66 = icmp eq ptr %65, null
  br i1 %66, label %67, label %68

67:                                               ; preds = %58
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %64) #3
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.7) #3
  %.pre59 = load ptr, ptr %63, align 8, !tbaa !20
  br label %68

68:                                               ; preds = %67, %58
  %69 = phi ptr [ %.pre59, %67 ], [ %65, %58 ]
  %70 = load i64, ptr %2, align 8, !tbaa !5
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %69, ptr align 1 %64, i64 %70, i1 false)
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %64) #3
  store i64 %62, ptr %51, align 8, !tbaa !31
  %.pr = load i64, ptr %48, align 8, !tbaa !30
  br label %71

71:                                               ; preds = %68, %.loopexit
  %72 = phi i64 [ %.pr, %68 ], [ %49, %.loopexit ]
  %.not53 = icmp eq i64 %72, 0
  br i1 %.not53, label %83, label %73

73:                                               ; preds = %71
  %74 = getelementptr inbounds i8, ptr %0, i64 800
  %75 = load ptr, ptr %74, align 8, !tbaa !20
  %76 = load i64, ptr %2, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %75, i64 %76
  %78 = getelementptr inbounds i8, ptr %0, i64 808
  %79 = load ptr, ptr %78, align 8, !tbaa !32
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %77, ptr align 1 %79, i64 %72, i1 false)
  %80 = load i64, ptr %48, align 8, !tbaa !30
  %81 = load i64, ptr %2, align 8, !tbaa !5
  %82 = add i64 %81, %80
  store i64 %82, ptr %2, align 8, !tbaa !5
  store i64 0, ptr %48, align 8, !tbaa !30
  br label %83

83:                                               ; preds = %73, %71
  %84 = getelementptr inbounds i8, ptr %0, i64 800
  %85 = load ptr, ptr %84, align 8, !tbaa !20
  %86 = getelementptr inbounds i8, ptr %0, i64 792
  store ptr %85, ptr %86, align 8, !tbaa !19
  %87 = getelementptr inbounds i8, ptr %0, i64 848
  store i64 0, ptr %87, align 8, !tbaa !33
  ret void
}

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

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

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !12, i64 832}
!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, !9, i64 272, !7, i64 280, !7, i64 281, !10, i64 284, !10, i64 288, !10, i64 292, !11, i64 296, !9, i64 408, !12, i64 416, !10, i64 424, !10, i64 428, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !12, i64 464, !12, i64 472, !10, i64 480, !10, i64 484, !9, i64 488, !9, i64 496, !9, i64 504, !9, i64 512, !9, i64 520, !9, i64 528, !13, i64 536, !10, i64 560, !10, i64 564, !9, i64 568, !14, i64 576, !14, i64 578, !7, i64 580, !7, i64 585, !7, i64 586, !7, i64 587, !7, i64 588, !7, i64 589, !7, i64 590, !7, i64 591, !7, i64 592, !7, i64 593, !7, i64 594, !7, i64 595, !7, i64 596, !14, i64 598, !7, i64 600, !15, i64 604, !16, i64 608, !16, i64 618, !9, i64 632, !10, i64 640, !10, i64 644, !10, i64 648, !15, i64 652, !15, i64 656, !9, i64 664, !9, i64 672, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !17, i64 712, !17, i64 717, !9, i64 728, !16, i64 736, !9, i64 752, !9, i64 760, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !10, i64 824, !10, i64 828, !12, i64 832, !12, i64 840, !12, i64 848, !12, i64 856, !10, i64 864, !10, i64 868, !12, i64 872, !12, i64 880, !9, i64 888, !9, i64 896, !9, i64 904, !9, i64 912, !9, i64 920, !7, i64 928, !7, i64 929, !9, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !10, i64 984, !9, i64 992, !9, i64 1000, !10, i64 1008, !9, i64 1016, !7, i64 1024, !14, i64 1026, !14, i64 1028, !14, i64 1030, !10, i64 1032, !10, i64 1036, !7, i64 1040, !9, i64 1048, !9, i64 1056, !9, i64 1064, !9, i64 1072, !9, i64 1080, !9, i64 1088, !9, i64 1096, !7, i64 1104, !10, i64 1108, !10, i64 1112, !10, i64 1116, !18, i64 1120, !10, i64 1152, !10, i64 1156, !9, i64 1160, !10, i64 1168}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !10, i64 8, !12, i64 16, !9, i64 24, !10, i64 32, !12, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !10, i64 88, !12, i64 96, !12, i64 104}
!12 = !{!"long", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !12, 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, !12, i64 16, !7, i64 24}
!19 = !{!6, !9, i64 792}
!20 = !{!6, !9, i64 800}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23, !24, !25}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = distinct !{!26, !23, !24, !25}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.unroll.disable"}
!29 = distinct !{!29, !23, !24}
!30 = !{!6, !12, i64 856}
!31 = !{!6, !12, i64 840}
!32 = !{!6, !9, i64 808}
!33 = !{!6, !12, i64 848}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass