Function at 0x140058310
Capabilities:
Get keyboard layout

Disassembly:
mov qword [rsp + 0x20], rbx
push rbp
push rsi
push rdi
sub rsp, 0x250
mov rbx, qword [0x14016f6f0]
mov rdi, rcx
xor ecx, ecx
mov rsi, rdx
call qword [sym.imp.USER32.dll_GetKeyboardLayout]
xor r8d, r8d
xor edx, edx
mov rcx, rdi
mov r9, rax
call fcn.140019df0
movzx ebp, al
test al, al
jne 0x140058681
lea rdx, [rsp + 0x280]
xor r8d, r8d
mov rcx, rdi
call fcn.1400712c0
test eax, eax
jne 0x140058647
movzx eax, byte [rbx + 0x23]
mov qword [rsp + 0x270], r12
test al, al
jne 0x1400583a5
mov rcx, qword [rbx + 0x10]
lea rdx, [0x1401295d4]
xor r9d, r9d
or r8, 0xffffffffffffffff
mov byte [rsp + 0x20], 1
call fcn.1400e9bc0
mov r12, qword [rsp + 0x270]
mov edi, eax
jmp 0x1400586eb
lea r12, [0x1401295d4]
xor edi, edi
mov qword [rsp + 0x278], r13
cmp qword [rbx + 8], r12
jne 0x1400583c5
mov r13, qword [rbx + 0x10]
shr r13, 1
jmp 0x1400583c8
mov r13, rdi
lea rcx, [r13 + 1]
lea rbp, [rcx + rcx]
cmp al, 2
jne 0x1400583e6
mov rdx, r13
mov rcx, r12
call fcn.140005910
mov edi, eax
jmp 0x1400585f5
mov r8, qword [0x140169b08]
cmp rbp, r8
jbe 0x14005841d
cmp rbp, qword [rbx + 0x18]
jbe 0x14005841d
lea rcx, [0x14014bd60]
call fcn.1400dd2e0
lea rcx, [0x1401712e0]
mov r8, r12
mov rdx, rax
call fcn.1400a5580
mov edi, eax
jmp 0x1400585f5
cmp rcx, 2
jae 0x140058437
xor r8d, r8d
mov rcx, rbx
lea edx, [r8 + 4]
call fcn.1400ea290
jmp 0x1400585f0
movzx eax, byte [rbx + 0x21]
test al, 2
je 0x140058454
mov rcx, qword [rbx]
and al, 0x3d
mov byte [rbx + 0x21], al
mov rax, qword [rcx]
call qword [rax + reloc.OLEAUT32.dll_SafeArrayGetDim]
mov r8, qword [0x140169b08]
mov rcx, qword [rbx + 0x18]
and byte [rbx + 0x21], 0x82
cmp rbp, rcx
jbe 0x1400585c9
movzx r9d, byte [rbx + 0x20]
movzx eax, r9b
cmp r9b, 1
jbe 0x14005848d
cmp al, 2
je 0x1400584ca
mov rsi, qword [rsp + 0x280]
mov rax, qword [rsp + 0x280]
jmp 0x1400585bd
mov esi, 0x80
cmp rbp, rsi
ja 0x1400584ca
cmp rbp, 8
ja 0x1400584a4
mov esi, 8
jmp 0x1400584b0
mov eax, reloc.OLEAUT32.dll_SafeArrayGetDim
cmp rbp, rax
cmovbe rsi, rax
mov rcx, rsi
call fcn.1400dc2b0
test rax, rax
je 0x1400585f5
mov byte [rbx + 0x20], 1
jmp 0x1400585bd
cmp rbp, 0x20
jae 0x1400584da
mov esi, SafeArrayAllocDescriptor
jmp 0x140058584
mov esi, 0x208
cmp rbp, rsi
jb 0x140058584
cmp rbp, 0x50000
jae 0x140058540
pxor xmm0, xmm0
cvtsi2sd xmm0, rbp
test rbp, rbp
jns 0x140058507
addsd xmm0, qword [0x140152fd8]
mulsd xmm0, qword [0x140153040]
movsd xmm1, qword [0x140153038]
xor eax, eax
comisd xmm0, xmm1
jbe 0x140058536
subsd xmm0, xmm1
comisd xmm0, xmm1
jae 0x140058536
movabs rdx, 0x8000000000000000
mov rax, rdx
cvttsd2si rsi, xmm0
add rsi, rax
jmp 0x140058584
cmp rbp, 0x320000
jae 0x140058552
lea rsi, [rbp + 0x8000]
jmp 0x140058584
cmp rbp, 0xc80000
jae 0x14005857d
movabs rax, 0x47ae147ae147ae15
mov rsi, rbp
mul rbp
sub rsi, rdx
shr rsi, 1
add rsi, rdx
shr rsi, 6
add rsi, rbp
jmp 0x140058584
lea rsi, [rbp + 0x20000]
cmp rsi, r8
cmova rsi, r8
cmp r9b, 2
jne 0x1400585a4
test rcx, rcx
je 0x1400585a4
mov rcx, qword [rbx + 8]
mov bpl, 1
call fcn.140108f48
jmp 0x1400585a7
xor bpl, bpl
test rsi, rsi
js 0x14005860c
mov rcx, rsi
call fcn.1401084ac
test rax, rax
je 0x14005860c
mov byte [rbx + 0x20], 2
and byte [rbx + 0x21], 0x7f
mov qword [rbx + 8], rax
mov qword [rbx + 0x18], rsi
mov rcx, qword [rbx + 8]
cmp rcx, r12
je 0x1400585df
lea r8, [r13 + r13]
mov rdx, r12
call fcn.140109100
mov rax, qword [rbx + 8]
lea rcx, [r13 + r13]
mov word [rcx + rax], di
mov qword [rbx + 0x10], rcx
mov edi, 1
mov r13, qword [rsp + 0x278]
mov r12, qword [rsp + 0x270]
mov eax, edi
jmp 0x1400586eb
test bpl, bpl
je 0x140058622
lea rax, [0x140171290]
mov qword [rbx + 0x18], rdi
mov qword [rbx + 8], rax
jmp 0x140058629
mov rax, qword [rbx + 8]
mov word [rax], di
lea rdx, str.Out_of_memory.
lea rcx, [0x1401712e0]
mov r8, r12
mov qword [rbx + 0x10], rdi
call fcn.1400a5580
mov edi, eax
jmp 0x1400585f5
mov edx, dword [rsp + 0x280]
lea rcx, [rsp + 0x50]
xor edi, edi
mov qword [rsp + 0x30], rcx
lea r8, [rsp + 0x30]
xor r9d, r9d
mov ecx, eax
mov dword [rsp + 0x40], edi
mov word [rsp + 0x50], di
call fcn.140071740
lea rdx, [rsp + 0x30]
mov rcx, rbx
call fcn.1400e9450
jmp 0x1400586eb
movzx edi, word [rsi]
mov esi, 2
test edi, 0xffffff80
jne 0x1400586a1
mov edx, esi
mov ecx, edi
call fcn.140109968
test eax, eax
je 0x1400586a1
and edi, 0xffffffdf
movzx eax, di
cmp eax, 0x50
je 0x1400586b3
xor edi, edi
cmp eax, 0x54
cmovne esi, edi
jmp 0x1400586b8
mov esi, 1
mov edx, esi
movzx ecx, bpl
call fcn.140071680
lea rcx, [0x140137900]
lea rdx, [0x140137904]
test al, al
mov byte [rsp + 0x20], 1
cmovne rdx, rcx
xor r9d, r9d
or r8, 0xffffffffffffffff
mov rcx, rbx
call fcn.1400e9bc0
mov rbx, qword [rsp + 0x288]
add rsp, 0x250
pop rdi
pop rsi
pop rbp
ret