; LLVM IR from drohmer/cgp :: library/cgp/12_shape/implicit/marching_cube (marching_cube)

; 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"

%"struct.cgp::numarray_stack.18" = type { float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN3cgp13fill_positionERNS_14numarray_stackIfLi3EEEfffRKS1_S4_(ptr noundef nonnull align 4 dereferenceable(12) %0, float noundef %1, float noundef %2, float noundef %3, ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %5) #0 {
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store float %1, ptr %8, align 4, !tbaa !9
  store float %2, ptr %9, align 4, !tbaa !9
  store float %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %13 = load ptr, ptr %11, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %13, i32 0, i32 0
  %15 = load float, ptr %14, align 4, !tbaa !11
  %16 = load float, ptr %8, align 4, !tbaa !9
  %17 = load ptr, ptr %12, align 8, !tbaa !5
  %18 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %17, i32 0, i32 0
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = call float @llvm.fmuladd.f32(float %16, float %19, float %15)
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %21, i32 0, i32 0
  store float %20, ptr %22, align 4, !tbaa !11
  %23 = load ptr, ptr %11, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %23, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !13
  %26 = load float, ptr %9, align 4, !tbaa !9
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %27, i32 0, i32 1
  %29 = load float, ptr %28, align 4, !tbaa !13
  %30 = call float @llvm.fmuladd.f32(float %26, float %29, float %25)
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %31, i32 0, i32 1
  store float %30, ptr %32, align 4, !tbaa !13
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %33, i32 0, i32 2
  %35 = load float, ptr %34, align 4, !tbaa !14
  %36 = load float, ptr %10, align 4, !tbaa !9
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %37, i32 0, i32 2
  %39 = load float, ptr %38, align 4, !tbaa !14
  %40 = call float @llvm.fmuladd.f32(float %36, float %39, float %35)
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.cgp::numarray_stack.18", ptr %41, i32 0, i32 2
  store float %40, ptr %42, align 4, !tbaa !14
  ret void
}

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

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

!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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN3cgp14numarray_stackIfLi3EEE", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, i64 8}


; 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 norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN3cgp13fill_positionERNS_14numarray_stackIfLi3EEEfffRKS1_S4_(ptr nocapture noundef nonnull writeonly align 4 dereferenceable(12) %0, float noundef %1, float noundef %2, float noundef %3, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %4, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %5) local_unnamed_addr #0 {
  %7 = load <2 x float>, ptr %4, align 4, !tbaa !5
  %8 = load <2 x float>, ptr %5, align 4, !tbaa !5
  %9 = insertelement <2 x float> poison, float %1, i64 0
  %10 = insertelement <2 x float> %9, float %2, i64 1
  %11 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %10, <2 x float> %8, <2 x float> %7)
  store <2 x float> %11, ptr %0, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %4, i64 8
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %5, i64 8
  %15 = load float, ptr %14, align 4, !tbaa !9
  %16 = tail call float @llvm.fmuladd.f32(float %3, float %15, float %13)
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  store float %16, ptr %17, align 4, !tbaa !9
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x float> @llvm.fmuladd.v2f32(<2 x float>, <2 x float>, <2 x float>) #2

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTSN3cgp14numarray_stackIfLi3EEE", !6, i64 0, !6, i64 4, !6, i64 8}


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