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

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

@.str.3 = external hidden unnamed_addr constant [117 x i8], align 1
@.str.174 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui12IsKeyPressedE8ImGuiKeyji = external hidden unnamed_addr constant [61 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5ImGui22GetTypematicRepeatRateEiPfS0_(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5ImGui19GetKeyPressedAmountE8ImGuiKeyff(i32 noundef, float noundef, float noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5ImGui12TestKeyOwnerE8ImGuiKeyj(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui12IsKeyPressedE8ImGuiKeyji(i32 noundef %0, i32 noundef %1, i32 noundef %2) #4 {
  %4 = alloca i1, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca i8, align 1
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %14)
  store ptr %15, ptr %8, align 8, !tbaa !11
  %16 = load ptr, ptr %8, align 8, !tbaa !11
  %17 = getelementptr inbounds %struct.ImGuiKeyData, ptr %16, i32 0, i32 0
  %18 = load i8, ptr %17, align 4, !tbaa !13, !range !17, !noundef !18
  %19 = trunc i8 %18 to i1
  br i1 %19, label %21, label %20

20:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %71

21:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %22 = load ptr, ptr %8, align 8, !tbaa !11
  %23 = getelementptr inbounds %struct.ImGuiKeyData, ptr %22, i32 0, i32 1
  %24 = load float, ptr %23, align 4, !tbaa !19
  store float %24, ptr %10, align 4, !tbaa !20
  %25 = load float, ptr %10, align 4, !tbaa !20
  %26 = fcmp olt float %25, 0.000000e+00
  br i1 %26, label %27, label %28

27:                                               ; preds = %21
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %70

28:                                               ; preds = %21
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = and i32 %29, -16
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  br label %35

33:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.174, ptr noundef @.str.3, i32 noundef 8114, ptr noundef @__PRETTY_FUNCTION__._ZN5ImGui12IsKeyPressedE8ImGuiKeyji) #6
  unreachable

34:                                               ; No predecessors!
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #5
  %36 = load float, ptr %10, align 4, !tbaa !20
  %37 = fcmp oeq float %36, 0.000000e+00
  %38 = zext i1 %37 to i8
  store i8 %38, ptr %11, align 1, !tbaa !21
  %39 = load i8, ptr %11, align 1, !tbaa !21, !range !17, !noundef !18
  %40 = trunc i8 %39 to i1
  br i1 %40, label %59, label %41

41:                                               ; preds = %35
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = and i32 %42, 1
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %59

45:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %46 = load i32, ptr %7, align 4, !tbaa !9
  call void @_ZN5ImGui22GetTypematicRepeatRateEiPfS0_(i32 noundef %46, ptr noundef %12, ptr noundef %13)
  %47 = load float, ptr %10, align 4, !tbaa !20
  %48 = load float, ptr %12, align 4, !tbaa !20
  %49 = fcmp ogt float %47, %48
  br i1 %49, label %50, label %56

50:                                               ; preds = %45
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = load float, ptr %12, align 4, !tbaa !20
  %53 = load float, ptr %13, align 4, !tbaa !20
  %54 = call noundef i32 @_ZN5ImGui19GetKeyPressedAmountE8ImGuiKeyff(i32 noundef %51, float noundef %52, float noundef %53)
  %55 = icmp sgt i32 %54, 0
  br label %56

56:                                               ; preds = %50, %45
  %57 = phi i1 [ false, %45 ], [ %55, %50 ]
  %58 = zext i1 %57 to i8
  store i8 %58, ptr %11, align 1, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %59

59:                                               ; preds = %56, %41, %35
  %60 = load i8, ptr %11, align 1, !tbaa !21, !range !17, !noundef !18
  %61 = trunc i8 %60 to i1
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %69

63:                                               ; preds = %59
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !9
  %66 = call noundef zeroext i1 @_ZN5ImGui12TestKeyOwnerE8ImGuiKeyj(i32 noundef %64, i32 noundef %65)
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %69

68:                                               ; preds = %63
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %69

69:                                               ; preds = %68, %67, %62
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #5
  br label %70

70:                                               ; preds = %69, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %71

71:                                               ; preds = %70, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %72 = load i1, ptr %4, align 1
  ret i1 %72
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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"="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 #3 = { 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 #4 = { 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 }
attributes #6 = { noreturn 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 = !{!"_ZTS8ImGuiKey", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTS12ImGuiKeyData", !15, i64 0, !16, i64 4, !16, i64 8, !16, i64 12}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!14, !16, i64 4}
!20 = !{!16, !16, i64 0}
!21 = !{!15, !15, 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"

@.str.3 = external hidden unnamed_addr constant [117 x i8], align 1
@.str.174 = external hidden unnamed_addr constant [56 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui12IsKeyPressedE8ImGuiKeyji = external hidden unnamed_addr constant [61 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5ImGui22GetTypematicRepeatRateEiPfS0_(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5ImGui19GetKeyPressedAmountE8ImGuiKeyff(i32 noundef, float noundef, float noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5ImGui12TestKeyOwnerE8ImGuiKeyj(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui12IsKeyPressedE8ImGuiKeyji(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #4 {
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = tail call noundef ptr @_ZN5ImGui10GetKeyDataE8ImGuiKey(i32 noundef %0)
  %7 = load i8, ptr %6, align 4, !tbaa !5, !range !11, !noundef !12
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %9, label %29

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %6, i64 4
  %11 = load float, ptr %10, align 4, !tbaa !13
  %12 = fcmp olt float %11, 0.000000e+00
  br i1 %12, label %29, label %13

13:                                               ; preds = %9
  %14 = icmp ult i32 %2, 16
  br i1 %14, label %16, label %15

15:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.174, ptr noundef nonnull @.str.3, i32 noundef 8114, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5ImGui12IsKeyPressedE8ImGuiKeyji) #5
  unreachable

16:                                               ; preds = %13
  %17 = fcmp oeq float %11, 0.000000e+00
  %18 = and i32 %2, 1
  %.not = icmp eq i32 %18, 0
  %or.cond = or i1 %.not, %17
  br i1 %or.cond, label %26, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @_ZN5ImGui22GetTypematicRepeatRateEiPfS0_(i32 noundef %2, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %20 = load float, ptr %4, align 4, !tbaa !14
  %21 = fcmp ogt float %11, %20
  br i1 %21, label %22, label %.thread

.thread:                                          ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %29

22:                                               ; preds = %19
  %23 = load float, ptr %5, align 4, !tbaa !14
  %24 = call noundef i32 @_ZN5ImGui19GetKeyPressedAmountE8ImGuiKeyff(i32 noundef %0, float noundef %20, float noundef %23)
  %25 = icmp sgt i32 %24, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br i1 %25, label %27, label %29

26:                                               ; preds = %16
  br i1 %17, label %27, label %29

27:                                               ; preds = %22, %26
  %28 = call noundef zeroext i1 @_ZN5ImGui12TestKeyOwnerE8ImGuiKeyj(i32 noundef %0, i32 noundef %1)
  br label %29

29:                                               ; preds = %.thread, %22, %9, %27, %26, %3
  %.2 = phi i1 [ false, %3 ], [ false, %9 ], [ false, %26 ], [ %28, %27 ], [ false, %22 ], [ false, %.thread ]
  ret i1 %.2
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn nounwind "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"="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 #3 = { 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 #4 = { 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 = { noreturn nounwind }
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 0}
!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}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!6, !10, i64 4}
!14 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass