; LLVM IR from tyoma/agge :: src/agge/dash.ll (ZNK4agge4dash19interpolate_currentEPfS1_)

; 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.agge::point" = type { float, float }
%"struct.agge::agge_vector" = type { float, float }
%"class.agge::dash" = type { %"class.agge::vertex_sequence", ptr, ptr, float, float, float, %"struct.agge::point", i32, %"class.agge::pod_vector.0" }
%"class.agge::vertex_sequence" = type { %"class.agge::pod_vector" }
%"class.agge::pod_vector" = type { ptr, ptr, ptr }
%"class.agge::pod_vector.0" = type { ptr, ptr, ptr }
%"struct.agge::vertex" = type { %"struct.agge::point", float }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4agge4dash19interpolate_currentEPfS1_(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, ptr noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.agge::point", align 4
  %9 = alloca %"struct.agge::agge_vector", align 4
  %10 = alloca %"struct.agge::agge_vector", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %12 = getelementptr inbounds %"class.agge::dash", ptr %11, i32 0, i32 1
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %"struct.agge::vertex", ptr %13, i64 -1
  store ptr %14, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %15 = getelementptr inbounds %"class.agge::dash", ptr %11, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %"struct.agge::vertex", ptr %16, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %18 = getelementptr inbounds %"class.agge::dash", ptr %11, i32 0, i32 3
  %19 = load float, ptr %18, align 8, !tbaa !17
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.agge::vertex", ptr %20, i32 0, i32 1
  %22 = load float, ptr %21, align 4, !tbaa !18
  %23 = fdiv float %19, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %24 = getelementptr inbounds %"class.agge::dash", ptr %11, i32 0, i32 1
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds %"struct.agge::vertex", ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %"struct.agge::vertex", ptr %27, i32 0, i32 0
  %29 = call <2 x float> @_ZN4aggemiIfEENS_11agge_vectorIT_EERKNS_5pointIS2_EES7_(ptr noundef nonnull align 4 dereferenceable(8) %26, ptr noundef nonnull align 4 dereferenceable(8) %28)
  store <2 x float> %29, ptr %10, align 4
  %30 = call <2 x float> @_ZN4aggemlIfEENS_11agge_vectorIT_EES2_RKS3_(float noundef %23, ptr noundef nonnull align 4 dereferenceable(8) %10)
  store <2 x float> %30, ptr %9, align 4
  %31 = call <2 x float> @_ZN4aggeplIfEENS_5pointIT_EERKS3_RKNS_11agge_vectorIS2_EE(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %31, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %32 = getelementptr inbounds %"struct.agge::point", ptr %8, i32 0, i32 0
  %33 = load float, ptr %32, align 4, !tbaa !20
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  store float %33, ptr %34, align 4, !tbaa !21
  %35 = getelementptr inbounds %"struct.agge::point", ptr %8, i32 0, i32 1
  %36 = load float, ptr %35, align 4, !tbaa !22
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  store float %36, ptr %37, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggeplIfEENS_5pointIT_EERKS3_RKNS_11agge_vectorIS2_EE(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggemlIfEENS_11agge_vectorIT_EES2_RKS3_(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggemiIfEENS_11agge_vectorIT_EERKNS_5pointIS2_EES7_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="64" "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, !6, i64 24}
!10 = !{!"_ZTSN4agge4dashE", !11, i64 0, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !14, i64 52, !15, i64 60, !16, i64 64}
!11 = !{!"_ZTSN4agge15vertex_sequenceE", !12, i64 0}
!12 = !{!"_ZTSN4agge10pod_vectorINS_6vertexEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!"float", !7, i64 0}
!14 = !{!"_ZTSN4agge5pointIfEE", !13, i64 0, !13, i64 4}
!15 = !{!"_ZTSN4agge4dash5stateE", !7, i64 0}
!16 = !{!"_ZTSN4agge10pod_vectorINS_4dash8dash_gapEEE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!10, !13, i64 40}
!18 = !{!19, !13, i64 8}
!19 = !{!"_ZTSN4agge6vertexE", !14, i64 0, !13, i64 8}
!20 = !{!14, !13, i64 0}
!21 = !{!13, !13, i64 0}
!22 = !{!14, !13, i64 4}


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

%"struct.agge::agge_vector" = type { float, float }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK4agge4dash19interpolate_currentEPfS1_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(88) %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"struct.agge::agge_vector", align 8
  %5 = alloca %"struct.agge::agge_vector", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 -12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load float, ptr %9, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %7, i64 -4
  %12 = load float, ptr %11, align 4, !tbaa !17
  %13 = fdiv float %10, %12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %14 = tail call <2 x float> @_ZN4aggemiIfEENS_11agge_vectorIT_EERKNS_5pointIS2_EES7_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  store <2 x float> %14, ptr %5, align 8
  %15 = call <2 x float> @_ZN4aggemlIfEENS_11agge_vectorIT_EES2_RKS3_(float noundef %13, ptr noundef nonnull align 4 dereferenceable(8) %5)
  store <2 x float> %15, ptr %4, align 8
  %16 = call <2 x float> @_ZN4aggeplIfEENS_5pointIT_EERKS3_RKNS_11agge_vectorIS2_EE(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  %.sroa.0.0.vec.extract = extractelement <2 x float> %16, i64 0
  store float %.sroa.0.0.vec.extract, ptr %1, align 4, !tbaa !19
  %.sroa.0.4.vec.extract = extractelement <2 x float> %16, i64 1
  store float %.sroa.0.4.vec.extract, ptr %2, align 4, !tbaa !19
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggeplIfEENS_5pointIT_EERKS3_RKNS_11agge_vectorIS2_EE(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggemlIfEENS_11agge_vectorIT_EES2_RKS3_(float noundef, ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4aggemiIfEENS_11agge_vectorIT_EERKNS_5pointIS2_EES7_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="64" "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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="64" "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, !9, i64 24}
!6 = !{!"_ZTSN4agge4dashE", !7, i64 0, !9, i64 24, !9, i64 32, !12, i64 40, !12, i64 44, !12, i64 48, !13, i64 52, !14, i64 60, !15, i64 64}
!7 = !{!"_ZTSN4agge15vertex_sequenceE", !8, i64 0}
!8 = !{!"_ZTSN4agge10pod_vectorINS_6vertexEEE", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"float", !10, i64 0}
!13 = !{!"_ZTSN4agge5pointIfEE", !12, i64 0, !12, i64 4}
!14 = !{!"_ZTSN4agge4dash5stateE", !10, i64 0}
!15 = !{!"_ZTSN4agge10pod_vectorINS_4dash8dash_gapEEE", !9, i64 0, !9, i64 8, !9, i64 16}
!16 = !{!6, !12, i64 40}
!17 = !{!18, !12, i64 8}
!18 = !{!"_ZTSN4agge6vertexE", !13, i64 0, !12, i64 8}
!19 = !{!12, !12, i64 0}


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