; 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_Zip64EndOfCentralDirectoryLocator(ptr noundef %0, i64 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %7 = load i64, ptr %4, align 8, !tbaa !9
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.zip64_internal, ptr %8, i32 0, i32 6
  %10 = load i64, ptr %9, align 8, !tbaa !13
  %11 = sub i64 %7, %10
  store i64 %11, ptr %6, align 8, !tbaa !9
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.zip64_internal, ptr %12, i32 0, i32 0
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.zip64_internal, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !21
  %17 = call i32 @zip64local_putValue(ptr noundef %13, ptr noundef %16, i64 noundef 117853008, i32 noundef 4)
  store i32 %17, ptr %5, align 4, !tbaa !11
  %18 = load i32, ptr %5, align 4, !tbaa !11
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %27

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

27:                                               ; preds = %20, %2
  %28 = load i32, ptr %5, align 4, !tbaa !11
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %38

30:                                               ; preds = %27
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.zip64_internal, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.zip64_internal, ptr %33, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = load i64, ptr %6, align 8, !tbaa !9
  %37 = call i32 @zip64local_putValue(ptr noundef %32, ptr noundef %35, i64 noundef %36, i32 noundef 8)
  store i32 %37, ptr %5, align 4, !tbaa !11
  br label %38

38:                                               ; preds = %30, %27
  %39 = load i32, ptr %5, align 4, !tbaa !11
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %48

41:                                               ; preds = %38
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.zip64_internal, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.zip64_internal, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  %47 = call i32 @zip64local_putValue(ptr noundef %43, ptr noundef %46, i64 noundef 1, i32 noundef 4)
  store i32 %47, ptr %5, align 4, !tbaa !11
  br label %48

48:                                               ; preds = %41, %38
  %49 = load i32, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 %49
}

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


; 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_Zip64EndOfCentralDirectoryLocator(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 65928
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = sub i64 %1, %4
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = load ptr, ptr %6, align 8, !tbaa !18
  %8 = tail call i32 @zip64local_putValue(ptr noundef %0, ptr noundef %7, i64 noundef 117853008, i32 noundef 4)
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %.thread16

10:                                               ; preds = %2
  %11 = load ptr, ptr %6, align 8, !tbaa !18
  %12 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %11, i64 noundef 0, i32 noundef 4)
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %14, label %.thread16

14:                                               ; preds = %10
  %15 = load ptr, ptr %6, align 8, !tbaa !18
  %16 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %15, i64 noundef %5, i32 noundef 8)
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %18, label %.thread16

18:                                               ; preds = %14
  %19 = load ptr, ptr %6, align 8, !tbaa !18
  %20 = tail call i32 @zip64local_putValue(ptr noundef nonnull %0, ptr noundef %19, i64 noundef 1, i32 noundef 4)
  br label %.thread16

.thread16:                                        ; preds = %2, %10, %18, %14
  %.2 = phi i32 [ %20, %18 ], [ %16, %14 ], [ %12, %10 ], [ %8, %2 ]
  ret i32 %.2
}

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, !17, i64 65928}
!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, !9, i64 88}


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