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

; 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: 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) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @unzGoToNextFile2(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, i64 noundef %7) #2 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i64 %3, ptr %13, align 8, !tbaa !9
  store ptr %4, ptr %14, align 8, !tbaa !5
  store i64 %5, ptr %15, align 8, !tbaa !9
  store ptr %6, ptr %16, align 8, !tbaa !5
  store i64 %7, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %8
  store i32 -102, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %102

24:                                               ; preds = %8
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %25, ptr %18, align 8, !tbaa !5
  %26 = load ptr, ptr %18, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.unz64_s, ptr %26, i32 0, i32 7
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %31, label %30

30:                                               ; preds = %24
  store i32 -100, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %102

31:                                               ; preds = %24
  %32 = load ptr, ptr %18, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.unz64_s, ptr %32, i32 0, i32 3
  %34 = getelementptr inbounds %struct.unz_global_info64_s, ptr %33, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !21
  %36 = icmp ne i64 %35, 65535
  br i1 %36, label %37, label %49

37:                                               ; preds = %31
  %38 = load ptr, ptr %18, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.unz64_s, ptr %38, i32 0, i32 5
  %40 = load i64, ptr %39, align 8, !tbaa !22
  %41 = add i64 %40, 1
  %42 = load ptr, ptr %18, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.unz64_s, ptr %42, i32 0, i32 3
  %44 = getelementptr inbounds %struct.unz_global_info64_s, ptr %43, i32 0, i32 0
  %45 = load i64, ptr %44, align 8, !tbaa !21
  %46 = icmp eq i64 %41, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %37
  store i32 -100, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %102

48:                                               ; preds = %37
  br label %49

49:                                               ; preds = %48, %31
  %50 = load ptr, ptr %18, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.unz64_s, ptr %50, i32 0, i32 12
  %52 = getelementptr inbounds %struct.unz_file_info64_s, ptr %51, i32 0, i32 8
  %53 = load i64, ptr %52, align 8, !tbaa !23
  %54 = add i64 46, %53
  %55 = load ptr, ptr %18, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.unz64_s, ptr %55, i32 0, i32 12
  %57 = getelementptr inbounds %struct.unz_file_info64_s, ptr %56, i32 0, i32 9
  %58 = load i64, ptr %57, align 8, !tbaa !24
  %59 = add i64 %54, %58
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.unz64_s, ptr %60, i32 0, i32 12
  %62 = getelementptr inbounds %struct.unz_file_info64_s, ptr %61, i32 0, i32 10
  %63 = load i64, ptr %62, align 8, !tbaa !25
  %64 = add i64 %59, %63
  %65 = load ptr, ptr %18, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.unz64_s, ptr %65, i32 0, i32 6
  %67 = load i64, ptr %66, align 8, !tbaa !26
  %68 = add i64 %67, %64
  store i64 %68, ptr %66, align 8, !tbaa !26
  %69 = load ptr, ptr %18, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.unz64_s, ptr %69, i32 0, i32 5
  %71 = load i64, ptr %70, align 8, !tbaa !22
  %72 = add i64 %71, 1
  store i64 %72, ptr %70, align 8, !tbaa !22
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = load ptr, ptr %18, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.unz64_s, ptr %74, i32 0, i32 12
  %76 = load ptr, ptr %18, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.unz64_s, ptr %76, i32 0, i32 13
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load i64, ptr %13, align 8, !tbaa !9
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = load i64, ptr %15, align 8, !tbaa !9
  %82 = load ptr, ptr %16, align 8, !tbaa !5
  %83 = load i64, ptr %17, align 8, !tbaa !9
  %84 = call i32 @unz64local_GetCurrentFileInfoInternal(ptr noundef %73, ptr noundef %75, ptr noundef %77, ptr noundef %78, i64 noundef %79, ptr noundef %80, i64 noundef %81, ptr noundef %82, i64 noundef %83)
  store i32 %84, ptr %19, align 4, !tbaa !27
  %85 = load i32, ptr %19, align 4, !tbaa !27
  %86 = icmp eq i32 %85, 0
  %87 = zext i1 %86 to i32
  %88 = sext i32 %87 to i64
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.unz64_s, ptr %89, i32 0, i32 7
  store i64 %88, ptr %90, align 8, !tbaa !11
  %91 = load i32, ptr %19, align 4, !tbaa !27
  %92 = icmp eq i32 %91, 0
  br i1 %92, label %93, label %100

93:                                               ; preds = %49
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = icmp ne ptr %94, null
  br i1 %95, label %96, label %100

96:                                               ; preds = %93
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.unz64_s, ptr %98, i32 0, i32 12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %97, ptr align 8 %99, i64 152, i1 false)
  br label %100

100:                                              ; preds = %96, %93, %49
  %101 = load i32, ptr %19, align 4, !tbaa !27
  store i32 %101, ptr %9, align 4
  store i32 1, ptr %20, align 4
  br label %102

102:                                              ; preds = %100, %47, %30, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  %103 = load i32, ptr %9, align 4
  ret i32 %103
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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, !16, i64 168}
!12 = !{!"", !13, i64 0, !6, i64 104, !6, i64 112, !15, i64 120, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !16, i64 176, !10, i64 184, !16, i64 192, !16, i64 200, !17, i64 208, !20, i64 360, !6, i64 376, !19, i64 384, !7, i64 392, !6, i64 416}
!13 = !{!"zlib_filefunc64_32_def_s", !14, i64 0, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!14 = !{!"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}
!15 = !{!"unz_global_info64_s", !16, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"unz_file_info64_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !16, i64 48, !16, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !18, i64 112, !16, i64 136, !10, i64 144}
!18 = !{!"tm_unz_s", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !19, i64 20}
!19 = !{!"int", !7, i64 0}
!20 = !{!"unz_file_info64_internal_s", !16, i64 0, !16, i64 8}
!21 = !{!12, !16, i64 120}
!22 = !{!12, !16, i64 152}
!23 = !{!12, !10, i64 272}
!24 = !{!12, !10, i64 280}
!25 = !{!12, !10, i64 288}
!26 = !{!12, !16, i64 160}
!27 = !{!19, !19, i64 0}


; 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 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) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @unzGoToNextFile2(ptr noundef %0, ptr noundef writeonly %1, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, i64 noundef %7) local_unnamed_addr #1 {
  %9 = icmp eq ptr %0, null
  br i1 %9, label %37, label %10

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 168
  %12 = load i64, ptr %11, align 8, !tbaa !5
  %.not = icmp eq i64 %12, 0
  br i1 %.not, label %37, label %13

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 120
  %15 = load i64, ptr %14, align 8, !tbaa !19
  %.not31 = icmp ne i64 %15, 65535
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 152
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !20
  %.pre32 = add i64 %.pre, 1
  %16 = icmp eq i64 %.pre32, %15
  %or.cond33 = select i1 %.not31, i1 %16, i1 false
  br i1 %or.cond33, label %37, label %._crit_edge

._crit_edge:                                      ; preds = %13
  %17 = getelementptr inbounds i8, ptr %0, i64 208
  %18 = getelementptr inbounds i8, ptr %0, i64 272
  %19 = load i64, ptr %18, align 8, !tbaa !21
  %20 = add i64 %19, 46
  %21 = getelementptr inbounds i8, ptr %0, i64 280
  %22 = load i64, ptr %21, align 8, !tbaa !22
  %23 = add i64 %20, %22
  %24 = getelementptr inbounds i8, ptr %0, i64 288
  %25 = load i64, ptr %24, align 8, !tbaa !23
  %26 = add i64 %23, %25
  %27 = getelementptr inbounds i8, ptr %0, i64 160
  %28 = load i64, ptr %27, align 8, !tbaa !24
  %29 = add i64 %26, %28
  store i64 %29, ptr %27, align 8, !tbaa !24
  %30 = getelementptr inbounds i8, ptr %0, i64 152
  store i64 %.pre32, ptr %30, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 360
  %32 = tail call i32 @unz64local_GetCurrentFileInfoInternal(ptr noundef nonnull %0, ptr noundef nonnull %17, ptr noundef nonnull %31, ptr noundef %2, i64 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, i64 noundef %7)
  %33 = icmp eq i32 %32, 0
  %34 = zext i1 %33 to i64
  store i64 %34, ptr %11, align 8, !tbaa !5
  %35 = icmp ne ptr %1, null
  %or.cond = and i1 %35, %33
  br i1 %or.cond, label %36, label %37

36:                                               ; preds = %._crit_edge
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(152) %1, ptr noundef nonnull align 8 dereferenceable(152) %17, i64 152, i1 false)
  br label %37

37:                                               ; preds = %13, %._crit_edge, %36, %10, %8
  %.0 = phi i32 [ -102, %8 ], [ -100, %10 ], [ 0, %36 ], [ %32, %._crit_edge ], [ -100, %13 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree 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" }

!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, !13, i64 168}
!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 = !{!6, !13, i64 120}
!20 = !{!6, !13, i64 152}
!21 = !{!6, !14, i64 272}
!22 = !{!6, !14, i64 280}
!23 = !{!6, !14, i64 288}
!24 = !{!6, !13, i64 160}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass