; LLVM IR from khushmmehta/Scorch-V :: src/vendor/imgui/backends (imgui_impl_glfw)

; 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.ImGui_ImplGlfw_Data = type { ptr, i32, double, ptr, [9 x ptr], %struct.ImVec2, [348 x ptr], i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImGuiIO = type { i32, i32, %struct.ImVec2, float, float, ptr, ptr, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, float, float, float, float, float, float, i8, i8, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i16, i8, i8, i8, i8, i8, i8, i8, float, i32, i32, i32, i32, %struct.ImVec2, [666 x i32], [666 x i8], [16 x float], ptr, ptr, %struct.ImVec2, [5 x i8], float, float, i32, i32, i8, i8, i8, i8, i32, [666 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 %struct.ImVec2], [5 x float], float, i8, i8, i8, i8, i16, %struct.ImVector }
%struct.ImGuiKeyData = type { i8, float, float, float }
%struct.ImVector = type { i32, i32, ptr }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() #1

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL34ImGui_ImplGlfw_ShouldChainCallbackP10GLFWwindow(ptr noundef) #1

declare noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv() #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624), float noundef, float noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z34ImGui_ImplGlfw_CursorEnterCallbackP10GLFWwindowi(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %7 = call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %8, i32 0, i32 12
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = icmp ne ptr %10, null
  br i1 %11, label %12, label %21

12:                                               ; preds = %2
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZL34ImGui_ImplGlfw_ShouldChainCallbackP10GLFWwindow(ptr noundef %13)
  br i1 %14, label %15, label %21

15:                                               ; preds = %12
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %16, i32 0, i32 12
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !9
  call void %18(ptr noundef %19, i32 noundef %20)
  br label %21

21:                                               ; preds = %15, %12, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %22 = call noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv()
  store ptr %22, ptr %6, align 8, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %38

25:                                               ; preds = %21
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %27, i32 0, i32 3
  store ptr %26, ptr %28, align 8, !tbaa !18
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %30, i32 0, i32 5
  %32 = getelementptr inbounds %struct.ImVec2, ptr %31, i32 0, i32 0
  %33 = load float, ptr %32, align 8, !tbaa !19
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %34, i32 0, i32 5
  %36 = getelementptr inbounds %struct.ImVec2, ptr %35, i32 0, i32 1
  %37 = load float, ptr %36, align 4, !tbaa !20
  call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624) %29, float noundef %33, float noundef %37)
  br label %56

38:                                               ; preds = %21
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %55, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %42, i32 0, i32 3
  %44 = load ptr, ptr %43, align 8, !tbaa !18
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = icmp eq ptr %44, %45
  br i1 %46, label %47, label %55

47:                                               ; preds = %41
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ImGuiIO, ptr %48, i32 0, i32 67
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %50, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %51, ptr align 8 %49, i64 8, i1 false), !tbaa.struct !21
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %52, i32 0, i32 3
  store ptr null, ptr %53, align 8, !tbaa !18
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624) %54, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  br label %55

55:                                               ; preds = %47, %41, %38
  br label %56

56:                                               ; preds = %55, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 2920}
!12 = !{!"_ZTS19ImGui_ImplGlfw_Data", !6, i64 0, !13, i64 8, !14, i64 16, !6, i64 24, !7, i64 32, !15, i64 104, !7, i64 112, !17, i64 2896, !17, i64 2897, !17, i64 2898, !6, i64 2904, !6, i64 2912, !6, i64 2920, !6, i64 2928, !6, i64 2936, !6, i64 2944, !6, i64 2952, !6, i64 2960}
!13 = !{!"_ZTS13GlfwClientApi", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"_ZTS6ImVec2", !16, i64 0, !16, i64 4}
!16 = !{!"float", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!12, !6, i64 24}
!19 = !{!12, !16, i64 104}
!20 = !{!12, !16, i64 108}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22}
!22 = !{!16, !16, 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: mustprogress uwtable
declare hidden noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL34ImGui_ImplGlfw_ShouldChainCallbackP10GLFWwindow(ptr noundef) local_unnamed_addr #0

declare noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv() local_unnamed_addr #1

declare void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624), float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z34ImGui_ImplGlfw_CursorEnterCallbackP10GLFWwindowi(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  %4 = getelementptr inbounds i8, ptr %3, i64 2920
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %10, label %6

6:                                                ; preds = %2
  %7 = tail call noundef zeroext i1 @_ZL34ImGui_ImplGlfw_ShouldChainCallbackP10GLFWwindow(ptr noundef %0)
  br i1 %7, label %8, label %10

8:                                                ; preds = %6
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  tail call void %9(ptr noundef %0, i32 noundef %1)
  br label %10

10:                                               ; preds = %8, %6, %2
  %11 = tail call noundef nonnull align 8 dereferenceable(14624) ptr @_ZN5ImGui5GetIOEv()
  %.not17 = icmp eq i32 %1, 0
  %12 = getelementptr inbounds i8, ptr %3, i64 24
  br i1 %.not17, label %18, label %13

13:                                               ; preds = %10
  store ptr %0, ptr %12, align 8, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %3, i64 104
  %15 = load float, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %3, i64 108
  %17 = load float, ptr %16, align 4, !tbaa !17
  tail call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624) %11, float noundef %15, float noundef %17)
  br label %25

18:                                               ; preds = %10
  %19 = load ptr, ptr %12, align 8, !tbaa !15
  %20 = icmp eq ptr %19, %0
  br i1 %20, label %21, label %25

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %11, i64 3656
  %23 = getelementptr inbounds i8, ptr %3, i64 104
  %24 = load i64, ptr %22, align 8
  store i64 %24, ptr %23, align 8
  store ptr null, ptr %12, align 8, !tbaa !15
  tail call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14624) %11, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  br label %25

25:                                               ; preds = %18, %21, %13
  ret void
}

attributes #0 = { 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 #1 = { "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, !7, i64 2920}
!6 = !{!"_ZTS19ImGui_ImplGlfw_Data", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !8, i64 32, !12, i64 104, !8, i64 112, !14, i64 2896, !14, i64 2897, !14, i64 2898, !7, i64 2904, !7, i64 2912, !7, i64 2920, !7, i64 2928, !7, i64 2936, !7, i64 2944, !7, i64 2952, !7, i64 2960}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS13GlfwClientApi", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTS6ImVec2", !13, i64 0, !13, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{!6, !7, i64 24}
!16 = !{!6, !13, i64 104}
!17 = !{!6, !13, i64 108}


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