; LLVM IR from jasonlmfong/Model-Modifier :: Model-Modifier/src/external/imgui (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, 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, float, float, float, float, float, float, float, ptr, ptr, float, i8, ptr, %struct.ImVec2, i8, i8, i8, i8, i8, i8, i8, i8, float, 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], %struct.ImVec2, [5 x i8], float, float, 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], [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 }

; 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(14264) 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 i32 @glfwGetInputMode(ptr noundef, i32 noundef) #2

declare void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14264), 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 i32, align 4
  %7 = 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
  %8 = call noundef ptr @_ZL29ImGui_ImplGlfw_GetBackendDatav()
  store ptr %8, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %9, i32 0, i32 10
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %22

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

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

22:                                               ; preds = %16, %13, %2
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = call i32 @glfwGetInputMode(ptr noundef %23, i32 noundef 208897)
  %25 = icmp eq i32 %24, 212995
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  store i32 1, ptr %6, align 4
  br label %63

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %28 = call noundef nonnull align 8 dereferenceable(14264) ptr @_ZN5ImGui5GetIOEv()
  store ptr %28, ptr %7, align 8, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %44

31:                                               ; preds = %27
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %33, i32 0, i32 3
  store ptr %32, ptr %34, align 8, !tbaa !18
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %36, i32 0, i32 5
  %38 = getelementptr inbounds %struct.ImVec2, ptr %37, i32 0, i32 0
  %39 = load float, ptr %38, align 8, !tbaa !19
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %40, i32 0, i32 5
  %42 = getelementptr inbounds %struct.ImVec2, ptr %41, i32 0, i32 1
  %43 = load float, ptr %42, align 4, !tbaa !20
  call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14264) %35, float noundef %39, float noundef %43)
  br label %62

44:                                               ; preds = %27
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %61, label %47

47:                                               ; preds = %44
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %48, i32 0, i32 3
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = icmp eq ptr %50, %51
  br i1 %52, label %53, label %61

53:                                               ; preds = %47
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ImGuiIO, ptr %54, i32 0, i32 56
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %56, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %57, ptr align 4 %55, i64 8, i1 false), !tbaa.struct !21
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ImGui_ImplGlfw_Data, ptr %58, i32 0, i32 3
  store ptr null, ptr %59, align 8, !tbaa !18
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14264) %60, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  br label %61

61:                                               ; preds = %53, %47, %44
  br label %62

62:                                               ; preds = %61, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  store i32 0, ptr %6, align 4
  br label %63

63:                                               ; preds = %62, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %64 = load i32, ptr %6, align 4
  switch i32 %64, label %66 [
    i32 0, label %65
    i32 1, label %65
  ]

65:                                               ; preds = %63, %63
  ret void

66:                                               ; preds = %63
  unreachable
}

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 136}
!12 = !{!"_ZTS19ImGui_ImplGlfw_Data", !6, i64 0, !13, i64 8, !14, i64 16, !6, i64 24, !7, i64 32, !15, i64 104, !17, i64 112, !17, i64 113, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!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(14264) ptr @_ZN5ImGui5GetIOEv() local_unnamed_addr #1

declare i32 @glfwGetInputMode(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14264), 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 136
  %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 i32 @glfwGetInputMode(ptr noundef %0, i32 noundef 208897)
  %12 = icmp eq i32 %11, 212995
  br i1 %12, label %28, label %13

13:                                               ; preds = %10
  %14 = tail call noundef nonnull align 8 dereferenceable(14264) ptr @_ZN5ImGui5GetIOEv()
  %.not18 = icmp eq i32 %1, 0
  %15 = getelementptr inbounds i8, ptr %3, i64 24
  br i1 %.not18, label %21, label %16

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

21:                                               ; preds = %13
  %22 = load ptr, ptr %15, align 8, !tbaa !15
  %23 = icmp eq ptr %22, %0
  br i1 %23, label %24, label %28

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %14, i64 3572
  %26 = getelementptr inbounds i8, ptr %3, i64 104
  %27 = load i64, ptr %25, align 4
  store i64 %27, ptr %26, align 8
  store ptr null, ptr %15, align 8, !tbaa !15
  tail call void @_ZN7ImGuiIO16AddMousePosEventEff(ptr noundef nonnull align 8 dereferenceable(14264) %14, float noundef 0xC7EFFFFFE0000000, float noundef 0xC7EFFFFFE0000000)
  br label %28

28:                                               ; preds = %16, %24, %21, %10
  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 136}
!6 = !{!"_ZTS19ImGui_ImplGlfw_Data", !7, i64 0, !10, i64 8, !11, i64 16, !7, i64 24, !8, i64 32, !12, i64 104, !14, i64 112, !14, i64 113, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176}
!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