; LLVM IR from Overload-Technologies/Overload :: Dependencies/assimp/contrib/unzip (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, i32, ptr, %struct.unz_global_info64_s, i64, i64, i64, i64, i64, i64, i64, %struct.unz_file_info64_s, %struct.unz_file_info64_internal_s, ptr, i32, i32 }
%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.unz_global_info64_s = type { 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 }
%struct.tm_unz_s = type { i32, i32, i32, i32, i32, i32 }
%struct.unz_file_info64_internal_s = type { i64 }
%struct.file_in_zip64_read_info_s = type { ptr, %struct.z_stream_s, i64, i64, i64, i32, i64, i64, i64, i64, i64, i64, %struct.zlib_filefunc64_32_def_s, ptr, i64, i64, 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
define dso_local i32 @unzCloseCurrentFile(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %11

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

11:                                               ; preds = %1
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.unz64_s, ptr %13, i32 0, i32 13
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  store ptr %15, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %11
  store i32 -102, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %60

19:                                               ; preds = %11
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %20, i32 0, i32 11
  %22 = load i64, ptr %21, align 8, !tbaa !21
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %39

24:                                               ; preds = %19
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %25, i32 0, i32 16
  %27 = load i32, ptr %26, align 8, !tbaa !24
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %39, label %29

29:                                               ; preds = %24
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %30, i32 0, i32 8
  %32 = load i64, ptr %31, align 8, !tbaa !25
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %33, i32 0, i32 9
  %35 = load i64, ptr %34, align 8, !tbaa !26
  %36 = icmp ne i64 %32, %35
  br i1 %36, label %37, label %38

37:                                               ; preds = %29
  store i32 -105, ptr %4, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %37, %29
  br label %39

39:                                               ; preds = %38, %24, %19
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !27
  call void @free(ptr noundef %42) #4
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %43, i32 0, i32 0
  store ptr null, ptr %44, align 8, !tbaa !27
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %45, i32 0, i32 3
  %47 = load i64, ptr %46, align 8, !tbaa !28
  %48 = icmp eq i64 %47, 8
  br i1 %48, label %49, label %53

49:                                               ; preds = %39
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %50, i32 0, i32 1
  %52 = call i32 @inflateEnd(ptr noundef %51)
  br label %53

53:                                               ; preds = %49, %39
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.file_in_zip64_read_info_s, ptr %54, i32 0, i32 3
  store i64 0, ptr %55, align 8, !tbaa !28
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  call void @free(ptr noundef %56) #4
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.unz64_s, ptr %57, i32 0, i32 13
  store ptr null, ptr %58, align 8, !tbaa !11
  %59 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %59, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %60

60:                                               ; preds = %53, %18, %10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %61 = load i32, ptr %2, align 4
  ret i32 %61
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare i32 @inflateEnd(ptr noundef) #3

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 "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 = { "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 #4 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 320}
!12 = !{!"", !13, i64 0, !10, i64 88, !6, i64 96, !15, i64 104, !16, i64 120, !16, i64 128, !16, i64 136, !16, i64 144, !16, i64 152, !16, i64 160, !16, i64 168, !18, i64 176, !20, i64 312, !6, i64 320, !10, i64 328, !10, i64 332}
!13 = !{!"zlib_filefunc64_32_def_s", !14, i64 0, !6, i64 64, !6, i64 72, !6, i64 80}
!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}
!15 = !{!"unz_global_info64_s", !16, i64 0, !17, i64 8}
!16 = !{!"long long", !7, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"unz_file_info64_s", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !16, i64 48, !16, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !19, i64 112}
!19 = !{!"tm_unz_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!20 = !{!"unz_file_info64_internal_s", !16, i64 0}
!21 = !{!22, !16, i64 192}
!22 = !{!"", !6, i64 0, !23, i64 8, !16, i64 120, !17, i64 128, !16, i64 136, !10, i64 144, !16, i64 152, !16, i64 160, !17, i64 168, !17, i64 176, !16, i64 184, !16, i64 192, !13, i64 200, !6, i64 288, !17, i64 296, !16, i64 304, !10, i64 312}
!23 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !17, i64 16, !6, i64 24, !10, i64 32, !17, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !17, i64 96, !17, i64 104}
!24 = !{!22, !10, i64 312}
!25 = !{!22, !17, i64 168}
!26 = !{!22, !17, i64 176}
!27 = !{!22, !6, i64 0}
!28 = !{!22, !17, i64 128}


; 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
define dso_local range(i32 -105, 1) i32 @unzCloseCurrentFile(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %28, label %3

3:                                                ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 320
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %28, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %5, i64 192
  %9 = load i64, ptr %8, align 8, !tbaa !19
  %10 = icmp eq i64 %9, 0
  br i1 %10, label %11, label %19

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %5, i64 312
  %13 = load i32, ptr %12, align 8, !tbaa !22
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %14, label %19

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %5, i64 168
  %16 = load i64, ptr %15, align 8, !tbaa !23
  %17 = getelementptr inbounds i8, ptr %5, i64 176
  %18 = load i64, ptr %17, align 8, !tbaa !24
  %.not19 = icmp eq i64 %16, %18
  %spec.select = select i1 %.not19, i32 0, i32 -105
  br label %19

19:                                               ; preds = %14, %11, %7
  %.016 = phi i32 [ 0, %11 ], [ 0, %7 ], [ %spec.select, %14 ]
  %20 = load ptr, ptr %5, align 8, !tbaa !25
  tail call void @free(ptr noundef %20) #3
  store ptr null, ptr %5, align 8, !tbaa !25
  %21 = getelementptr inbounds i8, ptr %5, i64 128
  %22 = load i64, ptr %21, align 8, !tbaa !26
  %23 = icmp eq i64 %22, 8
  br i1 %23, label %24, label %27

24:                                               ; preds = %19
  %25 = getelementptr inbounds i8, ptr %5, i64 8
  %26 = tail call i32 @inflateEnd(ptr noundef nonnull %25) #3
  br label %27

27:                                               ; preds = %24, %19
  tail call void @free(ptr noundef nonnull %5) #3
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %3, %1, %27
  %.0 = phi i32 [ %.016, %27 ], [ -102, %1 ], [ -102, %3 ]
  ret i32 %.0
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

declare i32 @inflateEnd(ptr noundef) local_unnamed_addr #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" }
attributes #1 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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, !9, i64 320}
!6 = !{!"", !7, i64 0, !12, i64 88, !9, i64 96, !13, i64 104, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !14, i64 168, !16, i64 176, !18, i64 312, !9, i64 320, !12, i64 328, !12, i64 332}
!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 = !{!"int", !10, i64 0}
!13 = !{!"unz_global_info64_s", !14, i64 0, !15, i64 8}
!14 = !{!"long long", !10, i64 0}
!15 = !{!"long", !10, 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}
!17 = !{!"tm_unz_s", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20}
!18 = !{!"unz_file_info64_internal_s", !14, i64 0}
!19 = !{!20, !14, i64 192}
!20 = !{!"", !9, i64 0, !21, i64 8, !14, i64 120, !15, i64 128, !14, i64 136, !12, i64 144, !14, i64 152, !14, i64 160, !15, i64 168, !15, i64 176, !14, i64 184, !14, i64 192, !7, i64 200, !9, i64 288, !15, i64 296, !14, i64 304, !12, i64 312}
!21 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !15, i64 16, !9, i64 24, !12, i64 32, !15, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !15, i64 96, !15, i64 104}
!22 = !{!20, !12, i64 312}
!23 = !{!20, !15, i64 168}
!24 = !{!20, !15, i64 176}
!25 = !{!20, !9, i64 0}
!26 = !{!20, !15, i64 128}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass