; LLVM IR from cornell-zhang/rosetta :: BNN/cpp/minizip (miniunz)

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

@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; 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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @display_zpos64(i64 noundef %0, i32 noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca [21 x i8], align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i64 %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 21, ptr %5) #4
  call void @llvm.memset.p0.i64(ptr align 16 %5, i8 0, i64 21, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 19, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 19, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 19, ptr %8, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %32, %2
  br label %10

10:                                               ; preds = %9
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = urem i64 %11, 10
  %13 = add i64 %12, 48
  %14 = trunc i64 %13 to i8
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [21 x i8], ptr %5, i64 0, i64 %16
  store i8 %14, ptr %17, align 1, !tbaa !11
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [21 x i8], ptr %5, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !11
  %22 = sext i8 %21 to i32
  %23 = icmp ne i32 %22, 48
  br i1 %23, label %24, label %26

24:                                               ; preds = %10
  %25 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %25, ptr %7, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %24, %10
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = udiv i64 %27, 10
  store i64 %28, ptr %3, align 8, !tbaa !5
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %35

32:                                               ; preds = %26
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = add nsw i32 %33, -1
  store i32 %34, ptr %6, align 4, !tbaa !9
  br label %9

35:                                               ; preds = %31
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = sub nsw i32 %37, %36
  store i32 %38, ptr %8, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %44, %35
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr %4, align 4, !tbaa !9
  %42 = load i32, ptr %8, align 4, !tbaa !9
  %43 = icmp sgt i32 %40, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %39
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %39, !llvm.loop !12

46:                                               ; preds = %39
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [21 x i8], ptr %5, i64 0, i64 %48
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %49)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 21, ptr %5) #4
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long long", !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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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

@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind uwtable
define dso_local void @display_zpos64(i64 noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca [21 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 21, ptr nonnull %3) #4
  %4 = getelementptr inbounds i8, ptr %3, i64 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(21) %4, i8 0, i64 5, i1 false)
  %5 = urem i64 %0, 10
  %6 = trunc nuw nsw i64 %5 to i8
  %7 = or disjoint i8 %6, 48
  %8 = getelementptr inbounds i8, ptr %3, i64 19
  store i8 %7, ptr %8, align 1, !tbaa !5
  %9 = udiv i64 %0, 10
  %10 = urem i64 %9, 10
  %11 = trunc nuw nsw i64 %10 to i8
  %12 = or disjoint i8 %11, 48
  %13 = getelementptr inbounds i8, ptr %3, i64 18
  store i8 %12, ptr %13, align 2, !tbaa !5
  %.not = icmp eq i64 %10, 0
  %spec.select = select i1 %.not, i32 19, i32 18
  %14 = udiv i64 %0, 100
  %15 = urem i64 %14, 10
  %16 = trunc nuw nsw i64 %15 to i8
  %17 = or disjoint i8 %16, 48
  %18 = getelementptr inbounds i8, ptr %3, i64 17
  store i8 %17, ptr %18, align 1, !tbaa !5
  %.not.1 = icmp eq i64 %15, 0
  %spec.select.1 = select i1 %.not.1, i32 %spec.select, i32 17
  %19 = udiv i64 %0, 1000
  %20 = urem i64 %19, 10
  %21 = trunc nuw nsw i64 %20 to i8
  %22 = or disjoint i8 %21, 48
  %23 = getelementptr inbounds i8, ptr %3, i64 16
  store i8 %22, ptr %23, align 16, !tbaa !5
  %.not.2 = icmp eq i64 %20, 0
  %spec.select.2 = select i1 %.not.2, i32 %spec.select.1, i32 16
  %24 = udiv i64 %0, 10000
  %25 = urem i64 %24, 10
  %26 = trunc nuw nsw i64 %25 to i8
  %27 = or disjoint i8 %26, 48
  %28 = getelementptr inbounds i8, ptr %3, i64 15
  store i8 %27, ptr %28, align 1, !tbaa !5
  %.not.3 = icmp eq i64 %25, 0
  %spec.select.3 = select i1 %.not.3, i32 %spec.select.2, i32 15
  %29 = udiv i64 %0, 100000
  %30 = urem i64 %29, 10
  %31 = trunc nuw nsw i64 %30 to i8
  %32 = or disjoint i8 %31, 48
  %33 = getelementptr inbounds i8, ptr %3, i64 14
  store i8 %32, ptr %33, align 2, !tbaa !5
  %.not.4 = icmp eq i64 %30, 0
  %spec.select.4 = select i1 %.not.4, i32 %spec.select.3, i32 14
  %34 = udiv i64 %0, 1000000
  %35 = urem i64 %34, 10
  %36 = trunc nuw nsw i64 %35 to i8
  %37 = or disjoint i8 %36, 48
  %38 = getelementptr inbounds i8, ptr %3, i64 13
  store i8 %37, ptr %38, align 1, !tbaa !5
  %.not.5 = icmp eq i64 %35, 0
  %spec.select.5 = select i1 %.not.5, i32 %spec.select.4, i32 13
  %39 = udiv i64 %0, 10000000
  %40 = urem i64 %39, 10
  %41 = trunc nuw nsw i64 %40 to i8
  %42 = or disjoint i8 %41, 48
  %43 = getelementptr inbounds i8, ptr %3, i64 12
  store i8 %42, ptr %43, align 4, !tbaa !5
  %.not.6 = icmp eq i64 %40, 0
  %spec.select.6 = select i1 %.not.6, i32 %spec.select.5, i32 12
  %44 = udiv i64 %0, 100000000
  %45 = urem i64 %44, 10
  %46 = trunc nuw nsw i64 %45 to i8
  %47 = or disjoint i8 %46, 48
  %48 = getelementptr inbounds i8, ptr %3, i64 11
  store i8 %47, ptr %48, align 1, !tbaa !5
  %.not.7 = icmp eq i64 %45, 0
  %spec.select.7 = select i1 %.not.7, i32 %spec.select.6, i32 11
  %49 = udiv i64 %0, 1000000000
  %50 = urem i64 %49, 10
  %51 = trunc nuw nsw i64 %50 to i8
  %52 = or disjoint i8 %51, 48
  %53 = getelementptr inbounds i8, ptr %3, i64 10
  store i8 %52, ptr %53, align 2, !tbaa !5
  %.not.8 = icmp eq i64 %50, 0
  %spec.select.8 = select i1 %.not.8, i32 %spec.select.7, i32 10
  %54 = udiv i64 %0, 10000000000
  %.lhs.trunc = trunc nuw nsw i64 %54 to i32
  %55 = urem i32 %.lhs.trunc, 10
  %56 = trunc nuw nsw i32 %55 to i8
  %57 = or disjoint i8 %56, 48
  %58 = getelementptr inbounds i8, ptr %3, i64 9
  store i8 %57, ptr %58, align 1, !tbaa !5
  %.not.9 = icmp eq i32 %55, 0
  %spec.select.9 = select i1 %.not.9, i32 %spec.select.8, i32 9
  %59 = udiv i64 %0, 100000000000
  %.lhs.trunc21 = trunc nuw nsw i64 %59 to i32
  %60 = urem i32 %.lhs.trunc21, 10
  %61 = trunc nuw nsw i32 %60 to i8
  %62 = or disjoint i8 %61, 48
  %63 = getelementptr inbounds i8, ptr %3, i64 8
  store i8 %62, ptr %63, align 8, !tbaa !5
  %.not.10 = icmp eq i32 %60, 0
  %spec.select.10 = select i1 %.not.10, i32 %spec.select.9, i32 8
  %64 = udiv i64 %0, 1000000000000
  %.lhs.trunc23 = trunc nuw nsw i64 %64 to i32
  %65 = urem i32 %.lhs.trunc23, 10
  %66 = trunc nuw nsw i32 %65 to i8
  %67 = or disjoint i8 %66, 48
  %68 = getelementptr inbounds i8, ptr %3, i64 7
  store i8 %67, ptr %68, align 1, !tbaa !5
  %.not.11 = icmp eq i32 %65, 0
  %spec.select.11 = select i1 %.not.11, i32 %spec.select.10, i32 7
  %69 = udiv i64 %0, 10000000000000
  %.lhs.trunc25 = trunc nuw nsw i64 %69 to i32
  %70 = urem i32 %.lhs.trunc25, 10
  %71 = trunc nuw nsw i32 %70 to i8
  %72 = or disjoint i8 %71, 48
  %73 = getelementptr inbounds i8, ptr %3, i64 6
  store i8 %72, ptr %73, align 2, !tbaa !5
  %.not.12 = icmp eq i32 %70, 0
  %spec.select.12 = select i1 %.not.12, i32 %spec.select.11, i32 6
  %74 = udiv i64 %0, 100000000000000
  %.lhs.trunc27 = trunc nuw nsw i64 %74 to i32
  %75 = urem i32 %.lhs.trunc27, 10
  %76 = trunc nuw nsw i32 %75 to i8
  %77 = or disjoint i8 %76, 48
  %78 = getelementptr inbounds i8, ptr %3, i64 5
  store i8 %77, ptr %78, align 1, !tbaa !5
  %.not.13 = icmp eq i32 %75, 0
  %spec.select.13 = select i1 %.not.13, i32 %spec.select.12, i32 5
  %79 = udiv i64 %0, 1000000000000000
  %.lhs.trunc29 = trunc nuw nsw i64 %79 to i16
  %80 = urem i16 %.lhs.trunc29, 10
  %81 = trunc nuw nsw i16 %80 to i8
  %82 = or disjoint i8 %81, 48
  %83 = getelementptr inbounds i8, ptr %3, i64 4
  store i8 %82, ptr %83, align 4, !tbaa !5
  %.not.14 = icmp eq i16 %80, 0
  %spec.select.14 = select i1 %.not.14, i32 %spec.select.13, i32 4
  %84 = udiv i64 %0, 10000000000000000
  %.lhs.trunc31 = trunc nuw nsw i64 %84 to i16
  %85 = urem i16 %.lhs.trunc31, 10
  %86 = trunc nuw nsw i16 %85 to i8
  %87 = or disjoint i8 %86, 48
  %88 = getelementptr inbounds i8, ptr %3, i64 3
  store i8 %87, ptr %88, align 1, !tbaa !5
  %.not.15 = icmp eq i16 %85, 0
  %spec.select.15 = select i1 %.not.15, i32 %spec.select.14, i32 3
  %89 = udiv i64 %0, 100000000000000000
  %.lhs.trunc33 = trunc nuw i64 %89 to i8
  %90 = urem i8 %.lhs.trunc33, 10
  %91 = or disjoint i8 %90, 48
  %92 = getelementptr inbounds i8, ptr %3, i64 2
  store i8 %91, ptr %92, align 2, !tbaa !5
  %.not.16 = icmp eq i8 %90, 0
  %spec.select.16 = select i1 %.not.16, i32 %spec.select.15, i32 2
  %93 = udiv i64 %0, 1000000000000000000
  %.urem = add nsw i64 %93, -10
  %.cmp = icmp ult i64 %0, -8446744073709551616
  %94 = select i1 %.cmp, i64 %93, i64 %.urem
  %95 = trunc nuw nsw i64 %94 to i8
  %96 = or disjoint i8 %95, 48
  %97 = getelementptr inbounds i8, ptr %3, i64 1
  store i8 %96, ptr %97, align 1, !tbaa !5
  %.not.17 = icmp eq i64 %94, 0
  %spec.select.17 = select i1 %.not.17, i32 %spec.select.16, i32 1
  %98 = icmp ugt i64 %0, -8446744073709551617
  %99 = zext i1 %98 to i8
  %100 = or disjoint i8 %99, 48
  store i8 %100, ptr %3, align 16, !tbaa !5
  %spec.select.18 = select i1 %98, i32 0, i32 %spec.select.17
  %101 = sub nuw nsw i32 19, %spec.select.18
  %102 = icmp slt i32 %101, %1
  br i1 %102, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.01319 = phi i32 [ %103, %.lr.ph ], [ %1, %2 ]
  %103 = add nsw i32 %.01319, -1
  %104 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %105 = icmp sgt i32 %103, %101
  br i1 %105, label %.lr.ph, label %._crit_edge, !llvm.loop !8

._crit_edge:                                      ; preds = %.lr.ph, %2
  %106 = zext nneg i32 %spec.select.18 to i64
  %107 = getelementptr inbounds [21 x i8], ptr %3, i64 0, i64 %106
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull %107)
  call void @llvm.lifetime.end.p0(i64 21, ptr nonnull %3) #4
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree 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 #2 = { nofree 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass