; LLVM IR from jspd-group/pegit :: src (commit)

; 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 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @print_humanised_bytes(i64 noundef %0) #0 {
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i64 %0, ptr %2, align 8, !tbaa !5
  %5 = load i64, ptr %2, align 8, !tbaa !5
  %6 = icmp sgt i64 %5, 1073741824
  br i1 %6, label %7, label %16

7:                                                ; preds = %1
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = ashr i64 %8, 30
  %10 = trunc i64 %9 to i32
  %11 = load i64, ptr %2, align 8, !tbaa !5
  %12 = and i64 %11, 1073741823
  %13 = trunc i64 %12 to i32
  %14 = sdiv i32 %13, 10737419
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %10, i32 noundef %14)
  br label %50

16:                                               ; preds = %1
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = icmp sgt i64 %17, 1048576
  br i1 %18, label %19, label %30

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = add nsw i64 %20, 5243
  %22 = trunc i64 %21 to i32
  store i32 %22, ptr %3, align 4, !tbaa !9
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = ashr i32 %23, 20
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = and i32 %25, 1048575
  %27 = mul nsw i32 %26, 100
  %28 = ashr i32 %27, 20
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %24, i32 noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %49

30:                                               ; preds = %16
  %31 = load i64, ptr %2, align 8, !tbaa !5
  %32 = icmp sgt i64 %31, 1024
  br i1 %32, label %33, label %44

33:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %34 = load i64, ptr %2, align 8, !tbaa !5
  %35 = add nsw i64 %34, 5
  %36 = trunc i64 %35 to i32
  store i32 %36, ptr %4, align 4, !tbaa !9
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = ashr i32 %37, 10
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = and i32 %39, 1023
  %41 = mul nsw i32 %40, 100
  %42 = ashr i32 %41, 10
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %38, i32 noundef %42)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %48

44:                                               ; preds = %30
  %45 = load i64, ptr %2, align 8, !tbaa !5
  %46 = trunc i64 %45 to i32
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %46)
  br label %48

48:                                               ; preds = %44, %33
  br label %49

49:                                               ; preds = %48, %19
  br label %50

50:                                               ; preds = %49, %7
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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}


; 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 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_humanised_bytes(i64 noundef %0) local_unnamed_addr #0 {
  %2 = icmp sgt i64 %0, 1073741824
  br i1 %2, label %3, label %10

3:                                                ; preds = %1
  %4 = lshr i64 %0, 30
  %5 = trunc i64 %4 to i32
  %6 = trunc i64 %0 to i32
  %7 = and i32 %6, 1073741823
  %8 = udiv i32 %7, 10737419
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %5, i32 noundef %8)
  br label %32

10:                                               ; preds = %1
  %11 = icmp sgt i64 %0, 1048576
  br i1 %11, label %12, label %20

12:                                               ; preds = %10
  %13 = trunc i64 %0 to i32
  %14 = add nuw nsw i32 %13, 5243
  %15 = lshr i32 %14, 20
  %16 = and i32 %14, 1048575
  %17 = mul nuw nsw i32 %16, 100
  %18 = lshr i32 %17, 20
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %15, i32 noundef %18)
  br label %32

20:                                               ; preds = %10
  %21 = icmp sgt i64 %0, 1024
  %22 = trunc i64 %0 to i32
  br i1 %21, label %23, label %30

23:                                               ; preds = %20
  %24 = add nuw nsw i32 %22, 5
  %25 = lshr i32 %24, 10
  %26 = and i32 %24, 1023
  %27 = mul nuw nsw i32 %26, 100
  %28 = lshr i32 %27, 10
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %25, i32 noundef %28)
  br label %32

30:                                               ; preds = %20
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
  br label %32

32:                                               ; preds = %12, %30, %23, %3
  ret void
}

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

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

!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)"}


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