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

; 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_sPLT_struct = type { ptr, i8, ptr, i32 }
%struct.png_sPLT_entry_struct = type { i16, i16, i16, i16, i16 }

@__const.png_write_sPLT.png_sPLT = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @png_save_uint_16(ptr noundef, i32 noundef) #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 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_start(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_data(ptr noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_end(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @png_check_keyword(ptr noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @png_write_sPLT(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [5 x i8], align 1
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [10 x i8], align 1
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 5, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %5, ptr align 1 @__const.png_write_sPLT.png_sPLT, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 10, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.png_sPLT_struct, ptr %13, i32 0, i32 1
  %15 = load i8, ptr %14, align 8, !tbaa !9
  %16 = zext i8 %15 to i32
  %17 = icmp eq i32 %16, 8
  %18 = zext i1 %17 to i64
  %19 = select i1 %17, i32 6, i32 10
  %20 = sext i32 %19 to i64
  store i64 %20, ptr %9, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %21 = load i64, ptr %9, align 8, !tbaa !12
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.png_sPLT_struct, ptr %22, i32 0, i32 3
  %24 = load i32, ptr %23, align 8, !tbaa !14
  %25 = sext i32 %24 to i64
  %26 = mul i64 %21, %25
  store i64 %26, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.png_sPLT_struct, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = call i64 @png_check_keyword(ptr noundef %27, ptr noundef %30, ptr noundef %7)
  store i64 %31, ptr %6, align 8, !tbaa !12
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %2
  store i32 1, ptr %12, align 4
  br label %138

34:                                               ; preds = %2
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds [5 x i8], ptr %5, i64 0, i64 0
  %37 = load i64, ptr %6, align 8, !tbaa !12
  %38 = add i64 %37, 2
  %39 = load i64, ptr %10, align 8, !tbaa !12
  %40 = add i64 %38, %39
  %41 = trunc i64 %40 to i32
  call void @png_write_chunk_start(ptr noundef %35, ptr noundef %36, i32 noundef %41)
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load i64, ptr %6, align 8, !tbaa !12
  %45 = add i64 %44, 1
  call void @png_write_chunk_data(ptr noundef %42, ptr noundef %43, i64 noundef %45)
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_sPLT_struct, ptr %47, i32 0, i32 1
  call void @png_write_chunk_data(ptr noundef %46, ptr noundef %48, i64 noundef 1)
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_sPLT_struct, ptr %49, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  store ptr %51, ptr %11, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %131, %34
  %53 = load ptr, ptr %11, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.png_sPLT_struct, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.png_sPLT_struct, ptr %57, i32 0, i32 3
  %59 = load i32, ptr %58, align 8, !tbaa !14
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %56, i64 %60
  %62 = icmp ult ptr %53, %61
  br i1 %62, label %63, label %134

63:                                               ; preds = %52
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.png_sPLT_struct, ptr %64, i32 0, i32 1
  %66 = load i8, ptr %65, align 8, !tbaa !9
  %67 = zext i8 %66 to i32
  %68 = icmp eq i32 %67, 8
  br i1 %68, label %69, label %96

69:                                               ; preds = %63
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %70, i32 0, i32 0
  %72 = load i16, ptr %71, align 2, !tbaa !17
  %73 = trunc i16 %72 to i8
  %74 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  store i8 %73, ptr %74, align 1, !tbaa !20
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %75, i32 0, i32 1
  %77 = load i16, ptr %76, align 2, !tbaa !21
  %78 = trunc i16 %77 to i8
  %79 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 1
  store i8 %78, ptr %79, align 1, !tbaa !20
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %80, i32 0, i32 2
  %82 = load i16, ptr %81, align 2, !tbaa !22
  %83 = trunc i16 %82 to i8
  %84 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 2
  store i8 %83, ptr %84, align 1, !tbaa !20
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %85, i32 0, i32 3
  %87 = load i16, ptr %86, align 2, !tbaa !23
  %88 = trunc i16 %87 to i8
  %89 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 3
  store i8 %88, ptr %89, align 1, !tbaa !20
  %90 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %91 = getelementptr inbounds i8, ptr %90, i64 4
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %92, i32 0, i32 4
  %94 = load i16, ptr %93, align 2, !tbaa !24
  %95 = zext i16 %94 to i32
  call void @png_save_uint_16(ptr noundef %91, i32 noundef %95)
  br label %127

96:                                               ; preds = %63
  %97 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %98 = getelementptr inbounds i8, ptr %97, i64 0
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %99, i32 0, i32 0
  %101 = load i16, ptr %100, align 2, !tbaa !17
  %102 = zext i16 %101 to i32
  call void @png_save_uint_16(ptr noundef %98, i32 noundef %102)
  %103 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %104 = getelementptr inbounds i8, ptr %103, i64 2
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %105, i32 0, i32 1
  %107 = load i16, ptr %106, align 2, !tbaa !21
  %108 = zext i16 %107 to i32
  call void @png_save_uint_16(ptr noundef %104, i32 noundef %108)
  %109 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %110 = getelementptr inbounds i8, ptr %109, i64 4
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %111, i32 0, i32 2
  %113 = load i16, ptr %112, align 2, !tbaa !22
  %114 = zext i16 %113 to i32
  call void @png_save_uint_16(ptr noundef %110, i32 noundef %114)
  %115 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %116 = getelementptr inbounds i8, ptr %115, i64 6
  %117 = load ptr, ptr %11, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %117, i32 0, i32 3
  %119 = load i16, ptr %118, align 2, !tbaa !23
  %120 = zext i16 %119 to i32
  call void @png_save_uint_16(ptr noundef %116, i32 noundef %120)
  %121 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %122 = getelementptr inbounds i8, ptr %121, i64 8
  %123 = load ptr, ptr %11, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %123, i32 0, i32 4
  %125 = load i16, ptr %124, align 2, !tbaa !24
  %126 = zext i16 %125 to i32
  call void @png_save_uint_16(ptr noundef %122, i32 noundef %126)
  br label %127

127:                                              ; preds = %96, %69
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds [10 x i8], ptr %8, i64 0, i64 0
  %130 = load i64, ptr %9, align 8, !tbaa !12
  call void @png_write_chunk_data(ptr noundef %128, ptr noundef %129, i64 noundef %130)
  br label %131

131:                                              ; preds = %127
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %132, i32 1
  store ptr %133, ptr %11, align 8, !tbaa !5
  br label %52, !llvm.loop !25

134:                                              ; preds = %52
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  call void @png_write_chunk_end(ptr noundef %135)
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %136, ptr noundef %137)
  store i32 0, ptr %12, align 4
  br label %138

138:                                              ; preds = %134, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 10, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr %5) #4
  %139 = load i32, ptr %12, 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 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 }

!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, !7, i64 8}
!10 = !{!"png_sPLT_struct", !6, i64 0, !7, i64 8, !6, i64 16, !11, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !11, i64 24}
!15 = !{!10, !6, i64 0}
!16 = !{!10, !6, i64 16}
!17 = !{!18, !19, i64 0}
!18 = !{!"png_sPLT_entry_struct", !19, i64 0, !19, i64 2, !19, i64 4, !19, i64 6, !19, i64 8}
!19 = !{!"short", !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!18, !19, i64 2}
!22 = !{!18, !19, i64 4}
!23 = !{!18, !19, i64 6}
!24 = !{!18, !19, i64 8}
!25 = distinct !{!25, !26}
!26 = !{!"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_entry_struct = type { i16, i16, i16, i16, i16 }

@__const.png_write_sPLT.png_sPLT = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @png_save_uint_16(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_start(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_data(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @png_write_chunk_end(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @png_check_keyword(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @png_write_sPLT(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [5 x i8], align 1
  %4 = alloca ptr, align 8
  %5 = alloca [10 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %3, ptr noundef nonnull align 1 dereferenceable(5) @__const.png_write_sPLT.png_sPLT, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %5) #4
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i8, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i8 %7, 8
  %9 = select i1 %8, i64 6, i64 10
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = load ptr, ptr %1, align 8, !tbaa !12
  %13 = call i64 @png_check_keyword(ptr noundef %0, ptr noundef %12, ptr noundef nonnull %4)
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %67, label %15

15:                                               ; preds = %2
  %16 = zext i32 %11 to i64
  %17 = mul nuw nsw i64 %9, %16
  %18 = add i64 %13, 2
  %19 = add i64 %18, %17
  %20 = trunc i64 %19 to i32
  call void @png_write_chunk_start(ptr noundef %0, ptr noundef nonnull %3, i32 noundef %20)
  %21 = load ptr, ptr %4, align 8, !tbaa !13
  %22 = add i64 %13, 1
  call void @png_write_chunk_data(ptr noundef %0, ptr noundef %21, i64 noundef %22)
  call void @png_write_chunk_data(ptr noundef %0, ptr noundef nonnull %6, i64 noundef 1)
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load i32, ptr %10, align 8, !tbaa !11
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %15
  %26 = load ptr, ptr %23, align 8, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %5, i64 2
  %28 = getelementptr inbounds i8, ptr %5, i64 4
  %29 = getelementptr inbounds i8, ptr %5, i64 6
  %30 = getelementptr inbounds i8, ptr %5, i64 8
  %31 = getelementptr inbounds i8, ptr %5, i64 1
  %32 = getelementptr inbounds i8, ptr %5, i64 3
  br label %33

33:                                               ; preds = %.lr.ph, %57
  %.032 = phi ptr [ %26, %.lr.ph ], [ %60, %57 ]
  %34 = load i8, ptr %6, align 8, !tbaa !5
  %35 = icmp eq i8 %34, 8
  %36 = load i16, ptr %.032, align 2, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %.032, i64 2
  %38 = getelementptr inbounds i8, ptr %.032, i64 4
  %39 = getelementptr inbounds i8, ptr %.032, i64 6
  %40 = getelementptr inbounds i8, ptr %.032, i64 8
  br i1 %35, label %41, label %49

41:                                               ; preds = %33
  %42 = trunc i16 %36 to i8
  store i8 %42, ptr %5, align 1, !tbaa !18
  %43 = load i16, ptr %37, align 2, !tbaa !19
  %44 = trunc i16 %43 to i8
  store i8 %44, ptr %31, align 1, !tbaa !18
  %45 = load i16, ptr %38, align 2, !tbaa !20
  %46 = trunc i16 %45 to i8
  store i8 %46, ptr %27, align 1, !tbaa !18
  %47 = load i16, ptr %39, align 2, !tbaa !21
  %48 = trunc i16 %47 to i8
  store i8 %48, ptr %32, align 1, !tbaa !18
  br label %57

49:                                               ; preds = %33
  %50 = zext i16 %36 to i32
  call void @png_save_uint_16(ptr noundef nonnull %5, i32 noundef %50)
  %51 = load i16, ptr %37, align 2, !tbaa !19
  %52 = zext i16 %51 to i32
  call void @png_save_uint_16(ptr noundef nonnull %27, i32 noundef %52)
  %53 = load i16, ptr %38, align 2, !tbaa !20
  %54 = zext i16 %53 to i32
  call void @png_save_uint_16(ptr noundef nonnull %28, i32 noundef %54)
  %55 = load i16, ptr %39, align 2, !tbaa !21
  %56 = zext i16 %55 to i32
  call void @png_save_uint_16(ptr noundef nonnull %29, i32 noundef %56)
  br label %57

57:                                               ; preds = %49, %41
  %.sink = phi ptr [ %30, %49 ], [ %28, %41 ]
  %58 = load i16, ptr %40, align 2, !tbaa !22
  %59 = zext i16 %58 to i32
  call void @png_save_uint_16(ptr noundef nonnull %.sink, i32 noundef %59)
  call void @png_write_chunk_data(ptr noundef %0, ptr noundef nonnull %5, i64 noundef %9)
  %60 = getelementptr inbounds i8, ptr %.032, i64 10
  %61 = load ptr, ptr %23, align 8, !tbaa !14
  %62 = load i32, ptr %10, align 8, !tbaa !11
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds %struct.png_sPLT_entry_struct, ptr %61, i64 %63
  %65 = icmp ult ptr %60, %64
  br i1 %65, label %33, label %._crit_edge, !llvm.loop !23

._crit_edge:                                      ; preds = %57, %15
  call void @png_write_chunk_end(ptr noundef %0)
  %66 = load ptr, ptr %4, align 8, !tbaa !13
  call void @png_free(ptr noundef %0, ptr noundef %66) #4
  br label %67

67:                                               ; preds = %2, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %3) #4
  ret void
}

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

!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, !8, i64 8}
!6 = !{!"png_sPLT_struct", !7, i64 0, !8, i64 8, !7, i64 16, !10, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 16}
!15 = !{!16, !17, i64 0}
!16 = !{!"png_sPLT_entry_struct", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !17, i64 8}
!17 = !{!"short", !8, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!16, !17, i64 2}
!20 = !{!16, !17, i64 4}
!21 = !{!16, !17, i64 6}
!22 = !{!16, !17, i64 8}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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