; LLVM IR from eugenebokhan/awesome-ml :: Awesome ML/Utils/Zip/minizip (unzip)

; 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.unz64_s = type { %struct.zlib_filefunc64_32_def_s, ptr, ptr, %struct.unz_global_info64_s, i64, i64, i64, i64, i64, i64, i64, i64, %struct.unz_file_info64_s, %struct.unz_file_info64_internal_s, ptr, i32, [3 x i64], ptr }
%struct.zlib_filefunc64_32_def_s = type { %struct.zlib_filefunc64_def_s, ptr, ptr, ptr, ptr }
%struct.zlib_filefunc64_def_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.unz_global_info64_s = type { i64, i64, i64 }
%struct.unz_file_info64_s = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, %struct.tm_unz_s, i64, i64 }
%struct.tm_unz_s = type { i32, i32, i32, i32, i32, i32 }
%struct.unz_file_info64_internal_s = type { i64, i64 }
%struct.unz_global_info_s = type { i64, 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
define dso_local i32 @unzGetGlobalInfo(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  store i32 -102, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %31

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %12, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.unz64_s, ptr %13, i32 0, i32 3
  %15 = getelementptr inbounds %struct.unz_global_info64_s, ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.unz_global_info_s, ptr %17, i32 0, i32 0
  store i64 %16, ptr %18, align 8, !tbaa !20
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.unz64_s, ptr %19, i32 0, i32 3
  %21 = getelementptr inbounds %struct.unz_global_info64_s, ptr %20, i32 0, i32 2
  %22 = load i64, ptr %21, align 8, !tbaa !22
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.unz_global_info_s, ptr %23, i32 0, i32 2
  store i64 %22, ptr %24, align 8, !tbaa !23
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.unz64_s, ptr %25, i32 0, i32 3
  %27 = getelementptr inbounds %struct.unz_global_info64_s, ptr %26, i32 0, i32 1
  %28 = load i64, ptr %27, align 8, !tbaa !24
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.unz_global_info_s, ptr %29, i32 0, i32 1
  store i64 %28, ptr %30, align 8, !tbaa !25
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %31

31:                                               ; preds = %11, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  %32 = load i32, ptr %3, align 4
  ret i32 %32
}

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, !14, i64 120}
!10 = !{!"", !11, i64 0, !6, i64 104, !6, i64 112, !13, i64 120, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !14, i64 176, !15, i64 184, !14, i64 192, !14, i64 200, !16, i64 208, !19, i64 360, !6, i64 376, !18, i64 384, !7, i64 392, !6, i64 416}
!11 = !{!"zlib_filefunc64_32_def_s", !12, i64 0, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!12 = !{!"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, !6, i64 64}
!13 = !{!"unz_global_info64_s", !14, i64 0, !15, i64 8, !15, i64 16}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"unz_file_info64_s", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !14, i64 48, !14, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !17, i64 112, !14, i64 136, !15, i64 144}
!17 = !{!"tm_unz_s", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !18, i64 20}
!18 = !{!"int", !7, i64 0}
!19 = !{!"unz_file_info64_internal_s", !14, i64 0, !14, i64 8}
!20 = !{!21, !15, i64 0}
!21 = !{!"unz_global_info_s", !15, i64 0, !15, i64 8, !15, i64 16}
!22 = !{!10, !15, i64 136}
!23 = !{!21, !15, i64 16}
!24 = !{!10, !15, i64 128}
!25 = !{!21, !15, i64 8}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local range(i32 -102, 1) i32 @unzGetGlobalInfo(ptr noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %0, null
  br i1 %3, label %10, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 120
  %6 = getelementptr inbounds i8, ptr %0, i64 136
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  store i64 %7, ptr %8, align 8, !tbaa !19
  %9 = load <2 x i64>, ptr %5, align 8, !tbaa !21
  store <2 x i64> %9, ptr %1, align 8, !tbaa !22
  br label %10

10:                                               ; preds = %2, %4
  %.0 = phi i32 [ 0, %4 ], [ -102, %2 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !14, i64 136}
!6 = !{!"", !7, i64 0, !9, i64 104, !9, i64 112, !12, i64 120, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !14, i64 184, !13, i64 192, !13, i64 200, !15, i64 208, !18, i64 360, !9, i64 376, !17, i64 384, !10, i64 392, !9, i64 416}
!7 = !{!"zlib_filefunc64_32_def_s", !8, i64 0, !9, i64 72, !9, i64 80, !9, i64 88, !9, i64 96}
!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, i64 64}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = !{!"unz_global_info64_s", !13, i64 0, !14, i64 8, !14, i64 16}
!13 = !{!"long long", !10, i64 0}
!14 = !{!"long", !10, i64 0}
!15 = !{!"unz_file_info64_s", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !13, i64 48, !13, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !16, i64 112, !13, i64 136, !14, i64 144}
!16 = !{!"tm_unz_s", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!17 = !{!"int", !10, i64 0}
!18 = !{!"unz_file_info64_internal_s", !13, i64 0, !13, i64 8}
!19 = !{!20, !14, i64 16}
!20 = !{!"unz_global_info_s", !14, i64 0, !14, i64 8, !14, i64 16}
!21 = !{!10, !10, i64 0}
!22 = !{!14, !14, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass