; LLVM IR from mwarning/KadNode :: src (utils)

; 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_bytes.strbytesbuf = external hidden global [4 x [8 x i8]], align 16
@str_bytes.strbytesbuf_i = external hidden global i64, align 8
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 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

; Function Attrs: nounwind uwtable
define dso_local ptr @str_bytes(i64 noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %4 = load i64, ptr @str_bytes.strbytesbuf_i, align 8, !tbaa !5
  %5 = add i64 %4, 1
  store i64 %5, ptr @str_bytes.strbytesbuf_i, align 8, !tbaa !5
  %6 = urem i64 %5, 4
  %7 = getelementptr inbounds [4 x [8 x i8]], ptr @str_bytes.strbytesbuf, i64 0, i64 %6
  %8 = getelementptr inbounds [8 x i8], ptr %7, i64 0, i64 0
  store ptr %8, ptr %3, align 8, !tbaa !9
  %9 = load i64, ptr %2, align 8, !tbaa !5
  %10 = icmp ult i64 %9, 1000
  br i1 %10, label %11, label %16

11:                                               ; preds = %1
  %12 = load ptr, ptr %3, align 8, !tbaa !9
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = trunc i64 %13 to i32
  %15 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %12, i64 noundef 8, ptr noundef @.str.11, i32 noundef %14) #3
  br label %72

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

19:                                               ; preds = %16
  %20 = load ptr, ptr %3, align 8, !tbaa !9
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %22 = uitofp i64 %21 to double
  %23 = fdiv double %22, 1.000000e+03
  %24 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %20, i64 noundef 8, ptr noundef @.str.12, double noundef %23) #3
  br label %71

25:                                               ; preds = %16
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %27 = icmp ult i64 %26, 1000000000
  br i1 %27, label %28, label %34

28:                                               ; preds = %25
  %29 = load ptr, ptr %3, align 8, !tbaa !9
  %30 = load i64, ptr %2, align 8, !tbaa !5
  %31 = uitofp i64 %30 to double
  %32 = fdiv double %31, 1.000000e+06
  %33 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %29, i64 noundef 8, ptr noundef @.str.13, double noundef %32) #3
  br label %70

34:                                               ; preds = %25
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %36 = icmp ult i64 %35, 1000000000000
  br i1 %36, label %37, label %43

37:                                               ; preds = %34
  %38 = load ptr, ptr %3, align 8, !tbaa !9
  %39 = load i64, ptr %2, align 8, !tbaa !5
  %40 = uitofp i64 %39 to double
  %41 = fdiv double %40, 1.000000e+09
  %42 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %38, i64 noundef 8, ptr noundef @.str.14, double noundef %41) #3
  br label %69

43:                                               ; preds = %34
  %44 = load i64, ptr %2, align 8, !tbaa !5
  %45 = icmp ult i64 %44, 1000000000000000
  br i1 %45, label %46, label %52

46:                                               ; preds = %43
  %47 = load ptr, ptr %3, align 8, !tbaa !9
  %48 = load i64, ptr %2, align 8, !tbaa !5
  %49 = uitofp i64 %48 to double
  %50 = fdiv double %49, 1.000000e+12
  %51 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %47, i64 noundef 8, ptr noundef @.str.15, double noundef %50) #3
  br label %68

52:                                               ; preds = %43
  %53 = load i64, ptr %2, align 8, !tbaa !5
  %54 = icmp ult i64 %53, 1000000000000000000
  br i1 %54, label %55, label %61

55:                                               ; preds = %52
  %56 = load ptr, ptr %3, align 8, !tbaa !9
  %57 = load i64, ptr %2, align 8, !tbaa !5
  %58 = uitofp i64 %57 to double
  %59 = fdiv double %58, 1.000000e+15
  %60 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %56, i64 noundef 8, ptr noundef @.str.16, double noundef %59) #3
  br label %67

61:                                               ; preds = %52
  %62 = load ptr, ptr %3, align 8, !tbaa !9
  %63 = load i64, ptr %2, align 8, !tbaa !5
  %64 = uitofp i64 %63 to double
  %65 = fdiv double %64, 1.000000e+18
  %66 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %62, i64 noundef 8, ptr noundef @.str.17, double noundef %65) #3
  br label %67

67:                                               ; preds = %61, %55
  br label %68

68:                                               ; preds = %67, %46
  br label %69

69:                                               ; preds = %68, %37
  br label %70

70:                                               ; preds = %69, %28
  br label %71

71:                                               ; preds = %70, %19
  br label %72

72:                                               ; preds = %71, %11
  %73 = load ptr, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %73
}

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

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 = { 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 = !{!"any pointer", !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_bytes.strbytesbuf = external hidden global [4 x [8 x i8]], align 16
@str_bytes.strbytesbuf_i = external hidden local_unnamed_addr global i64, align 8
@.str.11 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local nonnull ptr @str_bytes(i64 noundef %0) local_unnamed_addr #0 {
  %2 = load i64, ptr @str_bytes.strbytesbuf_i, align 8, !tbaa !5
  %3 = add i64 %2, 1
  store i64 %3, ptr @str_bytes.strbytesbuf_i, align 8, !tbaa !5
  %4 = and i64 %3, 3
  %5 = getelementptr inbounds [4 x [8 x i8]], ptr @str_bytes.strbytesbuf, i64 0, i64 %4
  %6 = icmp ult i64 %0, 1000
  br i1 %6, label %7, label %10

7:                                                ; preds = %1
  %8 = trunc nuw nsw i64 %0 to i32
  %9 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.11, i32 noundef %8) #2
  br label %43

10:                                               ; preds = %1
  %11 = icmp ult i64 %0, 1000000
  br i1 %11, label %12, label %16

12:                                               ; preds = %10
  %13 = uitofp nneg i64 %0 to double
  %14 = fdiv double %13, 1.000000e+03
  %15 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.12, double noundef %14) #2
  br label %43

16:                                               ; preds = %10
  %17 = icmp ult i64 %0, 1000000000
  br i1 %17, label %18, label %22

18:                                               ; preds = %16
  %19 = uitofp nneg i64 %0 to double
  %20 = fdiv double %19, 1.000000e+06
  %21 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.13, double noundef %20) #2
  br label %43

22:                                               ; preds = %16
  %23 = icmp ult i64 %0, 1000000000000
  br i1 %23, label %24, label %28

24:                                               ; preds = %22
  %25 = uitofp nneg i64 %0 to double
  %26 = fdiv double %25, 1.000000e+09
  %27 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.14, double noundef %26) #2
  br label %43

28:                                               ; preds = %22
  %29 = icmp ult i64 %0, 1000000000000000
  br i1 %29, label %30, label %34

30:                                               ; preds = %28
  %31 = uitofp nneg i64 %0 to double
  %32 = fdiv double %31, 1.000000e+12
  %33 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.15, double noundef %32) #2
  br label %43

34:                                               ; preds = %28
  %35 = icmp ult i64 %0, 1000000000000000000
  %36 = uitofp i64 %0 to double
  br i1 %35, label %37, label %40

37:                                               ; preds = %34
  %38 = fdiv double %36, 1.000000e+15
  %39 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.16, double noundef %38) #2
  br label %43

40:                                               ; preds = %34
  %41 = fdiv double %36, 1.000000e+18
  %42 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 8, ptr noundef nonnull @.str.17, double noundef %41) #2
  br label %43

43:                                               ; preds = %12, %24, %37, %40, %30, %18, %7
  ret ptr %5
}

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, 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" }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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