; LLVM IR from jasonlmfong/Model-Modifier :: Model-Modifier/src/scene/surface (Surface)

; 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.glm::vec" = type { %union.anon, %union.anon.0, %union.anon.1 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }

; 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) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local { <2 x float>, float } @_ZN7Surface17ComputeFaceNormalEN3glm3vecILi3EfLNS0_9qualifierE0EEES3_S3_(ptr noundef nonnull align 8 dereferenceable(152) %0, <2 x float> %1, float %2, <2 x float> %3, float %4, <2 x float> %5, float %6) #2 align 2 {
  %8 = alloca %"struct.glm::vec", align 4
  %9 = alloca %"struct.glm::vec", align 4
  %10 = alloca { <2 x float>, float }, align 4
  %11 = alloca %"struct.glm::vec", align 4
  %12 = alloca { <2 x float>, float }, align 4
  %13 = alloca %"struct.glm::vec", align 4
  %14 = alloca { <2 x float>, float }, align 4
  %15 = alloca ptr, align 8
  %16 = alloca %"struct.glm::vec", align 4
  %17 = alloca %"struct.glm::vec", align 4
  %18 = alloca { <2 x float>, float }, align 8
  %19 = alloca %"struct.glm::vec", align 4
  %20 = alloca { <2 x float>, float }, align 8
  %21 = alloca { <2 x float>, float }, align 8
  %22 = alloca { <2 x float>, float }, align 8
  %23 = alloca { <2 x float>, float }, align 8
  %24 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 0
  store <2 x float> %1, ptr %24, align 4
  %25 = getelementptr inbounds { <2 x float>, float }, ptr %10, i32 0, i32 1
  store float %2, ptr %25, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %10, i64 12, i1 false)
  %26 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 0
  store <2 x float> %3, ptr %26, align 4
  %27 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 1
  store float %4, ptr %27, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %12, i64 12, i1 false)
  %28 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 0
  store <2 x float> %5, ptr %28, align 4
  %29 = getelementptr inbounds { <2 x float>, float }, ptr %14, i32 0, i32 1
  store float %6, ptr %29, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %14, i64 12, i1 false)
  store ptr %0, ptr %15, align 8, !tbaa !5
  %30 = load ptr, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #5
  %31 = call { <2 x float>, float } @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %11, ptr noundef nonnull align 4 dereferenceable(12) %9)
  store { <2 x float>, float } %31, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 8 %18, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #5
  %32 = call { <2 x float>, float } @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %9)
  store { <2 x float>, float } %32, ptr %20, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 8 %20, i64 12, i1 false)
  %33 = call { <2 x float>, float } @_ZN3glm5crossIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %17, ptr noundef nonnull align 4 dereferenceable(12) %19)
  store { <2 x float>, float } %33, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %21, i64 12, i1 false)
  %34 = call { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %16)
  store { <2 x float>, float } %34, ptr %22, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %22, i64 12, i1 false)
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 4 %8, i64 12, i1 false)
  %35 = load { <2 x float>, float }, ptr %23, align 8
  ret { <2 x float>, float } %35
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12)) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3glm5crossIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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 = { 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"}


; 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.glm::vec" = type { %union.anon, %union.anon.0, %union.anon.1 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { 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 uwtable
define dso_local { <2 x float>, float } @_ZN7Surface17ComputeFaceNormalEN3glm3vecILi3EfLNS0_9qualifierE0EEES3_S3_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(152) %0, <2 x float> %1, float %2, <2 x float> %3, float %4, <2 x float> %5, float %6) local_unnamed_addr #1 align 2 {
  %8 = alloca %"struct.glm::vec", align 8
  %9 = alloca %"struct.glm::vec", align 8
  %10 = alloca %"struct.glm::vec", align 8
  %11 = alloca %"struct.glm::vec", align 8
  %12 = alloca %"struct.glm::vec", align 8
  %13 = alloca %"struct.glm::vec", align 8
  store <2 x float> %1, ptr %8, align 8
  %.sroa.220.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  store float %2, ptr %.sroa.220.0..sroa_idx, align 8
  store <2 x float> %3, ptr %9, align 8
  %.sroa.218.0..sroa_idx = getelementptr inbounds i8, ptr %9, i64 8
  store float %4, ptr %.sroa.218.0..sroa_idx, align 8
  store <2 x float> %5, ptr %10, align 8
  %.sroa.216.0..sroa_idx = getelementptr inbounds i8, ptr %10, i64 8
  store float %6, ptr %.sroa.216.0..sroa_idx, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %12) #4
  %14 = call { <2 x float>, float } @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %.fca.0.extract11 = extractvalue { <2 x float>, float } %14, 0
  %.fca.1.extract12 = extractvalue { <2 x float>, float } %14, 1
  store <2 x float> %.fca.0.extract11, ptr %12, align 8
  %.sroa.214.0..sroa_idx = getelementptr inbounds i8, ptr %12, i64 8
  store float %.fca.1.extract12, ptr %.sroa.214.0..sroa_idx, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #4
  %15 = call { <2 x float>, float } @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %.fca.0.extract7 = extractvalue { <2 x float>, float } %15, 0
  %.fca.1.extract8 = extractvalue { <2 x float>, float } %15, 1
  store <2 x float> %.fca.0.extract7, ptr %13, align 8
  %.sroa.210.0..sroa_idx = getelementptr inbounds i8, ptr %13, i64 8
  store float %.fca.1.extract8, ptr %.sroa.210.0..sroa_idx, align 8
  %16 = call { <2 x float>, float } @_ZN3glm5crossIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12) %12, ptr noundef nonnull align 4 dereferenceable(12) %13)
  %.fca.0.extract3 = extractvalue { <2 x float>, float } %16, 0
  %.fca.1.extract4 = extractvalue { <2 x float>, float } %16, 1
  store <2 x float> %.fca.0.extract3, ptr %11, align 8
  %.sroa.26.0..sroa_idx = getelementptr inbounds i8, ptr %11, i64 8
  store float %.fca.1.extract4, ptr %.sroa.26.0..sroa_idx, align 8
  %17 = call { <2 x float>, float } @_ZN3glm9normalizeILi3EfLNS_9qualifierE0EEENS_3vecIXT_ET0_XT1_EEERKS4_(ptr noundef nonnull align 4 dereferenceable(12) %11)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #4
  ret { <2 x float>, float } %17
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZN3glmmiIfLNS_9qualifierE0EEENS_3vecILi3ET_XT0_EEERKS4_S6_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3

attributes #0 = { mustprogress 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 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 = { 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 #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)"}


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