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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK37CartesianR2_Boundary_CircularGeometry12u_D_InteriorERKdS1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(16) %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 #2 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
  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
  %11 = load ptr, ptr %6, align 8
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = load double, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %class.CartesianR2_Boundary_CircularGeometry, ptr %11, i32 0, i32 1
  %15 = load double, ptr %14, align 8, !tbaa !11
  %16 = fdiv double %13, %15
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = load double, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %class.CartesianR2_Boundary_CircularGeometry, ptr %11, i32 0, i32 1
  %20 = load double, ptr %19, align 8, !tbaa !11
  %21 = fdiv double %18, %20
  %22 = fneg double %16
  %23 = call double @llvm.fmuladd.f64(double %22, double %21, double 1.000000e+00)
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load double, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %class.CartesianR2_Boundary_CircularGeometry, ptr %11, i32 0, i32 1
  %27 = load double, ptr %26, align 8, !tbaa !11
  %28 = fdiv double %25, %27
  %29 = fmul double 0x401921FB54442D18, %28
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = fmul double %29, %31
  %33 = call double @sin(double noundef %32) #3
  %34 = fmul double %23, %33
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %class.CartesianR2_Boundary_CircularGeometry, ptr %11, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = fdiv double %36, %38
  %40 = fmul double 0x401921FB54442D18, %39
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = fmul double %40, %42
  %44 = call double @cos(double noundef %43) #3
  %45 = fmul double %34, %44
  ret double %45
}

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

!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}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS37CartesianR2_Boundary_CircularGeometry", !13, i64 0, !10, i64 8}
!13 = !{!"_ZTS18BoundaryConditions"}


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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write, argmem: readwrite) uwtable
define dso_local noundef double @_ZNK37CartesianR2_Boundary_CircularGeometry12u_D_InteriorERKdS1_S1_S1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %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 #2 align 2 {
  %6 = load double, ptr %1, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load double, ptr %7, align 8, !tbaa !9
  %9 = fdiv double %6, %8
  %10 = fneg double %9
  %11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double 1.000000e+00)
  %12 = fmul double %9, 0x401921FB54442D18
  %13 = load double, ptr %3, align 8, !tbaa !5
  %14 = fmul double %13, %12
  %15 = tail call double @sin(double noundef %14) #3
  %16 = fmul double %11, %15
  %17 = load double, ptr %1, align 8, !tbaa !5
  %18 = load double, ptr %7, align 8, !tbaa !9
  %19 = fdiv double %17, %18
  %20 = fmul double %19, 0x401921FB54442D18
  %21 = load double, ptr %4, align 8, !tbaa !5
  %22 = fmul double %21, %20
  %23 = tail call double @cos(double noundef %22) #3
  %24 = fmul double %16, %23
  ret double %24
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #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++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTS37CartesianR2_Boundary_CircularGeometry", !11, i64 0, !6, i64 8}
!11 = !{!"_ZTS18BoundaryConditions"}


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