; LLVM IR from Wodnerstruck/CPP-Quantum-Chemistry-Practice :: Project1-Molecular-Geometry-Analysis/src/molecule.ll (ZN8Molecule3oppEiiii)

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN8Molecule5angleEiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN8Molecule3oppEiiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %18 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %19 = load i32, ptr %9, align 4, !tbaa !9
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %19, i32 noundef %20, i32 noundef 1)
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = load i32, ptr %10, align 4, !tbaa !9
  %24 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %22, i32 noundef %23, i32 noundef 2)
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %25, i32 noundef %26, i32 noundef 2)
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %28, i32 noundef %29, i32 noundef 1)
  %31 = fmul double %27, %30
  %32 = fneg double %31
  %33 = call double @llvm.fmuladd.f64(double %21, double %24, double %32)
  store double %33, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %8, align 4, !tbaa !9
  %36 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %34, i32 noundef %35, i32 noundef 2)
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %37, i32 noundef %38, i32 noundef 0)
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %40, i32 noundef %41, i32 noundef 0)
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %43, i32 noundef %44, i32 noundef 2)
  %46 = fmul double %42, %45
  %47 = fneg double %46
  %48 = call double @llvm.fmuladd.f64(double %36, double %39, double %47)
  store double %48, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %49 = load i32, ptr %9, align 4, !tbaa !9
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %49, i32 noundef %50, i32 noundef 0)
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %52, i32 noundef %53, i32 noundef 1)
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %55, i32 noundef %56, i32 noundef 1)
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %58, i32 noundef %59, i32 noundef 0)
  %61 = fmul double %57, %60
  %62 = fneg double %61
  %63 = call double @llvm.fmuladd.f64(double %51, double %54, double %62)
  store double %63, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %64 = load double, ptr %11, align 8, !tbaa !11
  %65 = load i32, ptr %9, align 4, !tbaa !9
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %65, i32 noundef %66, i32 noundef 0)
  %68 = fmul double %64, %67
  store double %68, ptr %14, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %69 = load double, ptr %12, align 8, !tbaa !11
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = load i32, ptr %7, align 4, !tbaa !9
  %72 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %70, i32 noundef %71, i32 noundef 1)
  %73 = fmul double %69, %72
  store double %73, ptr %15, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %74 = load double, ptr %13, align 8, !tbaa !11
  %75 = load i32, ptr %9, align 4, !tbaa !9
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %75, i32 noundef %76, i32 noundef 2)
  %78 = fmul double %74, %77
  store double %78, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %79 = load double, ptr %14, align 8, !tbaa !11
  %80 = load double, ptr %15, align 8, !tbaa !11
  %81 = fadd double %79, %80
  %82 = load double, ptr %16, align 8, !tbaa !11
  %83 = fadd double %81, %82
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = load i32, ptr %10, align 4, !tbaa !9
  %87 = call noundef double @_ZN8Molecule5angleEiii(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef %84, i32 noundef %85, i32 noundef %86)
  %88 = call double @sin(double noundef %87) #4
  %89 = fdiv double %83, %88
  store double %89, ptr %17, align 8, !tbaa !11
  %90 = load double, ptr %17, align 8, !tbaa !11
  %91 = fcmp olt double %90, -1.000000e+00
  br i1 %91, label %92, label %94

92:                                               ; preds = %5
  %93 = call double @asin(double noundef -1.000000e+00) #4
  store double %93, ptr %17, align 8, !tbaa !11
  br label %103

94:                                               ; preds = %5
  %95 = load double, ptr %17, align 8, !tbaa !11
  %96 = fcmp ogt double %95, 1.000000e+00
  br i1 %96, label %97, label %99

97:                                               ; preds = %94
  %98 = call double @asin(double noundef 1.000000e+00) #4
  store double %98, ptr %17, align 8, !tbaa !11
  br label %102

99:                                               ; preds = %94
  %100 = load double, ptr %17, align 8, !tbaa !11
  %101 = call double @asin(double noundef %100) #4
  store double %101, ptr %17, align 8, !tbaa !11
  br label %102

102:                                              ; preds = %99, %97
  br label %103

103:                                              ; preds = %102, %92
  %104 = load double, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret double %104
}

; Function Attrs: nounwind
declare double @sin(double noundef) #3

; Function Attrs: nounwind
declare double @asin(double noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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"

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN8Molecule5angleEiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZN8Molecule3oppEiiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 align 2 {
  %6 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 1)
  %7 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 2)
  %8 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 2)
  %9 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 1)
  %10 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 2)
  %11 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 0)
  %12 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 0)
  %13 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 2)
  %14 = fneg double %12
  %15 = fmul double %13, %14
  %16 = tail call double @llvm.fmuladd.f64(double %10, double %11, double %15)
  %17 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 0)
  %18 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 1)
  %19 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %2, i32 noundef 1)
  %20 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %4, i32 noundef 0)
  %21 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %1, i32 noundef 0)
  %22 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %1, i32 noundef 1)
  %23 = fmul double %16, %22
  %24 = tail call noundef double @_ZN8Molecule4unitEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %3, i32 noundef %1, i32 noundef 2)
  %25 = insertelement <2 x double> poison, double %8, i64 0
  %26 = insertelement <2 x double> %25, double %19, i64 1
  %27 = fneg <2 x double> %26
  %28 = insertelement <2 x double> poison, double %9, i64 0
  %29 = insertelement <2 x double> %28, double %20, i64 1
  %30 = fmul <2 x double> %29, %27
  %31 = insertelement <2 x double> poison, double %6, i64 0
  %32 = insertelement <2 x double> %31, double %17, i64 1
  %33 = insertelement <2 x double> poison, double %7, i64 0
  %34 = insertelement <2 x double> %33, double %18, i64 1
  %35 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %32, <2 x double> %34, <2 x double> %30)
  %36 = insertelement <2 x double> poison, double %21, i64 0
  %37 = insertelement <2 x double> %36, double %24, i64 1
  %38 = fmul <2 x double> %35, %37
  %39 = extractelement <2 x double> %38, i64 0
  %40 = fadd double %39, %23
  %41 = extractelement <2 x double> %38, i64 1
  %42 = fadd double %40, %41
  %43 = tail call noundef double @_ZN8Molecule5angleEiii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %2, i32 noundef %3, i32 noundef %4)
  %44 = tail call double @sin(double noundef %43) #4
  %45 = fdiv double %42, %44
  %46 = fcmp olt double %45, -1.000000e+00
  br i1 %46, label %51, label %47

47:                                               ; preds = %5
  %48 = fcmp ogt double %45, 1.000000e+00
  br i1 %48, label %51, label %49

49:                                               ; preds = %47
  %50 = tail call double @asin(double noundef %45) #4
  br label %51

51:                                               ; preds = %47, %5, %49
  %.0 = phi double [ %50, %49 ], [ 0xBFF921FB54442D18, %5 ], [ 0x3FF921FB54442D18, %47 ]
  ret double %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sin(double noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @asin(double noundef) local_unnamed_addr #2

; 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>) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}


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