; LLVM IR from tyoma/agge :: src/agge (stroke_features)

; 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 }
%"class.agge::caps::triangle" = type <{ %"struct.agge::stroke::cap", float, [4 x i8] }>
%"struct.agge::stroke::cap" = type { ptr }

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef, float noundef) #2

; 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 @_ZNK4agge4caps8triangle4calcERNS_10pod_vectorINS_5pointIfEEEEfRKS4_fS8_(ptr noundef nonnull align 8 dereferenceable(12) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2, ptr noundef nonnull align 4 dereferenceable(8) %3, float noundef %4, ptr noundef nonnull align 4 dereferenceable(8) %5) unnamed_addr #3 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca float, align 4
  %12 = alloca ptr, align 8
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca %"struct.agge::point", align 4
  %16 = alloca %"struct.agge::point", align 4
  %17 = alloca %"struct.agge::point", align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store float %4, ptr %11, align 4, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !5
  %18 = load ptr, ptr %7, align 8
  %19 = load float, ptr %9, align 4, !tbaa !9
  %20 = load float, ptr %11, align 4, !tbaa !9
  %21 = fdiv float %19, %20
  store float %21, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %22 = load ptr, ptr %12, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.agge::point", ptr %22, i32 0, i32 0
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.agge::point", ptr %25, i32 0, i32 0
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = fsub float %24, %27
  %29 = load float, ptr %11, align 4, !tbaa !9
  %30 = fmul float %28, %29
  store float %30, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %"struct.agge::point", ptr %31, i32 0, i32 1
  %33 = load float, ptr %32, align 4, !tbaa !13
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.agge::point", ptr %34, i32 0, i32 1
  %36 = load float, ptr %35, align 4, !tbaa !13
  %37 = fsub float %33, %36
  %38 = load float, ptr %11, align 4, !tbaa !9
  %39 = fmul float %37, %38
  store float %39, ptr %14, align 4, !tbaa !9
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.agge::point", ptr %41, i32 0, i32 0
  %43 = load float, ptr %42, align 4, !tbaa !11
  %44 = load float, ptr %14, align 4, !tbaa !9
  %45 = fsub float %43, %44
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.agge::point", ptr %46, i32 0, i32 1
  %48 = load float, ptr %47, align 4, !tbaa !13
  %49 = load float, ptr %13, align 4, !tbaa !9
  %50 = fadd float %48, %49
  %51 = call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %45, float noundef %50)
  store <2 x float> %51, ptr %15, align 4
  %52 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %40, ptr noundef nonnull align 4 dereferenceable(8) %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.agge::point", ptr %54, i32 0, i32 0
  %56 = load float, ptr %55, align 4, !tbaa !11
  %57 = load float, ptr %13, align 4, !tbaa !9
  %58 = getelementptr inbounds %"class.agge::caps::triangle", ptr %18, i32 0, i32 1
  %59 = load float, ptr %58, align 8, !tbaa !14
  %60 = fneg float %57
  %61 = call float @llvm.fmuladd.f32(float %60, float %59, float %56)
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %"struct.agge::point", ptr %62, i32 0, i32 1
  %64 = load float, ptr %63, align 4, !tbaa !13
  %65 = load float, ptr %14, align 4, !tbaa !9
  %66 = getelementptr inbounds %"class.agge::caps::triangle", ptr %18, i32 0, i32 1
  %67 = load float, ptr %66, align 8, !tbaa !14
  %68 = fneg float %65
  %69 = call float @llvm.fmuladd.f32(float %68, float %67, float %64)
  %70 = call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %61, float noundef %69)
  store <2 x float> %70, ptr %16, align 4
  %71 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 4 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %73 = load ptr, ptr %10, align 8, !tbaa !5
  %74 = getelementptr inbounds %"struct.agge::point", ptr %73, i32 0, i32 0
  %75 = load float, ptr %74, align 4, !tbaa !11
  %76 = load float, ptr %14, align 4, !tbaa !9
  %77 = fadd float %75, %76
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = getelementptr inbounds %"struct.agge::point", ptr %78, i32 0, i32 1
  %80 = load float, ptr %79, align 4, !tbaa !13
  %81 = load float, ptr %13, align 4, !tbaa !9
  %82 = fsub float %80, %81
  %83 = call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %77, float noundef %82)
  store <2 x float> %83, ptr %17, align 4
  %84 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %72, ptr noundef nonnull align 4 dereferenceable(8) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 0}
!12 = !{!"_ZTSN4agge5pointIfEE", !10, i64 0, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = !{!15, !10, i64 8}
!15 = !{!"_ZTSN4agge4caps8triangleE", !16, i64 0, !10, i64 8}
!16 = !{!"_ZTSN4agge6stroke3capE"}


; 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::point" = 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef, float noundef) local_unnamed_addr #2

; 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 uwtable
define dso_local void @_ZNK4agge4caps8triangle4calcERNS_10pod_vectorINS_5pointIfEEEEfRKS4_fS8_(ptr nocapture noundef nonnull readonly align 8 dereferenceable(12) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, float noundef %2, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %3, float noundef %4, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %5) unnamed_addr #3 align 2 {
  %7 = alloca %"struct.agge::point", align 8
  %8 = alloca %"struct.agge::point", align 8
  %9 = alloca %"struct.agge::point", align 8
  %10 = fdiv float %2, %4
  %11 = load float, ptr %5, align 4, !tbaa !5
  %12 = load float, ptr %3, align 4, !tbaa !5
  %13 = fsub float %11, %12
  %14 = fmul float %10, %13
  %15 = getelementptr inbounds i8, ptr %5, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !10
  %17 = getelementptr inbounds i8, ptr %3, i64 4
  %18 = load float, ptr %17, align 4, !tbaa !10
  %19 = fsub float %16, %18
  %20 = fmul float %10, %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %21 = fsub float %12, %20
  %22 = fadd float %18, %14
  %23 = tail call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %21, float noundef %22)
  store <2 x float> %23, ptr %7, align 8
  %24 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %25 = load float, ptr %3, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load float, ptr %26, align 8, !tbaa !11
  %28 = fneg float %14
  %29 = call float @llvm.fmuladd.f32(float %28, float %27, float %25)
  %30 = load float, ptr %17, align 4, !tbaa !10
  %31 = fneg float %20
  %32 = call float @llvm.fmuladd.f32(float %31, float %27, float %30)
  %33 = call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %29, float noundef %32)
  store <2 x float> %33, ptr %8, align 8
  %34 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %35 = load float, ptr %3, align 4, !tbaa !5
  %36 = fadd float %20, %35
  %37 = load float, ptr %17, align 4, !tbaa !10
  %38 = fsub float %37, %14
  %39 = call <2 x float> @_ZN4agge12create_pointIfEENS_5pointIT_EES2_S2_(float noundef %36, float noundef %38)
  store <2 x float> %39, ptr %9, align 8
  %40 = call noundef ptr @_ZN4agge10pod_vectorINS_5pointIfEEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(8) %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 0}
!6 = !{!"_ZTSN4agge5pointIfEE", !7, i64 0, !7, i64 4}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 4}
!11 = !{!12, !7, i64 8}
!12 = !{!"_ZTSN4agge4caps8triangleE", !13, i64 0, !7, i64 8}
!13 = !{!"_ZTSN4agge6stroke3capE"}


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