; LLVM IR from microsoft/ntttcp-for-linux :: src (util)

; 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.2 = external hidden unnamed_addr constant [6 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 double @unit_atod(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca double, align 8
  %6 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  store i8 0, ptr %6, align 1, !tbaa !11
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %7, ptr noundef @.str.2, ptr noundef %5, ptr noundef %6) #3
  %9 = load i8, ptr %6, align 1, !tbaa !11
  %10 = sext i8 %9 to i32
  switch i32 %10, label %32 [
    i32 103, label %11
    i32 71, label %11
    i32 109, label %20
    i32 77, label %20
    i32 107, label %27
    i32 75, label %27
  ]

11:                                               ; preds = %2, %2
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = mul nsw i32 %12, %13
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = mul nsw i32 %14, %15
  %17 = sitofp i32 %16 to double
  %18 = load double, ptr %5, align 8, !tbaa !12
  %19 = fmul double %18, %17
  store double %19, ptr %5, align 8, !tbaa !12
  br label %33

20:                                               ; preds = %2, %2
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = load i32, ptr %4, align 4, !tbaa !9
  %23 = mul nsw i32 %21, %22
  %24 = sitofp i32 %23 to double
  %25 = load double, ptr %5, align 8, !tbaa !12
  %26 = fmul double %25, %24
  store double %26, ptr %5, align 8, !tbaa !12
  br label %33

27:                                               ; preds = %2, %2
  %28 = load i32, ptr %4, align 4, !tbaa !9
  %29 = sitofp i32 %28 to double
  %30 = load double, ptr %5, align 8, !tbaa !12
  %31 = fmul double %30, %29
  store double %31, ptr %5, align 8, !tbaa !12
  br label %33

32:                                               ; preds = %2
  br label %33

33:                                               ; preds = %32, %27, %20, %11
  %34 = load double, ptr %5, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %34
}

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr 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 = !{!"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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !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.2 = external hidden unnamed_addr constant [6 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 uwtable
define dso_local double @unit_atod(ptr nocapture noundef readonly %0, i32 noundef %1) local_unnamed_addr #1 {
  %3 = alloca double, align 8
  %4 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #3
  store i8 0, ptr %4, align 1, !tbaa !5
  %5 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef nonnull %3, ptr noundef nonnull %4) #3
  %6 = load i8, ptr %4, align 1, !tbaa !5
  switch i8 %6, label %._crit_edge [
    i8 103, label %7
    i8 71, label %7
    i8 109, label %13
    i8 77, label %13
    i8 107, label %18
    i8 75, label %18
  ]

._crit_edge:                                      ; preds = %2
  %.pre = load double, ptr %3, align 8, !tbaa !8
  br label %22

7:                                                ; preds = %2, %2
  %8 = mul nsw i32 %1, %1
  %9 = mul nsw i32 %8, %1
  %10 = sitofp i32 %9 to double
  %11 = load double, ptr %3, align 8, !tbaa !8
  %12 = fmul double %11, %10
  br label %22

13:                                               ; preds = %2, %2
  %14 = mul nsw i32 %1, %1
  %15 = uitofp nneg i32 %14 to double
  %16 = load double, ptr %3, align 8, !tbaa !8
  %17 = fmul double %16, %15
  br label %22

18:                                               ; preds = %2, %2
  %19 = sitofp i32 %1 to double
  %20 = load double, ptr %3, align 8, !tbaa !8
  %21 = fmul double %20, %19
  br label %22

22:                                               ; preds = %._crit_edge, %18, %13, %7
  %23 = phi double [ %.pre, %._crit_edge ], [ %21, %18 ], [ %17, %13 ], [ %12, %7 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret double %23
}

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

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


; Effective O3 passes: DSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass