; LLVM IR from SciCompMod/GMGPolar :: src/InputFunctions/BoundaryConditions (cartesianR6_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.CartesianR6_Boundary_ShafranovGeometry = type { %class.BoundaryConditions, double, double, double }
%class.BoundaryConditions = type { ptr }

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK38CartesianR6_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.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %15 = load double, ptr %14, align 8, !tbaa !11
  %16 = fdiv double %13, %15
  %17 = fsub double %16, 1.000000e+00
  %18 = call double @pow(double noundef %17, double noundef 6.000000e+00) #3
  %19 = fmul double 4.096000e-01, %18
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %23 = load double, ptr %22, align 8, !tbaa !11
  %24 = fdiv double %21, %23
  %25 = fadd double %24, 1.000000e+00
  %26 = call double @pow(double noundef %25, double noundef 6.000000e+00) #3
  %27 = fmul double %19, %26
  %28 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 2
  %29 = load double, ptr %28, align 8, !tbaa !14
  %30 = fmul double 2.000000e+00, %29
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %34 = load double, ptr %33, align 8, !tbaa !11
  %35 = fdiv double %32, %34
  %36 = fmul double %30, %35
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %42 = load double, ptr %41, align 8, !tbaa !11
  %43 = fdiv double %40, %42
  %44 = fmul double 2.000000e+00, %43
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = fmul double %44, %46
  %48 = call double @llvm.fmuladd.f64(double %36, double %38, double %47)
  %49 = fmul double 0x400921FB54442D18, %48
  %50 = call double @sin(double noundef %49) #3
  %51 = fmul double %27, %50
  %52 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 3
  %53 = load double, ptr %52, align 8, !tbaa !15
  %54 = fmul double -2.000000e+00, %53
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %58 = load double, ptr %57, align 8, !tbaa !11
  %59 = fdiv double %56, %58
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load double, ptr %60, align 8, !tbaa !9
  %62 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %63 = load double, ptr %62, align 8, !tbaa !11
  %64 = fdiv double %61, %63
  %65 = fmul double %59, %64
  %66 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 2
  %67 = load double, ptr %66, align 8, !tbaa !14
  %68 = fmul double 2.000000e+00, %67
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load double, ptr %69, align 8, !tbaa !9
  %71 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %72 = load double, ptr %71, align 8, !tbaa !11
  %73 = fdiv double %70, %72
  %74 = fmul double %68, %73
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = fmul double %74, %76
  %78 = fneg double %77
  %79 = call double @llvm.fmuladd.f64(double %54, double %65, double %78)
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load double, ptr %80, align 8, !tbaa !9
  %82 = getelementptr inbounds %class.CartesianR6_Boundary_ShafranovGeometry, ptr %11, i32 0, i32 1
  %83 = load double, ptr %82, align 8, !tbaa !11
  %84 = fdiv double %81, %83
  %85 = fmul double 2.000000e+00, %84
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = load double, ptr %86, align 8, !tbaa !9
  %88 = call double @llvm.fmuladd.f64(double %85, double %87, double %79)
  %89 = fmul double 0x400921FB54442D18, %88
  %90 = call double @cos(double noundef %89) #3
  %91 = fmul double %51, %90
  ret double %91
}

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 = { 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 }

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

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

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

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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"_ZTS38CartesianR6_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