; LLVM IR from theolundqvist/parallax-voxel-ray-marcher :: src/external/Dear ImGui/imgui.ll (ZN5ImGui13IsKeyReleasedEi)

; 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, [6 x i8], %struct.ImGuiIO, %struct.ImGuiStyle, ptr, float, float, %struct.ImDrawListSharedData, double, i32, i32, i32, i8, i8, i8, i8, i8, [3 x i8], i32, ptr, %struct.ImVector.3, %struct.ImVector.3, %struct.ImVector.3, %struct.ImVector.4, %struct.ImGuiStorage, i32, %struct.ImVec2, [4 x i8], ptr, ptr, ptr, ptr, ptr, %struct.ImVec2, float, i32, i32, i8, i8, i8, i8, float, float, i32, i32, float, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, [4 x i8], i64, %struct.ImVec2, ptr, i32, i32, i32, i8, i8, [2 x i8], ptr, i32, float, i32, %struct.ImGuiNextItemData, %struct.ImGuiLastItemData, [4 x i8], %struct.ImGuiNextWindowData, %struct.ImVector.5, %struct.ImVector.6, %struct.ImVector.7, %struct.ImVector.8, %struct.ImVector.9, %struct.ImVector.10, %struct.ImVector.11, %struct.ImVector.11, %struct.ImVector.12, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ImRect, i32, i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i32, %struct.ImRect, i8, [3 x i8], i32, i32, i32, i32, i32, i32, [4 x i8], %struct.ImGuiNavItemData, %struct.ImGuiNavItemData, %struct.ImGuiNavItemData, ptr, i32, [4 x i8], ptr, ptr, ptr, float, float, i8, [7 x i8], ptr, ptr, i32, i32, i32, i32, i8, [3 x i8], float, i32, i8, i8, i8, i8, i32, i32, i32, [4 x i8], %struct.ImGuiPayload, %struct.ImRect, i32, i32, float, i32, i32, i32, i32, [4 x i8], %struct.ImVector.13, [16 x i8], ptr, i32, [4 x i8], %struct.ImPool, %struct.ImVector.15, %struct.ImVector.16, %struct.ImVector.17, ptr, %struct.ImPool.18, %struct.ImVector.20, %struct.ImVector.21, %struct.ImVec2, %struct.ImGuiInputTextState, %struct.ImFont, i32, i32, float, float, [3 x float], %struct.ImVec4, %struct.ImGuiComboPreviewData, float, i8, i8, [2 x i8], float, float, float, float, i32, float, [4 x i8], %struct.ImVector.2, %struct.ImVector.8, %struct.ImVec2, %struct.ImVec2, i8, i8, [2 x i8], float, %struct.ImGuiTextBuffer, %struct.ImVector.23, %struct.ImChunkStream, %struct.ImChunkStream.24, %struct.ImVector.25, i32, i8, [3 x i8], i32, [4 x i8], ptr, %struct.ImGuiTextBuffer, ptr, ptr, float, i8, [3 x i8], i32, i32, i32, i8, [3 x i8], i32, %struct.ImGuiMetricsConfig, [120 x float], i32, i32, float, i32, i32, i32, [3073 x i8], [3 x i8] }>
%struct.ImGuiIO = type { i32, i32, %struct.ImVec2, float, float, ptr, ptr, float, float, float, [22 x i32], float, float, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, float, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.ImVec2, [5 x i8], float, float, i8, i8, i8, i8, [512 x i8], [20 x float], i8, i8, i8, i8, i8, i8, i8, float, i32, i32, i32, i32, i32, %struct.ImVec2, i32, i32, %struct.ImVec2, [5 x %struct.ImVec2], [5 x double], [5 x i8], [5 x i8], [5 x i8], [5 x i8], [5 x i8], [5 x float], [5 x float], [5 x %struct.ImVec2], [5 x float], [512 x float], [512 x float], [20 x float], [20 x float], float, i16, %struct.ImVector }
%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, %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, [48 x %struct.ImVec2], float, [64 x i8], ptr }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImGuiStorage = type { %struct.ImVector.0 }
%struct.ImVector.0 = 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.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.5 = type { i32, i32, ptr }
%struct.ImVector.6 = type { i32, i32, ptr }
%struct.ImVector.7 = type { i32, i32, ptr }
%struct.ImVector.9 = 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.ImGuiNavItemData = type <{ ptr, i32, i32, %struct.ImRect, float, float, float, [4 x i8] }>
%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.13 = type { i32, i32, ptr }
%struct.ImPool = type { %struct.ImVector.14, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.14 = type { i32, i32, ptr }
%struct.ImVector.15 = type { i32, i32, ptr }
%struct.ImVector.16 = type { i32, i32, ptr }
%struct.ImVector.17 = type { i32, i32, ptr }
%struct.ImPool.18 = type { %struct.ImVector.19, %struct.ImGuiStorage, i32, i32 }
%struct.ImVector.19 = type { i32, i32, ptr }
%struct.ImVector.20 = type { i32, i32, ptr }
%struct.ImVector.21 = type { i32, i32, ptr }
%struct.ImGuiInputTextState = type { i32, i32, i32, %struct.ImVector, %struct.ImVector.2, %struct.ImVector.2, i8, i32, float, %"struct.ImStb::STB_TexteditState", float, i8, i8, i8, i32, ptr, ptr }
%"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.ImFont = type <{ %struct.ImVector.16, float, float, %struct.ImVector, %struct.ImVector.22, ptr, ptr, ptr, i16, i16, i16, i16, i8, [3 x i8], float, float, float, i32, [2 x i8], [2 x i8] }>
%struct.ImVector.22 = 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.2 = type { i32, i32, ptr }
%struct.ImVector.8 = type { i32, i32, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImVector.23 = type { i32, i32, ptr }
%struct.ImChunkStream = type { %struct.ImVector.2 }
%struct.ImChunkStream.24 = type { %struct.ImVector.2 }
%struct.ImVector.25 = type { i32, i32, ptr }
%struct.ImGuiTextBuffer = type { %struct.ImVector.2 }
%struct.ImGuiMetricsConfig = type { i8, i8, i8, i8, i8, i32, i32 }

@GImGui = external dso_local global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui13IsKeyReleasedEi = external hidden unnamed_addr constant [31 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui13IsKeyReleasedEi(i32 noundef %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %6 = load ptr, ptr @GImGui, align 8, !tbaa !9
  store ptr %6, ptr %4, align 8, !tbaa !9
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = icmp slt i32 %7, 0
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %42

10:                                               ; preds = %1
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp sge i32 %11, 0
  br i1 %12, label %13, label %16

13:                                               ; preds = %10
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = icmp slt i32 %14, 512
  br label %16

16:                                               ; preds = %13, %10
  %17 = phi i1 [ false, %10 ], [ %15, %13 ]
  br i1 %17, label %18, label %19

18:                                               ; preds = %16
  br label %21

19:                                               ; preds = %16
  call void @__assert_fail(ptr noundef @.str.94, ptr noundef @.str.3, i32 noundef 4727, ptr noundef @__PRETTY_FUNCTION__._ZN5ImGui13IsKeyReleasedEi) #4
  unreachable

20:                                               ; No predecessors!
  br label %21

21:                                               ; preds = %20, %18
  %22 = load ptr, ptr %4, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.ImGuiContext, ptr %22, i32 0, i32 3
  %24 = getelementptr inbounds %struct.ImGuiIO, ptr %23, i32 0, i32 75
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [512 x float], ptr %24, i64 0, i64 %26
  %28 = load float, ptr %27, align 4, !tbaa !11
  %29 = fcmp oge float %28, 0.000000e+00
  br i1 %29, label %30, label %40

30:                                               ; preds = %21
  %31 = load ptr, ptr %4, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.ImGuiContext, ptr %31, i32 0, i32 3
  %33 = getelementptr inbounds %struct.ImGuiIO, ptr %32, i32 0, i32 44
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [512 x i8], ptr %33, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !13, !range !15, !noundef !16
  %38 = trunc i8 %37 to i1
  %39 = xor i1 %38, true
  br label %40

40:                                               ; preds = %30, %21
  %41 = phi i1 [ false, %21 ], [ %39, %30 ]
  store i1 %41, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %42

42:                                               ; preds = %40, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %43 = load i1, ptr %2, align 1
  ret i1 %43
}

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 = { 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 #3 = { nounwind }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}


; 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
@.str.3 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.94 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__._ZN5ImGui13IsKeyReleasedEi = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN5ImGui13IsKeyReleasedEi(i32 noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr @GImGui, align 8, !tbaa !5
  %3 = icmp slt i32 %0, 0
  br i1 %3, label %19, label %4

4:                                                ; preds = %1
  %5 = icmp ult i32 %0, 512
  br i1 %5, label %7, label %6

6:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.94, ptr noundef nonnull @.str.3, i32 noundef 4727, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5ImGui13IsKeyReleasedEi) #2
  unreachable

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %2, i64 3232
  %9 = zext nneg i32 %0 to i64
  %10 = getelementptr inbounds [512 x float], ptr %8, i64 0, i64 %9
  %11 = load float, ptr %10, align 4, !tbaa !9
  %12 = fcmp ult float %11, 0.000000e+00
  br i1 %12, label %19, label %13

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %2, i64 324
  %15 = getelementptr inbounds [512 x i8], ptr %14, i64 0, i64 %9
  %16 = load i8, ptr %15, align 1, !tbaa !11, !range !13, !noundef !14
  %17 = trunc nuw i8 %16 to i1
  %18 = xor i1 %17, true
  br label %19

19:                                               ; preds = %7, %13, %1
  %.0 = phi i1 [ false, %1 ], [ false, %7 ], [ %18, %13 ]
  ret i1 %.0
}

attributes #0 = { 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 #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 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


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