; LLVM IR from quarkslab/crypto-condor :: crypto_condor/primitives/_testu01/examples (mrg32k3a)

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

@s11 = external hidden global double, align 8
@s10 = external hidden global double, align 8
@s12 = external hidden global double, align 8
@s22 = external hidden global double, align 8
@s20 = external hidden global double, align 8
@s21 = external hidden global double, align 8

; Function Attrs: nounwind uwtable
define dso_local double @MRG32k3a() #0 {
  %1 = alloca double, align 8
  %2 = alloca i64, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %6 = load double, ptr @s11, align 8, !tbaa !5
  %7 = load double, ptr @s10, align 8, !tbaa !5
  %8 = fmul double 8.107280e+05, %7
  %9 = fneg double %8
  %10 = call double @llvm.fmuladd.f64(double 1.403580e+06, double %6, double %9)
  store double %10, ptr %3, align 8, !tbaa !5
  %11 = load double, ptr %3, align 8, !tbaa !5
  %12 = fdiv double %11, 0x41EFFFFFE5E00000
  %13 = fptosi double %12 to i64
  store i64 %13, ptr %2, align 8, !tbaa !9
  %14 = load i64, ptr %2, align 8, !tbaa !9
  %15 = sitofp i64 %14 to double
  %16 = load double, ptr %3, align 8, !tbaa !5
  %17 = fneg double %15
  %18 = call double @llvm.fmuladd.f64(double %17, double 0x41EFFFFFE5E00000, double %16)
  store double %18, ptr %3, align 8, !tbaa !5
  %19 = load double, ptr %3, align 8, !tbaa !5
  %20 = fcmp olt double %19, 0.000000e+00
  br i1 %20, label %21, label %24

21:                                               ; preds = %0
  %22 = load double, ptr %3, align 8, !tbaa !5
  %23 = fadd double %22, 0x41EFFFFFE5E00000
  store double %23, ptr %3, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %21, %0
  %25 = load double, ptr @s11, align 8, !tbaa !5
  store double %25, ptr @s10, align 8, !tbaa !5
  %26 = load double, ptr @s12, align 8, !tbaa !5
  store double %26, ptr @s11, align 8, !tbaa !5
  %27 = load double, ptr %3, align 8, !tbaa !5
  store double %27, ptr @s12, align 8, !tbaa !5
  %28 = load double, ptr @s22, align 8, !tbaa !5
  %29 = load double, ptr @s20, align 8, !tbaa !5
  %30 = fmul double 0x4134E9DD00000000, %29
  %31 = fneg double %30
  %32 = call double @llvm.fmuladd.f64(double 5.276120e+05, double %28, double %31)
  store double %32, ptr %4, align 8, !tbaa !5
  %33 = load double, ptr %4, align 8, !tbaa !5
  %34 = fdiv double %33, 0x41EFFFF4D7600000
  %35 = fptosi double %34 to i64
  store i64 %35, ptr %2, align 8, !tbaa !9
  %36 = load i64, ptr %2, align 8, !tbaa !9
  %37 = sitofp i64 %36 to double
  %38 = load double, ptr %4, align 8, !tbaa !5
  %39 = fneg double %37
  %40 = call double @llvm.fmuladd.f64(double %39, double 0x41EFFFF4D7600000, double %38)
  store double %40, ptr %4, align 8, !tbaa !5
  %41 = load double, ptr %4, align 8, !tbaa !5
  %42 = fcmp olt double %41, 0.000000e+00
  br i1 %42, label %43, label %46

43:                                               ; preds = %24
  %44 = load double, ptr %4, align 8, !tbaa !5
  %45 = fadd double %44, 0x41EFFFF4D7600000
  store double %45, ptr %4, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %43, %24
  %47 = load double, ptr @s21, align 8, !tbaa !5
  store double %47, ptr @s20, align 8, !tbaa !5
  %48 = load double, ptr @s22, align 8, !tbaa !5
  store double %48, ptr @s21, align 8, !tbaa !5
  %49 = load double, ptr %4, align 8, !tbaa !5
  store double %49, ptr @s22, align 8, !tbaa !5
  %50 = load double, ptr %3, align 8, !tbaa !5
  %51 = load double, ptr %4, align 8, !tbaa !5
  %52 = fcmp ole double %50, %51
  br i1 %52, label %53, label %59

53:                                               ; preds = %46
  %54 = load double, ptr %3, align 8, !tbaa !5
  %55 = load double, ptr %4, align 8, !tbaa !5
  %56 = fsub double %54, %55
  %57 = fadd double %56, 0x41EFFFFFE5E00000
  %58 = fmul double %57, 0x3DF000000D00000B
  store double %58, ptr %1, align 8
  store i32 1, ptr %5, align 4
  br label %64

59:                                               ; preds = %46
  %60 = load double, ptr %3, align 8, !tbaa !5
  %61 = load double, ptr %4, align 8, !tbaa !5
  %62 = fsub double %60, %61
  %63 = fmul double %62, 0x3DF000000D00000B
  store double %63, ptr %1, align 8
  store i32 1, ptr %5, align 4
  br label %64

64:                                               ; preds = %59, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  %65 = load double, ptr %1, align 8
  ret double %65
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

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

@s11 = external hidden local_unnamed_addr global double, align 8
@s10 = external hidden local_unnamed_addr global double, align 8
@s12 = external hidden local_unnamed_addr global double, align 8
@s22 = external hidden local_unnamed_addr global double, align 8
@s20 = external hidden local_unnamed_addr global double, align 8
@s21 = external hidden local_unnamed_addr global double, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local double @MRG32k3a() local_unnamed_addr #0 {
  %1 = load double, ptr @s11, align 8, !tbaa !5
  %2 = load double, ptr @s10, align 8, !tbaa !5
  store double %1, ptr @s10, align 8, !tbaa !5
  %3 = load double, ptr @s12, align 8, !tbaa !5
  store double %3, ptr @s11, align 8, !tbaa !5
  %4 = load double, ptr @s22, align 8, !tbaa !5
  %5 = load double, ptr @s20, align 8, !tbaa !5
  %6 = insertelement <2 x double> poison, double %2, i64 0
  %7 = insertelement <2 x double> %6, double %5, i64 1
  %8 = fmul <2 x double> %7, <double -8.107280e+05, double 0xC134E9DD00000000>
  %9 = insertelement <2 x double> poison, double %1, i64 0
  %10 = insertelement <2 x double> %9, double %4, i64 1
  %11 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %10, <2 x double> <double 1.403580e+06, double 5.276120e+05>, <2 x double> %8)
  %12 = fdiv <2 x double> %11, <double 0x41EFFFFFE5E00000, double 0x41EFFFF4D7600000>
  %13 = fptosi <2 x double> %12 to <2 x i64>
  %14 = sitofp <2 x i64> %13 to <2 x double>
  %15 = fneg <2 x double> %14
  %16 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %15, <2 x double> <double 0x41EFFFFFE5E00000, double 0x41EFFFF4D7600000>, <2 x double> %11)
  %17 = fcmp olt <2 x double> %16, zeroinitializer
  %18 = fadd <2 x double> %16, <double 0x41EFFFFFE5E00000, double 0x41EFFFF4D7600000>
  %19 = select <2 x i1> %17, <2 x double> %18, <2 x double> %16
  %20 = extractelement <2 x double> %19, i64 0
  store double %20, ptr @s12, align 8, !tbaa !5
  %21 = load double, ptr @s21, align 8, !tbaa !5
  store double %21, ptr @s20, align 8, !tbaa !5
  store double %4, ptr @s21, align 8, !tbaa !5
  %22 = extractelement <2 x double> %19, i64 1
  store double %22, ptr @s22, align 8, !tbaa !5
  %23 = fcmp ugt double %20, %22
  %24 = fsub double %20, %22
  %25 = fadd double %24, 0x41EFFFFFE5E00000
  %.019.in = select i1 %23, double %24, double %25
  %.019 = fmul double %.019.in, 0x3DF000000D00000B
  ret double %.019
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) 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 speculatable willreturn memory(none) }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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