; 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 }
%struct.ImGuiKeyData = type { i8, float, float, float }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN5ImGui17GetKeyMagnitude2dE8ImGuiKeyS0_S0_S0_(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca %struct.ImVec2, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !5
  %10 = load i32, ptr %7, align 4, !tbaa !5
  %11 = call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %10)
  %12 = getelementptr inbounds %struct.ImGuiKeyData, ptr %11, i32 0, i32 3
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %14)
  %16 = getelementptr inbounds %struct.ImGuiKeyData, ptr %15, i32 0, i32 3
  %17 = load float, ptr %16, align 4, !tbaa !9
  %18 = fsub float %13, %17
  %19 = load i32, ptr %9, align 4, !tbaa !5
  %20 = call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %19)
  %21 = getelementptr inbounds %struct.ImGuiKeyData, ptr %20, i32 0, i32 3
  %22 = load float, ptr %21, align 4, !tbaa !9
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %23)
  %25 = getelementptr inbounds %struct.ImGuiKeyData, ptr %24, i32 0, i32 3
  %26 = load float, ptr %25, align 4, !tbaa !9
  %27 = fsub float %22, %26
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %18, float noundef %27)
  %28 = load <2 x float>, ptr %5, align 4
  ret <2 x float> %28
}

attributes #0 = { mustprogress nounwind 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 #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 = { 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 = !{!"_ZTS8ImGuiKey", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 12}
!10 = !{!"_ZTS12ImGuiKeyData", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"float", !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.ImVec2 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_ZN5ImGui17GetKeyMagnitude2dE8ImGuiKeyS0_S0_S0_(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = alloca %struct.ImVec2, align 8
  %6 = tail call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %1)
  %7 = getelementptr inbounds i8, ptr %6, i64 12
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = tail call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %0)
  %10 = getelementptr inbounds i8, ptr %9, i64 12
  %11 = load float, ptr %10, align 4, !tbaa !5
  %12 = fsub float %8, %11
  %13 = tail call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %3)
  %14 = getelementptr inbounds i8, ptr %13, i64 12
  %15 = load float, ptr %14, align 4, !tbaa !5
  %16 = tail call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %2)
  %17 = getelementptr inbounds i8, ptr %16, i64 12
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = fsub float %15, %18
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %12, float noundef %19)
  %20 = load <2 x float>, ptr %5, align 8
  ret <2 x float> %20
}

attributes #0 = { mustprogress nounwind 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 #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 = { 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, !10, i64 12}
!6 = !{!"_ZTS12ImGuiKeyData", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"float", !8, i64 0}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InstCombinePass,SROAPass,TailCallElimPass