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

; 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.ImGuiContext = type { i8, i8, %struct.ImGuiIO, %struct.ImGuiStyle, ptr, float, float, %struct.ImDrawListSharedData, double, i32, i32, i32, i8, i8, i8, i8, i8, ptr, %struct.ImVector.1, %struct.ImVector.1, i32, i32, %struct.ImVector.2, %struct.ImVector.2, %struct.ImVector.2, %struct.ImVector.3, %struct.ImGuiStorage, i32, %struct.ImVec2, ptr, ptr, ptr, ptr, ptr, %struct.ImVec2, i32, float, %struct.ImVec2, %struct.ImVec2, i32, i32, i32, i8, i8, float, float, i32, i32, float, i8, i8, i8, i8, i8, i8, %struct.ImVec2, ptr, i32, i32, i32, i8, i8, ptr, i32, float, [140 x %struct.ImGuiKeyOwnerData], %struct.ImGuiKeyRoutingTable, i32, i8, i32, i32, i32, i32, %struct.ImGuiNextItemData, %struct.ImGuiLastItemData, %struct.ImGuiNextWindowData, %struct.ImVector.6, %struct.ImVector.7, %struct.ImVector.8, %struct.ImVector.9, %struct.ImVector.10, %struct.ImVector.11, %struct.ImVector.12, %struct.ImVector.12, i32, %struct.ImVector.13, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i32, %struct.ImRect, i8, i8, i8, i32, i32, i32, i32, i32, i32, %struct.ImRect, %struct.ImRect, i32, i32, i32, %struct.ImGuiNavItemData, %struct.ImGuiNavItemData, %struct.ImGuiNavItemData, %struct.ImGuiNavItemData, i32, i32, ptr, ptr, ptr, float, float, i8, %struct.ImVec2, %struct.ImVec2, float, i32, i8, i8, i8, i32, i32, i32, [4 x i8], %struct.ImGuiPayload, %struct.ImRect, i32, i32, float, i32, i32, i32, i32, %struct.ImVector.14, [16 x i8], i32, %struct.ImVector.15, ptr, i32, %struct.ImVector.16, %struct.ImPool, %struct.ImVector.18, %struct.ImVector.19, ptr, %struct.ImPool.20, %struct.ImVector.22, %struct.ImVector.23, i32, i32, float, float, %struct.ImVec2, %struct.ImGuiInputTextState, %struct.ImGuiInputTextDeactivatedState, %struct.ImFont, i32, i32, i32, i32, float, float, i32, %struct.ImVec4, %struct.ImGuiComboPreviewData, float, float, i8, i8, float, float, float, float, i16, i16, %struct.ImVector.24, %struct.ImVector.9, %struct.ImGuiPlatformImeData, %struct.ImGuiPlatformImeData, i8, i8, float, %struct.ImGuiTextBuffer, %struct.ImVector.26, %struct.ImChunkStream, %struct.ImChunkStream.27, %struct.ImVector.28, i32, [7 x ptr], i8, i32, ptr, %struct.ImGuiTextBuffer, ptr, ptr, float, i8, i32, i32, i32, i32, %struct.ImGuiTextBuffer, %struct.ImGuiTextIndex, i8, i8, i8, i8, i8, i32, %struct.ImGuiMetricsConfig, %struct.ImGuiStackTool, [60 x float], i32, i32, float, i32, i32, i32, %struct.ImVector.24 }
%struct.ImGuiIO = type { i32, i32, %struct.ImVec2, float, float, ptr, ptr, float, float, float, float, float, float, float, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, i8, i8, float, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, float, i32, i32, i32, i32, i32, %struct.ImVec2, [652 x i32], [652 x i8], [16 x float], ptr, %struct.ImVec2, [5 x i8], float, float, i32, i8, i8, i8, i8, i32, [652 x %struct.ImGuiKeyData], i8, %struct.ImVec2, [5 x %struct.ImVec2], [5 x double], [5 x i8], [5 x i8], [5 x i16], [5 x i16], [5 x i8], [5 x i8], [5 x i8], i8, [5 x float], [5 x float], [5 x float], float, i8, i8, i8, i8, i16, %struct.ImVector }
%struct.ImGuiKeyData = type { i8, float, float, float }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImGuiStyle = type { float, float, %struct.ImVec2, float, float, %struct.ImVec2, %struct.ImVec2, i32, float, float, float, float, %struct.ImVec2, float, float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, float, float, float, float, float, float, float, float, float, i32, %struct.ImVec2, %struct.ImVec2, float, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, i8, i8, i8, float, float, [53 x %struct.ImVec4] }
%struct.ImDrawListSharedData = type { %struct.ImVec2, ptr, float, float, float, %struct.ImVec4, i32, %struct.ImVector.0, [48 x %struct.ImVec2], float, [64 x i8], ptr }
%struct.ImVector.0 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImGuiStorage = type { %struct.ImVector.4 }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImGuiKeyOwnerData = type <{ i32, i32, i8, i8, [2 x i8] }>
%struct.ImGuiKeyRoutingTable = type { [140 x i16], %struct.ImVector.5, %struct.ImVector.5 }
%struct.ImVector.5 = type { i32, i32, ptr }
%struct.ImGuiNextItemData = type <{ i32, float, i32, i32, i8, [3 x i8] }>
%struct.ImGuiLastItemData = type { i32, i32, i32, %struct.ImRect, %struct.ImRect, %struct.ImRect }
%struct.ImGuiNextWindowData = type <{ i32, i32, i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, i8, [3 x i8], %struct.ImRect, [4 x i8], ptr, ptr, float, %struct.ImVec2, [4 x i8] }>
%struct.ImVector.6 = type { i32, i32, ptr }
%struct.ImVector.7 = type { i32, i32, ptr }
%struct.ImVector.8 = type { i32, i32, ptr }
%struct.ImVector.10 = type { i32, i32, ptr }
%struct.ImVector.11 = type { i32, i32, ptr }
%struct.ImVector.12 = type { i32, i32, ptr }
%struct.ImVector.13 = type { i32, i32, ptr }
%struct.ImGuiNavItemData = type { ptr, i32, i32, %struct.ImRect, i32, float, float, float }
%struct.ImGuiPayload = type <{ ptr, i32, i32, i32, i32, [33 x i8], i8, i8, [5 x i8] }>
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%struct.ImVector.14 = type { i32, i32, ptr }
%struct.ImVector.15 = type { i32, i32, ptr }
%struct.ImVector.16 = type { i32, i32, ptr }
%struct.ImPool = type { %struct.ImVector.17, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.17 = type { i32, i32, ptr }
%struct.ImVector.18 = type { i32, i32, ptr }
%struct.ImVector.19 = type { i32, i32, ptr }
%struct.ImPool.20 = type { %struct.ImVector.21, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.21 = type { i32, i32, ptr }
%struct.ImVector.22 = type { i32, i32, ptr }
%struct.ImVector.23 = type { i32, i32, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImGuiInputTextState = type <{ ptr, i32, i32, i32, [4 x i8], %struct.ImVector, %struct.ImVector.24, %struct.ImVector.24, i8, [3 x i8], i32, float, %"struct.ImStb::STB_TexteditState", float, i8, i8, i8, i8, i32, [4 x i8] }>
%"struct.ImStb::STB_TexteditState" = type { i32, i32, i32, i8, i32, i8, i8, i8, i8, i8, i8, i8, float, %"struct.ImStb::StbUndoState" }
%"struct.ImStb::StbUndoState" = type { [99 x %"struct.ImStb::StbUndoRecord"], [999 x i16], i16, i16, i32, i32 }
%"struct.ImStb::StbUndoRecord" = type { i32, i32, i32, i32 }
%struct.ImGuiInputTextDeactivatedState = type { i32, %struct.ImVector.24 }
%struct.ImFont = type <{ %struct.ImVector.18, float, float, %struct.ImVector, %struct.ImVector.25, ptr, ptr, ptr, i16, i16, i16, i16, float, float, i8, [3 x i8], float, float, float, i32, [2 x i8], [2 x i8] }>
%struct.ImVector.25 = type { i32, i32, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImGuiComboPreviewData = type { %struct.ImRect, %struct.ImVec2, %struct.ImVec2, %struct.ImVec2, float, i32 }
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImGuiPlatformImeData = type { i8, %struct.ImVec2, float }
%struct.ImVector.26 = type { i32, i32, ptr }
%struct.ImChunkStream = type { %struct.ImVector.24 }
%struct.ImChunkStream.27 = type { %struct.ImVector.24 }
%struct.ImVector.28 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.24 }
%struct.ImGuiTextIndex = type <{ %struct.ImVector.10, i32, [4 x i8] }>
%struct.ImGuiMetricsConfig = type { i8, i8, i8, i8, i8, i8, i8, i8, i32, i32 }
%struct.ImGuiStackTool = type { i32, i32, i32, %struct.ImVector.29, i8, float }
%struct.ImVector.29 = type { i32, i32, ptr }
%struct.ImVector.24 = type { i32, i32, ptr }

@GImGui = external dso_local global ptr, align 8

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui14IsAnyMouseDownEv() #1 {
  %1 = alloca i1, align 1
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #2
  %5 = load ptr, ptr @GImGui, align 8, !tbaa !5
  store ptr %5, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %6

6:                                                ; preds = %21, %0
  %7 = load i32, ptr %3, align 4, !tbaa !9
  %8 = icmp slt i32 %7, 5
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  store i32 2, ptr %4, align 4
  br label %24

10:                                               ; preds = %6
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ImGuiContext, ptr %11, i32 0, i32 2
  %13 = getelementptr inbounds %struct.ImGuiIO, ptr %12, i32 0, i32 60
  %14 = load i32, ptr %3, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 %15
  %17 = load i8, ptr %16, align 1, !tbaa !11, !range !13, !noundef !14
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %20

19:                                               ; preds = %10
  store i1 true, ptr %1, align 1
  store i32 1, ptr %4, align 4
  br label %24

20:                                               ; preds = %10
  br label %21

21:                                               ; preds = %20
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %3, align 4, !tbaa !9
  br label %6, !llvm.loop !15

24:                                               ; preds = %19, %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  %25 = load i32, ptr %4, align 4
  switch i32 %25, label %27 [
    i32 2, label %26
  ]

26:                                               ; preds = %24
  store i1 false, ptr %1, align 1
  store i32 1, ptr %4, align 4
  br label %27

27:                                               ; preds = %26, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #2
  %28 = load i1, ptr %1, align 1
  ret i1 %28
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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"

@GImGui = external dso_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui14IsAnyMouseDownEv() local_unnamed_addr #0 {
  %1 = load ptr, ptr @GImGui, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %1, i64 3600
  %3 = load i8, ptr %2, align 1, !tbaa !9, !range !11, !noundef !12
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %.critedge, label %5

5:                                                ; preds = %0
  %6 = getelementptr inbounds i8, ptr %1, i64 3601
  %7 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %8 = trunc nuw i8 %7 to i1
  br i1 %8, label %.critedge, label %9

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %1, i64 3602
  %11 = load i8, ptr %10, align 1, !tbaa !9, !range !11, !noundef !12
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %.critedge, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %1, i64 3603
  %15 = load i8, ptr %14, align 1, !tbaa !9, !range !11, !noundef !12
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %.critedge, label %17

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %1, i64 3604
  %19 = load i8, ptr %18, align 1, !tbaa !9, !range !11, !noundef !12
  %20 = trunc nuw i8 %19 to i1
  br label %.critedge

.critedge:                                        ; preds = %17, %13, %9, %5, %0
  %.lcssa = phi i1 [ true, %0 ], [ true, %5 ], [ true, %9 ], [ true, %13 ], [ %20, %17 ]
  ret i1 %.lcssa
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, inaccessiblemem: none) 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" }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass