; LLVM IR from gnikit/md-sim :: src/md_pair_potentials.ll (ZN8MD_tools9BIP_forceERKdddd)

; 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.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { double }
%"struct.std::_Head_base.1" = type { double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8MD_tools9BIP_forceERKdddd(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %1, double noundef %2, double noundef %3, double noundef %4) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %14 = load double, ptr %10, align 8, !tbaa !9
  %15 = fsub double %14, 2.000000e+00
  %16 = call noundef double @_ZSt3absd(double noundef %15)
  %17 = call noundef double @_ZNSt14numeric_limitsIdE7epsilonEv() #6
  %18 = fcmp ole double %16, %17
  br i1 %18, label %19, label %43

19:                                               ; preds = %5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = load double, ptr %9, align 8, !tbaa !9
  %25 = load double, ptr %9, align 8, !tbaa !9
  %26 = fmul double %24, %25
  %27 = call double @llvm.fmuladd.f64(double %21, double %23, double %26)
  %28 = call double @sqrt(double noundef %27) #6
  store double %28, ptr %11, align 8, !tbaa !9
  %29 = load double, ptr %8, align 8, !tbaa !9
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = fmul double %29, %31
  %33 = load double, ptr %11, align 8, !tbaa !9
  %34 = load double, ptr %8, align 8, !tbaa !9
  %35 = fneg double %34
  %36 = fsub double %35, 2.000000e+00
  %37 = call double @pow(double noundef %33, double noundef %36) #6
  %38 = fmul double %32, %37
  store double %38, ptr %12, align 8, !tbaa !9
  %39 = load double, ptr %11, align 8, !tbaa !9
  %40 = load double, ptr %8, align 8, !tbaa !9
  %41 = fneg double %40
  %42 = call double @pow(double noundef %39, double noundef %41) #6
  store double %42, ptr %13, align 8, !tbaa !9
  br label %73

43:                                               ; preds = %5
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = load double, ptr %10, align 8, !tbaa !9
  %47 = call double @pow(double noundef %45, double noundef %46) #6
  %48 = load double, ptr %9, align 8, !tbaa !9
  %49 = load double, ptr %10, align 8, !tbaa !9
  %50 = call double @pow(double noundef %48, double noundef %49) #6
  %51 = fadd double %47, %50
  store double %51, ptr %11, align 8, !tbaa !9
  %52 = load double, ptr %8, align 8, !tbaa !9
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load double, ptr %53, align 8, !tbaa !9
  %55 = load double, ptr %10, align 8, !tbaa !9
  %56 = fsub double %55, 1.000000e+00
  %57 = call double @pow(double noundef %54, double noundef %56) #6
  %58 = fmul double %52, %57
  %59 = load double, ptr %11, align 8, !tbaa !9
  %60 = load double, ptr %8, align 8, !tbaa !9
  %61 = fneg double %60
  %62 = load double, ptr %10, align 8, !tbaa !9
  %63 = fdiv double %61, %62
  %64 = fsub double %63, 1.000000e+00
  %65 = call double @pow(double noundef %59, double noundef %64) #6
  %66 = fmul double %58, %65
  store double %66, ptr %12, align 8, !tbaa !9
  %67 = load double, ptr %11, align 8, !tbaa !9
  %68 = load double, ptr %8, align 8, !tbaa !9
  %69 = fneg double %68
  %70 = load double, ptr %10, align 8, !tbaa !9
  %71 = fdiv double %69, %70
  %72 = call double @pow(double noundef %67, double noundef %71) #6
  store double %72, ptr %13, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %43, %19
  call void @_ZSt10make_tupleIJRdS0_EESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE7epsilonEv() #3 align 2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

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

; Function Attrs: nounwind
declare double @pow(double noundef, double noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRdS0_EESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; 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 = { inlinehint mustprogress 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 #3 = { mustprogress 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = !{!"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"

%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { double }
%"struct.std::_Head_base.1" = type { double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8MD_tools9BIP_forceERKdddd(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1, double noundef %2, double noundef %3, double noundef %4) local_unnamed_addr #0 align 2 {
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %8 = fadd double %4, -2.000000e+00
  %9 = tail call noundef double @_ZSt3absd(double noundef %8)
  %10 = tail call noundef double @_ZNSt14numeric_limitsIdE7epsilonEv() #6
  %11 = fcmp ugt double %9, %10
  %12 = load double, ptr %1, align 8, !tbaa !5
  br i1 %11, label %22, label %13

13:                                               ; preds = %5
  %14 = fmul double %3, %3
  %15 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %14)
  %sqrt = tail call double @llvm.sqrt.f64(double %15)
  %16 = fmul double %12, %2
  %17 = fneg double %2
  %18 = fsub double -2.000000e+00, %2
  %19 = tail call double @pow(double noundef %sqrt, double noundef %18) #6
  %20 = fmul double %16, %19
  %21 = tail call double @pow(double noundef %sqrt, double noundef %17) #6
  br label %36

22:                                               ; preds = %5
  %23 = tail call double @pow(double noundef %12, double noundef %4) #6
  %24 = tail call double @pow(double noundef %3, double noundef %4) #6
  %25 = fadd double %23, %24
  %26 = load double, ptr %1, align 8, !tbaa !5
  %27 = fadd double %4, -1.000000e+00
  %28 = tail call double @pow(double noundef %26, double noundef %27) #6
  %29 = fmul double %28, %2
  %30 = fneg double %2
  %31 = fdiv double %30, %4
  %32 = fadd double %31, -1.000000e+00
  %33 = tail call double @pow(double noundef %25, double noundef %32) #6
  %34 = fmul double %29, %33
  %35 = tail call double @pow(double noundef %25, double noundef %31) #6
  br label %36

36:                                               ; preds = %22, %13
  %.sink = phi double [ %34, %22 ], [ %20, %13 ]
  %storemerge = phi double [ %35, %22 ], [ %21, %13 ]
  store double %.sink, ptr %6, align 8
  store double %storemerge, ptr %7, align 8, !tbaa !5
  call void @_ZSt10make_tupleIJRdS0_EESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind writable sret(%"class.std::tuple") align 8 %0, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3absd(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE7epsilonEv() local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @pow(double noundef, double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt10make_tupleIJRdS0_EESt5tupleIJDpNSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeEEEDpOS4_(ptr dead_on_unwind noalias writable sret(%"class.std::tuple") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

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

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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++ TBAA"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass