; LLVM IR from stivalaa/EstimNetDirected :: src/Random123-1.09/examples/pi_aes.ll (Z8pi_checkmm)

; 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 [72 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z8pi_checkmm(i64 noundef %0, i64 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store double 0x400921FB54442D18, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %13 = load i64, ptr %4, align 8, !tbaa !5
  %14 = load i64, ptr %5, align 8, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str, i64 noundef %13, i64 noundef %14)
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = uitofp i64 %16 to double
  %18 = fmul double 4.000000e+00, %17
  %19 = load i64, ptr %5, align 8, !tbaa !5
  %20 = uitofp i64 %19 to double
  %21 = fdiv double %18, %20
  store double %21, ptr %7, align 8, !tbaa !9
  %22 = load double, ptr %7, align 8, !tbaa !9
  %23 = load double, ptr %7, align 8, !tbaa !9
  %24 = fsub double %23, 0x400921FB54442D18
  %25 = fmul double %24, 1.000000e+02
  %26 = fdiv double %25, 0x400921FB54442D18
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %22, double noundef %26)
  %28 = load i64, ptr %5, align 8, !tbaa !5
  %29 = uitofp i64 %28 to double
  %30 = fmul double %29, 0x3FE921FB54442D18
  store double %30, ptr %8, align 8, !tbaa !9
  %31 = load i64, ptr %5, align 8, !tbaa !5
  %32 = uitofp i64 %31 to double
  %33 = fmul double %32, 0x3FE921FB54442D18
  %34 = fmul double %33, 0x3FCB7812AEEF4BA0
  store double %34, ptr %9, align 8, !tbaa !9
  %35 = load i64, ptr %4, align 8, !tbaa !5
  %36 = uitofp i64 %35 to double
  %37 = load double, ptr %8, align 8, !tbaa !9
  %38 = fsub double %36, %37
  store double %38, ptr %10, align 8, !tbaa !9
  %39 = load double, ptr %10, align 8, !tbaa !9
  %40 = load double, ptr %10, align 8, !tbaa !9
  %41 = fmul double %39, %40
  %42 = load double, ptr %9, align 8, !tbaa !9
  %43 = fdiv double %41, %42
  store double %43, ptr %11, align 8, !tbaa !9
  %44 = load double, ptr %11, align 8, !tbaa !9
  %45 = fcmp olt double %44, 1.000000e+00
  br i1 %45, label %46, label %49

46:                                               ; preds = %2
  %47 = load double, ptr %11, align 8, !tbaa !9
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %47)
  br label %66

49:                                               ; preds = %2
  %50 = load double, ptr %11, align 8, !tbaa !9
  %51 = fcmp olt double %50, 4.000000e+00
  br i1 %51, label %52, label %55

52:                                               ; preds = %49
  %53 = load double, ptr %11, align 8, !tbaa !9
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %53)
  br label %65

55:                                               ; preds = %49
  %56 = load double, ptr %11, align 8, !tbaa !9
  %57 = fcmp olt double %56, 9.000000e+00
  br i1 %57, label %58, label %61

58:                                               ; preds = %55
  %59 = load double, ptr %11, align 8, !tbaa !9
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, double noundef %59)
  br label %64

61:                                               ; preds = %55
  %62 = load double, ptr %11, align 8, !tbaa !9
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, double noundef %62)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %67

64:                                               ; preds = %58
  br label %65

65:                                               ; preds = %64, %52
  br label %66

66:                                               ; preds = %65, %46
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %67

67:                                               ; preds = %66, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %68 = load i32, ptr %3, align 4
  ret i32 %68
}

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

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

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"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 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [95 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z8pi_checkmm(i64 noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i64 noundef %0, i64 noundef %1)
  %4 = uitofp i64 %0 to double
  %5 = fmul double %4, 4.000000e+00
  %6 = uitofp i64 %1 to double
  %7 = fdiv double %5, %6
  %8 = fadd double %7, 0xC00921FB54442D18
  %9 = fmul double %8, 1.000000e+02
  %10 = fdiv double %9, 0x400921FB54442D18
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %7, double noundef %10)
  %12 = fmul double %6, 0x3FE921FB54442D18
  %13 = fmul double %12, 0x3FCB7812AEEF4BA0
  %14 = fsub double %4, %12
  %15 = fmul double %14, %14
  %16 = fdiv double %15, %13
  %17 = fcmp olt double %16, 1.000000e+00
  br i1 %17, label %22, label %18

18:                                               ; preds = %2
  %19 = fcmp olt double %16, 4.000000e+00
  br i1 %19, label %22, label %20

20:                                               ; preds = %18
  %21 = fcmp uge double %16, 9.000000e+00
  %.str.4..str.5 = select i1 %21, ptr @.str.5, ptr @.str.4
  %. = zext i1 %21 to i32
  br label %22

22:                                               ; preds = %20, %18, %2
  %.str.2.sink = phi ptr [ @.str.2, %2 ], [ @.str.3, %18 ], [ %.str.4..str.5, %20 ]
  %.0 = phi i32 [ 0, %2 ], [ 0, %18 ], [ %., %20 ]
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink, double noundef %16)
  ret i32 %.0
}

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

attributes #0 = { mustprogress 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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass