; LLVM IR from wmcnamara/crynn :: lib/thirdparty/assimp/contrib/zlib/contrib/minizip (zip)

; 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.zip64_internal = type { %struct.zlib_filefunc64_32_def_s, ptr, %struct.linkedlist_data_s, i32, %struct.curfile64_info, i64, i64, i64, ptr }
%struct.zlib_filefunc64_32_def_s = type { %struct.zlib_filefunc64_def_s, ptr, ptr, ptr }
%struct.zlib_filefunc64_def_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.linkedlist_data_s = type { ptr, ptr }
%struct.curfile64_info = type { %struct.z_stream_s, i32, i32, i64, ptr, i64, i64, i64, i64, i32, i32, [65536 x i8], i64, i64, i32, i32, i64, i64, i64, [3 x i64], ptr, i32 }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @zip64local_putValue(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @Write_EndOfCentralDirectoryRecord(ptr noundef %0, i64 noundef %1, i64 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !13
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.zip64_internal, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.zip64_internal, ptr %11, i32 0, i32 1
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = call i32 @zip64local_putValue(ptr noundef %10, ptr noundef %13, i64 noundef 101010256, i32 noundef 4)
  store i32 %14, ptr %7, align 4, !tbaa !13
  %15 = load i32, ptr %7, align 4, !tbaa !13
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.zip64_internal, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.zip64_internal, ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = call i32 @zip64local_putValue(ptr noundef %19, ptr noundef %22, i64 noundef 0, i32 noundef 2)
  store i32 %23, ptr %7, align 4, !tbaa !13
  br label %24

24:                                               ; preds = %17, %3
  %25 = load i32, ptr %7, align 4, !tbaa !13
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %34

27:                                               ; preds = %24
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.zip64_internal, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.zip64_internal, ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = call i32 @zip64local_putValue(ptr noundef %29, ptr noundef %32, i64 noundef 0, i32 noundef 2)
  store i32 %33, ptr %7, align 4, !tbaa !13
  br label %34

34:                                               ; preds = %27, %24
  %35 = load i32, ptr %7, align 4, !tbaa !13
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %60

37:                                               ; preds = %34
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.zip64_internal, ptr %38, i32 0, i32 7
  %40 = load i64, ptr %39, align 8, !tbaa !22
  %41 = icmp uge i64 %40, 65535
  br i1 %41, label %42, label %49

42:                                               ; preds = %37
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.zip64_internal, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.zip64_internal, ptr %45, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = call i32 @zip64local_putValue(ptr noundef %44, ptr noundef %47, i64 noundef 65535, i32 noundef 2)
  store i32 %48, ptr %7, align 4, !tbaa !13
  br label %59

49:                                               ; preds = %37
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.zip64_internal, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.zip64_internal, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.zip64_internal, ptr %55, i32 0, i32 7
  %57 = load i64, ptr %56, align 8, !tbaa !22
  %58 = call i32 @zip64local_putValue(ptr noundef %51, ptr noundef %54, i64 noundef %57, i32 noundef 2)
  store i32 %58, ptr %7, align 4, !tbaa !13
  br label %59

59:                                               ; preds = %49, %42
  br label %60

60:                                               ; preds = %59, %34
  %61 = load i32, ptr %7, align 4, !tbaa !13
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %86

63:                                               ; preds = %60
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.zip64_internal, ptr %64, i32 0, i32 7
  %66 = load i64, ptr %65, align 8, !tbaa !22
  %67 = icmp uge i64 %66, 65535
  br i1 %67, label %68, label %75

68:                                               ; preds = %63
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.zip64_internal, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.zip64_internal, ptr %71, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  %74 = call i32 @zip64local_putValue(ptr noundef %70, ptr noundef %73, i64 noundef 65535, i32 noundef 2)
  store i32 %74, ptr %7, align 4, !tbaa !13
  br label %85

75:                                               ; preds = %63
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.zip64_internal, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.zip64_internal, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !15
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.zip64_internal, ptr %81, i32 0, i32 7
  %83 = load i64, ptr %82, align 8, !tbaa !22
  %84 = call i32 @zip64local_putValue(ptr noundef %77, ptr noundef %80, i64 noundef %83, i32 noundef 2)
  store i32 %84, ptr %7, align 4, !tbaa !13
  br label %85

85:                                               ; preds = %75, %68
  br label %86

86:                                               ; preds = %85, %60
  %87 = load i32, ptr %7, align 4, !tbaa !13
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %97

89:                                               ; preds = %86
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.zip64_internal, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.zip64_internal, ptr %92, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8, !tbaa !15
  %95 = load i64, ptr %5, align 8, !tbaa !9
  %96 = call i32 @zip64local_putValue(ptr noundef %91, ptr noundef %94, i64 noundef %95, i32 noundef 4)
  store i32 %96, ptr %7, align 4, !tbaa !13
  br label %97

97:                                               ; preds = %89, %86
  %98 = load i32, ptr %7, align 4, !tbaa !13
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %128

100:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %101 = load i64, ptr %6, align 8, !tbaa !11
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.zip64_internal, ptr %102, i32 0, i32 6
  %104 = load i64, ptr %103, align 8, !tbaa !23
  %105 = sub i64 %101, %104
  store i64 %105, ptr %8, align 8, !tbaa !11
  %106 = load i64, ptr %8, align 8, !tbaa !11
  %107 = icmp uge i64 %106, 4294967295
  br i1 %107, label %108, label %115

108:                                              ; preds = %100
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.zip64_internal, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %4, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.zip64_internal, ptr %111, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8, !tbaa !15
  %114 = call i32 @zip64local_putValue(ptr noundef %110, ptr noundef %113, i64 noundef 4294967295, i32 noundef 4)
  store i32 %114, ptr %7, align 4, !tbaa !13
  br label %127

115:                                              ; preds = %100
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.zip64_internal, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.zip64_internal, ptr %118, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !15
  %121 = load i64, ptr %6, align 8, !tbaa !11
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.zip64_internal, ptr %122, i32 0, i32 6
  %124 = load i64, ptr %123, align 8, !tbaa !23
  %125 = sub i64 %121, %124
  %126 = call i32 @zip64local_putValue(ptr noundef %117, ptr noundef %120, i64 noundef %125, i32 noundef 4)
  store i32 %126, ptr %7, align 4, !tbaa !13
  br label %127

127:                                              ; preds = %115, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %128

128:                                              ; preds = %127, %97
  %129 = load i32, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret i32 %129
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 88}
!16 = !{!"", !17, i64 0, !6, i64 88, !19, i64 96, !14, i64 112, !20, i64 120, !12, i64 65920, !12, i64 65928, !12, i64 65936, !6, i64 65944}
!17 = !{!"zlib_filefunc64_32_def_s", !18, i64 0, !6, i64 64, !6, i64 72, !6, i64 80}
!18 = !{!"zlib_filefunc64_def_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!19 = !{!"linkedlist_data_s", !6, i64 0, !6, i64 8}
!20 = !{!"", !21, i64 0, !14, i64 112, !14, i64 116, !12, i64 120, !6, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !14, i64 168, !14, i64 172, !7, i64 176, !10, i64 65712, !10, i64 65720, !14, i64 65728, !14, i64 65732, !12, i64 65736, !12, i64 65744, !12, i64 65752, !7, i64 65760, !6, i64 65784, !14, i64 65792}
!21 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !10, i64 16, !6, i64 24, !14, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !10, i64 96, !10, i64 104}
!22 = !{!16, !12, i64 65936}
!23 = !{!16, !12, i64 65928}


; 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"

; Function Attrs: nounwind uwtable
declare hidden i32 @zip64local_putValue(ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @Write_EndOfCentralDirectoryRecord(ptr noundef %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 88
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = tail call i32 @zip64local_putValue(ptr noundef %0, ptr noundef %5, i64 noundef 101010256, i32 noundef 4)
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %.thread50

8:                                                ; preds = %3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %9, i64 noundef 0, i32 noundef 2)
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %.thread50

12:                                               ; preds = %8
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %13, i64 noundef 0, i32 noundef 2)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %.thread50

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %0, i64 65936
  %18 = load i64, ptr %17, align 8, !tbaa !18
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %. = tail call i64 @llvm.umin.i64(i64 %18, i64 65535)
  %20 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %19, i64 noundef %., i32 noundef 2)
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %.thread50

22:                                               ; preds = %16
  %23 = load i64, ptr %17, align 8, !tbaa !18
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %.54 = tail call i64 @llvm.umin.i64(i64 %23, i64 65535)
  %25 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %24, i64 noundef %.54, i32 noundef 2)
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %.thread50

27:                                               ; preds = %22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %28, i64 noundef %1, i32 noundef 4)
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %.thread50.sink.split, label %.thread50

.thread50.sink.split:                             ; preds = %27
  %31 = getelementptr inbounds i8, ptr %0, i64 65928
  %32 = load i64, ptr %31, align 8, !tbaa !19
  %33 = sub i64 %2, %32
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %.55 = tail call i64 @llvm.umin.i64(i64 %33, i64 4294967295)
  %35 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %34, i64 noundef %.55, i32 noundef 4)
  br label %.thread50

.thread50:                                        ; preds = %.thread50.sink.split, %3, %8, %12, %16, %22, %27
  %.6 = phi i32 [ %29, %27 ], [ %25, %22 ], [ %20, %16 ], [ %14, %12 ], [ %10, %8 ], [ %6, %3 ], [ %35, %.thread50.sink.split ]
  ret i32 %.6
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #1

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 speculatable willreturn memory(none) }

!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, !9, i64 88}
!6 = !{!"", !7, i64 0, !9, i64 88, !12, i64 96, !13, i64 112, !14, i64 120, !17, i64 65920, !17, i64 65928, !17, i64 65936, !9, i64 65944}
!7 = !{!"zlib_filefunc64_32_def_s", !8, i64 0, !9, i64 64, !9, i64 72, !9, i64 80}
!8 = !{!"zlib_filefunc64_def_s", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"linkedlist_data_s", !9, i64 0, !9, i64 8}
!13 = !{!"int", !10, i64 0}
!14 = !{!"", !15, i64 0, !13, i64 112, !13, i64 116, !17, i64 120, !9, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !13, i64 168, !13, i64 172, !10, i64 176, !16, i64 65712, !16, i64 65720, !13, i64 65728, !13, i64 65732, !17, i64 65736, !17, i64 65744, !17, i64 65752, !10, i64 65760, !9, i64 65784, !13, i64 65792}
!15 = !{!"z_stream_s", !9, i64 0, !13, i64 8, !16, i64 16, !9, i64 24, !13, i64 32, !16, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !13, i64 88, !16, i64 96, !16, i64 104}
!16 = !{!"long", !10, i64 0}
!17 = !{!"long long", !10, i64 0}
!18 = !{!6, !17, i64 65936}
!19 = !{!6, !17, i64 65928}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass