; LLVM IR from SciCompMod/GMGPolar :: src/InputFunctions/BoundaryConditions (cartesianR6_Boundary_CzarnyGeometry)

; 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.CartesianR6_Boundary_CzarnyGeometry = type { %class.BoundaryConditions, double, double, double, double }
%class.BoundaryConditions = type { ptr }

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK35CartesianR6_Boundary_CzarnyGeometry3u_DERKdS1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) unnamed_addr #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %12 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %13 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 2
  %14 = load double, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !13
  %17 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %18 = load double, ptr %17, align 8, !tbaa !14
  %19 = fdiv double %16, %18
  %20 = fmul double 2.000000e+00, %19
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = load double, ptr %21, align 8, !tbaa !13
  %23 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 2
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = call double @llvm.fmuladd.f64(double %20, double %22, double %24)
  %26 = call double @llvm.fmuladd.f64(double %14, double %25, double 1.000000e+00)
  %27 = call double @sqrt(double noundef %26) #4
  store double %27, ptr %11, align 8, !tbaa !13
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load double, ptr %28, align 8, !tbaa !13
  %30 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = fdiv double %29, %31
  %33 = fsub double %32, 1.000000e+00
  %34 = call double @pow(double noundef %33, double noundef 6.000000e+00) #4
  %35 = fmul double 4.096000e-01, %34
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load double, ptr %36, align 8, !tbaa !13
  %38 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %39 = load double, ptr %38, align 8, !tbaa !14
  %40 = fdiv double %37, %39
  %41 = fadd double %40, 1.000000e+00
  %42 = call double @pow(double noundef %41, double noundef 6.000000e+00) #4
  %43 = fmul double %35, %42
  %44 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 3
  %45 = load double, ptr %44, align 8, !tbaa !15
  %46 = fmul double 0x401921FB54442D18, %45
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %50 = load double, ptr %49, align 8, !tbaa !14
  %51 = fdiv double %48, %50
  %52 = fmul double %46, %51
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = load double, ptr %53, align 8, !tbaa !13
  %55 = fmul double %52, %54
  %56 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 4
  %57 = load double, ptr %56, align 8, !tbaa !16
  %58 = fmul double %55, %57
  %59 = load double, ptr %11, align 8, !tbaa !13
  %60 = fsub double 2.000000e+00, %59
  %61 = fdiv double %58, %60
  %62 = call double @sin(double noundef %61) #4
  %63 = fmul double %43, %62
  %64 = load double, ptr %11, align 8, !tbaa !13
  %65 = fsub double 1.000000e+00, %64
  %66 = fmul double 0x401921FB54442D18, %65
  %67 = getelementptr inbounds %class.CartesianR6_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 2
  %68 = load double, ptr %67, align 8, !tbaa !9
  %69 = fdiv double %66, %68
  %70 = call double @cos(double noundef %69) #4
  %71 = fmul double %63, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret double %71
}

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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

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

; Function Attrs: nounwind
declare double @cos(double noundef) #0

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 16}
!10 = !{!"_ZTS35CartesianR6_Boundary_CzarnyGeometry", !11, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32}
!11 = !{!"_ZTS18BoundaryConditions"}
!12 = !{!"double", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !12, i64 8}
!15 = !{!10, !12, i64 24}
!16 = !{!10, !12, i64 32}


; 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 nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local noundef double @_ZNK35CartesianR6_Boundary_CzarnyGeometry3u_DERKdS1_S1_S1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(40) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %1, ptr nocapture noundef nonnull readnone align 8 dereferenceable(8) %2, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %3, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %4) unnamed_addr #1 align 2 {
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load double, ptr %6, align 8, !tbaa !5
  %8 = load double, ptr %1, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load double, ptr %9, align 8, !tbaa !12
  %11 = fdiv double %8, %10
  %12 = fmul double %11, 2.000000e+00
  %13 = load double, ptr %4, align 8, !tbaa !11
  %14 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %7)
  %15 = tail call double @llvm.fmuladd.f64(double %7, double %14, double 1.000000e+00)
  %16 = tail call double @sqrt(double noundef %15) #3
  %17 = load double, ptr %1, align 8, !tbaa !11
  %18 = load double, ptr %9, align 8, !tbaa !12
  %19 = fdiv double %17, %18
  %20 = fadd double %19, -1.000000e+00
  %21 = tail call double @pow(double noundef %20, double noundef 6.000000e+00) #3
  %22 = fmul double %21, 4.096000e-01
  %23 = load double, ptr %1, align 8, !tbaa !11
  %24 = load double, ptr %9, align 8, !tbaa !12
  %25 = fdiv double %23, %24
  %26 = fadd double %25, 1.000000e+00
  %27 = tail call double @pow(double noundef %26, double noundef 6.000000e+00) #3
  %28 = fmul double %22, %27
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load double, ptr %29, align 8, !tbaa !13
  %31 = fmul double %30, 0x401921FB54442D18
  %32 = load double, ptr %1, align 8, !tbaa !11
  %33 = load double, ptr %9, align 8, !tbaa !12
  %34 = fdiv double %32, %33
  %35 = fmul double %31, %34
  %36 = load double, ptr %3, align 8, !tbaa !11
  %37 = fmul double %36, %35
  %38 = getelementptr inbounds i8, ptr %0, i64 32
  %39 = load double, ptr %38, align 8, !tbaa !14
  %40 = fmul double %39, %37
  %41 = fsub double 2.000000e+00, %16
  %42 = fdiv double %40, %41
  %43 = tail call double @sin(double noundef %42) #3
  %44 = fmul double %28, %43
  %45 = fsub double 1.000000e+00, %16
  %46 = fmul double %45, 0x401921FB54442D18
  %47 = load double, ptr %6, align 8, !tbaa !5
  %48 = fdiv double %46, %47
  %49 = tail call double @cos(double noundef %48) #3
  %50 = fmul double %44, %49
  ret double %50
}

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) 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 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, !8, i64 16}
!6 = !{!"_ZTS35CartesianR6_Boundary_CzarnyGeometry", !7, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32}
!7 = !{!"_ZTS18BoundaryConditions"}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!8, !8, i64 0}
!12 = !{!6, !8, i64 8}
!13 = !{!6, !8, i64 24}
!14 = !{!6, !8, i64 32}


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