; LLVM IR from wgtdkp/apollonia :: src/body.ll (ZN9apollonia4Body9IntegrateERKNS_4Vec2Ef)

; 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.apollonia::Vec2" = type { float, float }
%"struct.apollonia::Mat22" = type { %"struct.std::array" }
%"struct.std::array" = type { [2 x %"struct.apollonia::Vec2"] }
%"class.apollonia::Body" = type { ptr, float, float, float, float, %"struct.apollonia::Vec2", %"struct.apollonia::Vec2", %"struct.apollonia::Mat22", %"struct.apollonia::Vec2", float, %"struct.apollonia::Vec2", float, float, float }

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #0

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9apollonia4Body9IntegrateERKNS_4Vec2Ef(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2) #3 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca %"struct.apollonia::Vec2", align 4
  %8 = alloca %"struct.apollonia::Vec2", align 4
  %9 = alloca %"struct.apollonia::Vec2", align 4
  %10 = alloca %"struct.apollonia::Vec2", align 4
  %11 = alloca %"struct.apollonia::Mat22", align 4
  %12 = alloca %"struct.apollonia::Mat22", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8
  %14 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 1
  %15 = load float, ptr %14, align 8, !tbaa !11
  %16 = fcmp oeq float %15, 0x47EFFFFFE0000000
  br i1 %16, label %17, label %18

17:                                               ; preds = %3
  br label %54

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %20 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 10
  %21 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 2
  %22 = load float, ptr %21, align 4, !tbaa !16
  %23 = call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %20, float noundef %22)
  store <2 x float> %23, ptr %9, align 4
  %24 = call <2 x float> @_ZN9apolloniaplERKNS_4Vec2ES2_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %9)
  store <2 x float> %24, ptr %8, align 4
  %25 = load float, ptr %6, align 4, !tbaa !9
  %26 = call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %8, float noundef %25)
  store <2 x float> %26, ptr %7, align 4
  %27 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 8
  call void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %28 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 11
  %29 = load float, ptr %28, align 4, !tbaa !17
  %30 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 4
  %31 = load float, ptr %30, align 4, !tbaa !18
  %32 = fmul float %29, %31
  %33 = load float, ptr %6, align 4, !tbaa !9
  %34 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 9
  %35 = load float, ptr %34, align 8, !tbaa !19
  %36 = call float @llvm.fmuladd.f32(float %32, float %33, float %35)
  store float %36, ptr %34, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %37 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 8
  %38 = load float, ptr %6, align 4, !tbaa !9
  %39 = call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %37, float noundef %38)
  store <2 x float> %39, ptr %10, align 4
  %40 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 6
  call void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %40, ptr noundef nonnull align 4 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %41 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 9
  %42 = load float, ptr %41, align 8, !tbaa !19
  %43 = load float, ptr %6, align 4, !tbaa !9
  %44 = fmul float %42, %43
  call void @_ZN9apollonia5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %12, float noundef %44)
  %45 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 7
  %46 = call { <2 x float>, <2 x float> } @_ZN9apolloniamlERKNS_5Mat22ES2_(ptr noundef nonnull align 4 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(16) %45)
  %47 = getelementptr inbounds %"struct.apollonia::Mat22", ptr %11, i32 0, i32 0
  %48 = getelementptr inbounds %"struct.std::array", ptr %47, i32 0, i32 0
  %49 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %48, i32 0, i32 0
  %50 = extractvalue { <2 x float>, <2 x float> } %46, 0
  store <2 x float> %50, ptr %49, align 4
  %51 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %48, i32 0, i32 1
  %52 = extractvalue { <2 x float>, <2 x float> } %46, 1
  store <2 x float> %52, ptr %51, align 4
  %53 = getelementptr inbounds %"class.apollonia::Body", ptr %13, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %53, ptr align 4 %11, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %54

54:                                               ; preds = %18, %17
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, <2 x float> } @_ZN9apolloniamlERKNS_5Mat22ES2_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9apollonia5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16), float noundef) unnamed_addr #5 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

attributes #0 = { inlinehint 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { inlinehint mustprogress 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 #5 = { mustprogress 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTSN9apollonia4BodyE", !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !13, i64 32, !14, i64 40, !13, i64 56, !10, i64 64, !13, i64 68, !10, i64 76, !10, i64 80, !10, i64 84}
!13 = !{!"_ZTSN9apollonia4Vec2E", !10, i64 0, !10, i64 4}
!14 = !{!"_ZTSN9apollonia5Mat22E", !15, i64 0}
!15 = !{!"_ZTSSt5arrayIN9apollonia4Vec2ELm2EE", !7, i64 0}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 76}
!18 = !{!12, !10, i64 20}
!19 = !{!12, !10, i64 64}
!20 = !{i64 0, i64 16, !21}
!21 = !{!7, !7, i64 0}


; 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.apollonia::Vec2" = type { float, float }
%"struct.apollonia::Mat22" = type { %"struct.std::array" }
%"struct.std::array" = type { [2 x %"struct.apollonia::Vec2"] }

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #0

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9apollonia4Body9IntegrateERKNS_4Vec2Ef(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2) local_unnamed_addr #3 align 2 {
  %4 = alloca %"struct.apollonia::Vec2", align 8
  %5 = alloca %"struct.apollonia::Vec2", align 8
  %6 = alloca %"struct.apollonia::Vec2", align 8
  %7 = alloca %"struct.apollonia::Vec2", align 8
  %8 = alloca %"struct.apollonia::Mat22", align 4
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load float, ptr %9, align 8, !tbaa !5
  %11 = fcmp oeq float %10, 0x47EFFFFFE0000000
  br i1 %11, label %36, label %12

12:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %13 = getelementptr inbounds i8, ptr %0, i64 68
  %14 = getelementptr inbounds i8, ptr %0, i64 12
  %15 = load float, ptr %14, align 4, !tbaa !13
  %16 = tail call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %13, float noundef %15)
  store <2 x float> %16, ptr %6, align 8
  %17 = call <2 x float> @_ZN9apolloniaplERKNS_4Vec2ES2_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %6)
  store <2 x float> %17, ptr %5, align 8
  %18 = call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %2)
  store <2 x float> %18, ptr %4, align 8
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  call void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %20 = getelementptr inbounds i8, ptr %0, i64 76
  %21 = load float, ptr %20, align 4, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  %23 = load float, ptr %22, align 4, !tbaa !15
  %24 = fmul float %21, %23
  %25 = getelementptr inbounds i8, ptr %0, i64 64
  %26 = load float, ptr %25, align 8, !tbaa !16
  %27 = call float @llvm.fmuladd.f32(float %24, float %2, float %26)
  store float %27, ptr %25, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %28 = call <2 x float> @_ZN9apolloniamlERKNS_4Vec2Ef(ptr noundef nonnull align 4 dereferenceable(8) %19, float noundef %2)
  store <2 x float> %28, ptr %7, align 8
  %29 = getelementptr inbounds i8, ptr %0, i64 32
  call void @_ZN9apolloniapLERNS_4Vec2ERKS0_(ptr noundef nonnull align 4 dereferenceable(8) %29, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  %30 = load float, ptr %25, align 8, !tbaa !16
  %31 = fmul float %30, %2
  call void @_ZN9apollonia5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16) %8, float noundef %31)
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  %33 = call { <2 x float>, <2 x float> } @_ZN9apolloniamlERKNS_5Mat22ES2_(ptr noundef nonnull align 4 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(16) %32)
  %34 = extractvalue { <2 x float>, <2 x float> } %33, 0
  %35 = extractvalue { <2 x float>, <2 x float> } %33, 1
  store <2 x float> %34, ptr %32, align 8
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 48
  store <2 x float> %35, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  br label %36

36:                                               ; preds = %3, %12
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { <2 x float>, <2 x float> } @_ZN9apolloniamlERKNS_5Mat22ES2_(ptr noundef nonnull align 4 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9apollonia5Mat22C2Ef(ptr noundef nonnull align 4 dereferenceable(16), float noundef) unnamed_addr #5 align 2

attributes #0 = { inlinehint 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { inlinehint mustprogress 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 #5 = { mustprogress 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 #6 = { 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, !7, i64 8}
!6 = !{!"_ZTSN9apollonia4BodyE", !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !11, i64 40, !10, i64 56, !7, i64 64, !10, i64 68, !7, i64 76, !7, i64 80, !7, i64 84}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN9apollonia4Vec2E", !7, i64 0, !7, i64 4}
!11 = !{!"_ZTSN9apollonia5Mat22E", !12, i64 0}
!12 = !{!"_ZTSSt5arrayIN9apollonia4Vec2ELm2EE", !8, i64 0}
!13 = !{!6, !7, i64 12}
!14 = !{!6, !7, i64 76}
!15 = !{!6, !7, i64 20}
!16 = !{!6, !7, i64 64}
!17 = !{!8, !8, i64 0}


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