; LLVM IR from SciCompMod/GMGPolar :: src/InputFunctions/BoundaryConditions (cartesianR2_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.CartesianR2_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 @_ZNK35CartesianR2_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.CartesianR2_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.CartesianR2_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.CartesianR2_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.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %31 = load double, ptr %30, align 8, !tbaa !14
  %32 = fdiv double %29, %31
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load double, ptr %33, align 8, !tbaa !13
  %35 = getelementptr inbounds %class.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %36 = load double, ptr %35, align 8, !tbaa !14
  %37 = fdiv double %34, %36
  %38 = fneg double %32
  %39 = call double @llvm.fmuladd.f64(double %38, double %37, double 1.000000e+00)
  %40 = getelementptr inbounds %class.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 3
  %41 = load double, ptr %40, align 8, !tbaa !15
  %42 = fmul double 0x401921FB54442D18, %41
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = load double, ptr %43, align 8, !tbaa !13
  %45 = getelementptr inbounds %class.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 1
  %46 = load double, ptr %45, align 8, !tbaa !14
  %47 = fdiv double %44, %46
  %48 = fmul double %42, %47
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load double, ptr %49, align 8, !tbaa !13
  %51 = fmul double %48, %50
  %52 = getelementptr inbounds %class.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 4
  %53 = load double, ptr %52, align 8, !tbaa !16
  %54 = fmul double %51, %53
  %55 = load double, ptr %11, align 8, !tbaa !13
  %56 = fsub double 2.000000e+00, %55
  %57 = fdiv double %54, %56
  %58 = call double @sin(double noundef %57) #4
  %59 = fmul double %39, %58
  %60 = load double, ptr %11, align 8, !tbaa !13
  %61 = fsub double 1.000000e+00, %60
  %62 = fmul double 0x401921FB54442D18, %61
  %63 = getelementptr inbounds %class.CartesianR2_Boundary_CzarnyGeometry, ptr %12, i32 0, i32 2
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = fdiv double %62, %64
  %66 = call double @cos(double noundef %65) #4
  %67 = fmul double %59, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret double %67
}

; 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 @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 = !{!"_ZTS35CartesianR2_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 @_ZNK35CartesianR2_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 = fneg double %19
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double 1.000000e+00)
  %22 = getelementptr inbounds i8, ptr %0, i64 24
  %23 = load double, ptr %22, align 8, !tbaa !13
  %24 = fmul double %23, 0x401921FB54442D18
  %25 = fmul double %19, %24
  %26 = load double, ptr %3, align 8, !tbaa !11
  %27 = fmul double %26, %25
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  %29 = load double, ptr %28, align 8, !tbaa !14
  %30 = fmul double %29, %27
  %31 = fsub double 2.000000e+00, %16
  %32 = fdiv double %30, %31
  %33 = tail call double @sin(double noundef %32) #3
  %34 = fmul double %21, %33
  %35 = fsub double 1.000000e+00, %16
  %36 = fmul double %35, 0x401921FB54442D18
  %37 = load double, ptr %6, align 8, !tbaa !5
  %38 = fdiv double %36, %37
  %39 = tail call double @cos(double noundef %38) #3
  %40 = fmul double %34, %39
  ret double %40
}

; 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 @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 = !{!"_ZTS35CartesianR2_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