; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui (imgui)

; 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.ImVec2 = type { float, 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: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) #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 @_Z27ImTriangleBarycentricCoordsRK6ImVec2S1_S1_S1_RfS2_S2_(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6) #3 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %struct.ImVec2, align 4
  %16 = alloca %struct.ImVec2, align 4
  %17 = alloca %struct.ImVec2, align 4
  %18 = alloca float, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %19 = load ptr, ptr %9, align 8, !tbaa !5
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %19, ptr noundef nonnull align 4 dereferenceable(8) %20)
  store <2 x float> %21, ptr %15, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(8) %23)
  store <2 x float> %24, ptr %16, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %25, ptr noundef nonnull align 4 dereferenceable(8) %26)
  store <2 x float> %27, ptr %17, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %28 = getelementptr inbounds %struct.ImVec2, ptr %15, i32 0, i32 0
  %29 = load float, ptr %28, align 4, !tbaa !9
  %30 = getelementptr inbounds %struct.ImVec2, ptr %16, i32 0, i32 1
  %31 = load float, ptr %30, align 4, !tbaa !12
  %32 = getelementptr inbounds %struct.ImVec2, ptr %16, i32 0, i32 0
  %33 = load float, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds %struct.ImVec2, ptr %15, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !12
  %36 = fmul float %33, %35
  %37 = fneg float %36
  %38 = call float @llvm.fmuladd.f32(float %29, float %31, float %37)
  store float %38, ptr %18, align 4, !tbaa !13
  %39 = getelementptr inbounds %struct.ImVec2, ptr %17, i32 0, i32 0
  %40 = load float, ptr %39, align 4, !tbaa !9
  %41 = getelementptr inbounds %struct.ImVec2, ptr %16, i32 0, i32 1
  %42 = load float, ptr %41, align 4, !tbaa !12
  %43 = getelementptr inbounds %struct.ImVec2, ptr %16, i32 0, i32 0
  %44 = load float, ptr %43, align 4, !tbaa !9
  %45 = getelementptr inbounds %struct.ImVec2, ptr %17, i32 0, i32 1
  %46 = load float, ptr %45, align 4, !tbaa !12
  %47 = fmul float %44, %46
  %48 = fneg float %47
  %49 = call float @llvm.fmuladd.f32(float %40, float %42, float %48)
  %50 = load float, ptr %18, align 4, !tbaa !13
  %51 = fdiv float %49, %50
  %52 = load ptr, ptr %13, align 8, !tbaa !5
  store float %51, ptr %52, align 4, !tbaa !13
  %53 = getelementptr inbounds %struct.ImVec2, ptr %15, i32 0, i32 0
  %54 = load float, ptr %53, align 4, !tbaa !9
  %55 = getelementptr inbounds %struct.ImVec2, ptr %17, i32 0, i32 1
  %56 = load float, ptr %55, align 4, !tbaa !12
  %57 = getelementptr inbounds %struct.ImVec2, ptr %17, i32 0, i32 0
  %58 = load float, ptr %57, align 4, !tbaa !9
  %59 = getelementptr inbounds %struct.ImVec2, ptr %15, i32 0, i32 1
  %60 = load float, ptr %59, align 4, !tbaa !12
  %61 = fmul float %58, %60
  %62 = fneg float %61
  %63 = call float @llvm.fmuladd.f32(float %54, float %56, float %62)
  %64 = load float, ptr %18, align 4, !tbaa !13
  %65 = fdiv float %63, %64
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  store float %65, ptr %66, align 4, !tbaa !13
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = load float, ptr %67, align 4, !tbaa !13
  %69 = fsub float 1.000000e+00, %68
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = load float, ptr %70, align 4, !tbaa !13
  %72 = fsub float %69, %71
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  store float %72, ptr %73, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !11, i64 0}
!10 = !{!"_ZTS6ImVec2", !11, i64 0, !11, i64 4}
!11 = !{!"float", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!11, !11, 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"

; Function Attrs: inlinehint mustprogress uwtable
declare hidden <2 x float> @_ZmiRK6ImVec2S1_(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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z27ImTriangleBarycentricCoordsRK6ImVec2S1_S1_S1_RfS2_S2_(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4, ptr nocapture noundef nonnull align 4 dereferenceable(4) %5, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %6) local_unnamed_addr #2 {
  %8 = tail call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %1, ptr noundef nonnull align 4 dereferenceable(8) %0)
  %9 = tail call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(8) %0)
  %10 = tail call <2 x float> @_ZmiRK6ImVec2S1_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 4 dereferenceable(8) %0)
  %.sroa.011.0.vec.extract = extractelement <2 x float> %8, i64 0
  %.sroa.06.4.vec.extract = extractelement <2 x float> %9, i64 1
  %.sroa.06.0.vec.extract = extractelement <2 x float> %9, i64 0
  %.sroa.011.4.vec.extract = extractelement <2 x float> %8, i64 1
  %11 = fneg float %.sroa.06.0.vec.extract
  %12 = fmul float %.sroa.011.4.vec.extract, %11
  %13 = tail call float @llvm.fmuladd.f32(float %.sroa.011.0.vec.extract, float %.sroa.06.4.vec.extract, float %12)
  %.sroa.0.0.vec.extract = extractelement <2 x float> %10, i64 0
  %.sroa.0.4.vec.extract = extractelement <2 x float> %10, i64 1
  %14 = fmul float %.sroa.0.4.vec.extract, %11
  %15 = tail call float @llvm.fmuladd.f32(float %.sroa.0.0.vec.extract, float %.sroa.06.4.vec.extract, float %14)
  %16 = fdiv float %15, %13
  store float %16, ptr %5, align 4, !tbaa !5
  %17 = fneg float %.sroa.0.0.vec.extract
  %18 = fmul float %.sroa.011.4.vec.extract, %17
  %19 = tail call float @llvm.fmuladd.f32(float %.sroa.011.0.vec.extract, float %.sroa.0.4.vec.extract, float %18)
  %20 = fdiv float %19, %13
  store float %20, ptr %6, align 4, !tbaa !5
  %21 = load float, ptr %5, align 4, !tbaa !5
  %22 = fsub float 1.000000e+00, %21
  %23 = fsub float %22, %20
  store float %23, ptr %4, align 4, !tbaa !5
  ret void
}

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 speculatable willreturn memory(none) }
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" }

!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"}


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