; 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_Zip64EndOfCentralDirectoryRecord(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
  %9 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 44, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.zip64_internal, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.zip64_internal, ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = call i32 @zip64local_putValue(ptr noundef %11, ptr noundef %14, i64 noundef 101075792, i32 noundef 4)
  store i32 %15, ptr %7, align 4, !tbaa !13
  %16 = load i32, ptr %7, align 4, !tbaa !13
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %26

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

26:                                               ; preds = %18, %3
  %27 = load i32, ptr %7, align 4, !tbaa !13
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %36

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

36:                                               ; preds = %29, %26
  %37 = load i32, ptr %7, align 4, !tbaa !13
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %46

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

46:                                               ; preds = %39, %36
  %47 = load i32, ptr %7, align 4, !tbaa !13
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %56

49:                                               ; preds = %46
  %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 = call i32 @zip64local_putValue(ptr noundef %51, ptr noundef %54, i64 noundef 0, i32 noundef 4)
  store i32 %55, ptr %7, align 4, !tbaa !13
  br label %56

56:                                               ; preds = %49, %46
  %57 = load i32, ptr %7, align 4, !tbaa !13
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %66

59:                                               ; preds = %56
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.zip64_internal, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.zip64_internal, ptr %62, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !15
  %65 = call i32 @zip64local_putValue(ptr noundef %61, ptr noundef %64, i64 noundef 0, i32 noundef 4)
  store i32 %65, ptr %7, align 4, !tbaa !13
  br label %66

66:                                               ; preds = %59, %56
  %67 = load i32, ptr %7, align 4, !tbaa !13
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %79

69:                                               ; preds = %66
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.zip64_internal, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.zip64_internal, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.zip64_internal, ptr %75, i32 0, i32 7
  %77 = load i64, ptr %76, align 8, !tbaa !22
  %78 = call i32 @zip64local_putValue(ptr noundef %71, ptr noundef %74, i64 noundef %77, i32 noundef 8)
  store i32 %78, ptr %7, align 4, !tbaa !13
  br label %79

79:                                               ; preds = %69, %66
  %80 = load i32, ptr %7, align 4, !tbaa !13
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %92

82:                                               ; preds = %79
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.zip64_internal, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.zip64_internal, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !15
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.zip64_internal, ptr %88, i32 0, i32 7
  %90 = load i64, ptr %89, align 8, !tbaa !22
  %91 = call i32 @zip64local_putValue(ptr noundef %84, ptr noundef %87, i64 noundef %90, i32 noundef 8)
  store i32 %91, ptr %7, align 4, !tbaa !13
  br label %92

92:                                               ; preds = %82, %79
  %93 = load i32, ptr %7, align 4, !tbaa !13
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %95, label %103

95:                                               ; preds = %92
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.zip64_internal, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.zip64_internal, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !15
  %101 = load i64, ptr %5, align 8, !tbaa !9
  %102 = call i32 @zip64local_putValue(ptr noundef %97, ptr noundef %100, i64 noundef %101, i32 noundef 8)
  store i32 %102, ptr %7, align 4, !tbaa !13
  br label %103

103:                                              ; preds = %95, %92
  %104 = load i32, ptr %7, align 4, !tbaa !13
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %119

106:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %107 = load i64, ptr %6, align 8, !tbaa !11
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.zip64_internal, ptr %108, i32 0, i32 6
  %110 = load i64, ptr %109, align 8, !tbaa !23
  %111 = sub i64 %107, %110
  store i64 %111, ptr %9, align 8, !tbaa !11
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.zip64_internal, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %4, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.zip64_internal, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !15
  %117 = load i64, ptr %9, align 8, !tbaa !11
  %118 = call i32 @zip64local_putValue(ptr noundef %113, ptr noundef %116, i64 noundef %117, i32 noundef 8)
  store i32 %118, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  br label %119

119:                                              ; preds = %106, %103
  %120 = load i32, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  ret i32 %120
}

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_Zip64EndOfCentralDirectoryRecord(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 101075792, i32 noundef 4)
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %.thread56

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 44, i32 noundef 8)
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %12, label %.thread56

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 45, i32 noundef 2)
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %.thread56

16:                                               ; preds = %12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %17, i64 noundef 45, i32 noundef 2)
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %.thread56

20:                                               ; preds = %16
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %21, i64 noundef 0, i32 noundef 4)
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %.thread56

24:                                               ; preds = %20
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %25, i64 noundef 0, i32 noundef 4)
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %.thread56

28:                                               ; preds = %24
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %0, i64 65936
  %31 = load i64, ptr %30, align 8, !tbaa !18
  %32 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %29, i64 noundef %31, i32 noundef 8)
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %.thread56

34:                                               ; preds = %28
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i64, ptr %30, align 8, !tbaa !18
  %37 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %35, i64 noundef %36, i32 noundef 8)
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %.thread56

39:                                               ; preds = %34
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %40, i64 noundef %1, i32 noundef 8)
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %.thread56

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %0, i64 65928
  %45 = load i64, ptr %44, align 8, !tbaa !19
  %46 = sub i64 %2, %45
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %47, i64 noundef %46, i32 noundef 8)
  br label %.thread56

.thread56:                                        ; preds = %3, %8, %12, %16, %20, %24, %28, %34, %43, %39
  %.8 = phi i32 [ %48, %43 ], [ %41, %39 ], [ %37, %34 ], [ %32, %28 ], [ %26, %24 ], [ %22, %20 ], [ %18, %16 ], [ %14, %12 ], [ %10, %8 ], [ %6, %3 ]
  ret i32 %.8
}

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

!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,TailCallElimPass