; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/MEESecurity.ll (ZN4TPCE12CMEESecurity17GetCompletionTimeExdPNS_6CMoneyE)

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

%"class.TPCE::CMoney" = type { i64 }

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZN4TPCE12CMEESecurity14CalculatePriceExd(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef, double noundef) #0 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN4TPCE12CMEESecurity17GetCompletionTimeExdPNS_6CMoneyE(ptr noundef nonnull align 8 dereferenceable(64) %0, i64 noundef %1, double noundef %2, ptr noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca %"class.TPCE::CMoney", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !11
  store ptr %3, ptr %8, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %12 = call noundef double @_ZN4TPCE12CMEESecurity6NegExpEd(ptr noundef nonnull align 8 dereferenceable(64) %11, double noundef 1.000000e+00)
  store double %12, ptr %9, align 8, !tbaa !11
  %13 = load double, ptr %9, align 8, !tbaa !11
  %14 = fcmp ogt double %13, 5.000000e+00
  br i1 %14, label %15, label %16

15:                                               ; preds = %4
  store double 5.000000e+00, ptr %9, align 8, !tbaa !11
  br label %16

16:                                               ; preds = %15, %4
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %27

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %20 = load i64, ptr %6, align 8, !tbaa !9
  %21 = load double, ptr %7, align 8, !tbaa !11
  %22 = load double, ptr %9, align 8, !tbaa !11
  %23 = fadd double %21, %22
  %24 = call i64 @_ZN4TPCE12CMEESecurity14CalculatePriceExd(ptr noundef nonnull align 8 dereferenceable(64) %11, i64 noundef %20, double noundef %23)
  %25 = getelementptr inbounds %"class.TPCE::CMoney", ptr %10, i32 0, i32 0
  store i64 %24, ptr %25, align 8
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %26, ptr align 8 %10, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %27

27:                                               ; preds = %19, %16
  %28 = load double, ptr %7, align 8, !tbaa !11
  %29 = load double, ptr %9, align 8, !tbaa !11
  %30 = fadd double %28, %29
  %31 = fadd double %30, 1.000000e+00
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret double %31
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN4TPCE12CMEESecurity6NegExpEd(ptr noundef nonnull align 8 dereferenceable(64), double noundef) #3 align 2

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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{i64 0, i64 8, !9}


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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZN4TPCE12CMEESecurity14CalculatePriceExd(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef, double noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN4TPCE12CMEESecurity17GetCompletionTimeExdPNS_6CMoneyE(ptr noundef nonnull align 8 dereferenceable(64) %0, i64 noundef %1, double noundef %2, ptr noundef writeonly %3) local_unnamed_addr #0 align 2 {
  %5 = tail call noundef double @_ZN4TPCE12CMEESecurity6NegExpEd(ptr noundef nonnull align 8 dereferenceable(64) %0, double noundef 1.000000e+00)
  %6 = fcmp ogt double %5, 5.000000e+00
  %.0 = select i1 %6, double 5.000000e+00, double %5
  %.not = icmp eq ptr %3, null
  %.pre = fadd double %.0, %2
  br i1 %.not, label %._crit_edge, label %7

7:                                                ; preds = %4
  %8 = tail call i64 @_ZN4TPCE12CMEESecurity14CalculatePriceExd(ptr noundef nonnull align 8 dereferenceable(64) %0, i64 noundef %1, double noundef %.pre)
  store i64 %8, ptr %3, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %4, %7
  %9 = fadd double %.pre, 1.000000e+00
  ret double %9
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZN4TPCE12CMEESecurity6NegExpEd(ptr noundef nonnull align 8 dereferenceable(64), double noundef) local_unnamed_addr #1 align 2

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 = { inlinehint 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" }

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


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