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

; 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_ShafranovGeometry = type { %class.BoundaryConditions, double, double, 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 @_ZNK38CartesianR2_Boundary_ShafranovGeometry12u_D_InteriorERKdS1_S1_S1_(ptr noundef nonnull align 8 dereferenceable(32) %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_ShafranovGeometry, 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_ShafranovGeometry, 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 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 2
  %25 = load double, ptr %24, align 8, !tbaa !14
  %26 = fmul double 2.000000e+00, %25
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %30 = load double, ptr %29, align 8, !tbaa !11
  %31 = fdiv double %28, %30
  %32 = fmul double %26, %31
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = fdiv double %36, %38
  %40 = fmul double 2.000000e+00, %39
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = fmul double %40, %42
  %44 = call double @llvm.fmuladd.f64(double %32, double %34, double %43)
  %45 = fmul double 0x400921FB54442D18, %44
  %46 = call double @sin(double noundef %45) #3
  %47 = fmul double %23, %46
  %48 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 3
  %49 = load double, ptr %48, align 8, !tbaa !15
  %50 = fmul double -2.000000e+00, %49
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %54 = load double, ptr %53, align 8, !tbaa !11
  %55 = fdiv double %52, %54
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = fdiv double %57, %59
  %61 = fmul double %55, %60
  %62 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 2
  %63 = load double, ptr %62, align 8, !tbaa !14
  %64 = fmul double 2.000000e+00, %63
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = load double, ptr %65, align 8, !tbaa !9
  %67 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %68 = load double, ptr %67, align 8, !tbaa !11
  %69 = fdiv double %66, %68
  %70 = fmul double %64, %69
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = load double, ptr %71, align 8, !tbaa !9
  %73 = fmul double %70, %72
  %74 = fneg double %73
  %75 = call double @llvm.fmuladd.f64(double %50, double %61, double %74)
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load double, ptr %76, align 8, !tbaa !9
  %78 = getelementptr inbounds %class.CartesianR2_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = fdiv double %77, %79
  %81 = fmul double 2.000000e+00, %80
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = call double @llvm.fmuladd.f64(double %81, double %83, double %75)
  %85 = fmul double 0x400921FB54442D18, %84
  %86 = call double @cos(double noundef %85) #3
  %87 = fmul double %47, %86
  ret double %87
}

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 = !{!"_ZTS38CartesianR2_Boundary_ShafranovGeometry", !13, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!"_ZTS18BoundaryConditions"}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !10, i64 24}


; 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 @_ZNK38CartesianR2_Boundary_ShafranovGeometry12u_D_InteriorERKdS1_S1_S1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %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 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load double, ptr %12, align 8, !tbaa !12
  %14 = fmul double %13, 2.000000e+00
  %15 = fmul double %9, %14
  %16 = load double, ptr %3, align 8, !tbaa !5
  %17 = fmul double %9, 2.000000e+00
  %18 = fmul double %17, %16
  %19 = tail call double @llvm.fmuladd.f64(double %15, double %16, double %18)
  %20 = fmul double %19, 0x400921FB54442D18
  %21 = tail call double @sin(double noundef %20) #3
  %22 = fmul double %11, %21
  %23 = getelementptr inbounds i8, ptr %0, i64 24
  %24 = load double, ptr %23, align 8, !tbaa !13
  %25 = fmul double %24, -2.000000e+00
  %26 = load double, ptr %1, align 8, !tbaa !5
  %27 = load double, ptr %7, align 8, !tbaa !9
  %28 = fdiv double %26, %27
  %29 = fmul double %28, %28
  %30 = load double, ptr %12, align 8, !tbaa !12
  %31 = load double, ptr %4, align 8, !tbaa !5
  %32 = fmul double %30, -2.000000e+00
  %33 = fmul double %28, %32
  %34 = fmul double %31, %33
  %35 = tail call double @llvm.fmuladd.f64(double %25, double %29, double %34)
  %36 = fmul double %28, 2.000000e+00
  %37 = tail call double @llvm.fmuladd.f64(double %36, double %31, double %35)
  %38 = fmul double %37, 0x400921FB54442D18
  %39 = tail call double @cos(double noundef %38) #3
  %40 = fmul double %22, %39
  ret double %40
}

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


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