Function at 0x414840
Capabilities:
Generate random numbers via winapi
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x52b960
mov eax, dword fs:[0]
push eax
sub esp, 0x58
mov eax, dword [0x566148]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
xor ebx, ebx
mov edi, 7
xor eax, eax
mov esi, ecx
mov byte [ebp - 0x49], bl
mov dword [ebp - 0x34], edi
mov dword [ebp - 0x38], ebx
mov word [ebp - 0x48], ax
mov dword [ebp - 4], ebx
call fcn.004d0050
push 5
push str.grail
lea ecx, [ebp - 0x48]
call fcn.00404540
lea ecx, [ebp - 0x48]
push ecx
lea edx, [ebp - 0x2c]
push 0x568ae0
push edx
mov dword [ebp - 4], 1
call fcn.00412bf0
add esp, 0xc
mov byte [ebp - 4], 3
cmp dword [ebp - 0x34], 8
jb 0x4148cc
mov eax, dword [ebp - 0x48]
push eax
call fcn.004e895a
add esp, 4
push ebx
lea edx, [ebp - 0x2c]
push edx
lea eax, [ebp - 0x50]
xor ecx, ecx
push eax
mov dword [ebp - 0x34], edi
mov dword [ebp - 0x38], ebx
mov word [ebp - 0x48], cx
call fcn.004ceb30
mov eax, dword [eax]
add esp, 0xc
cmp eax, ebx
je 0x41497d
cmp eax, 1
je 0x41497d
cmp dword [ebp - 0x18], 8
mov eax, dword [ebp - 0x2c]
jae 0x414908
lea eax, [ebp - 0x2c]
push ebx
push 0x80
push 3
push ebx
push 1
push SysReAllocString
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
jne 0x414942
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea esi, [ebp - 0x64]
call fcn.0042e310
push 0x555740
mov ecx, esi
push ecx
call fcn.004ecd9a
push ebx
lea edx, [ebp - 0x50]
push edx
push 0x100
push esi
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
setne al
cmp al, bl
je 0x41496a
cmp dword [ebp - 0x50], 0x100
mov byte [ebp - 0x49], 1
je 0x41496d
mov byte [ebp - 0x49], bl
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp byte [ebp - 0x49], bl
jne 0x414a0a
mov eax, dword [ebp + 8]
push esi
push 0x100
push eax
call dword [sym.imp.ADVAPI32.dll_CryptGenRandom]
test eax, eax
jne 0x4149ad
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea esi, [ebp - 0x64]
call fcn.0042e310
push 0x555740
mov ecx, esi
push ecx
call fcn.004ecd9a
cmp dword [ebp - 0x18], 8
mov eax, dword [ebp - 0x2c]
jae 0x4149b9
lea eax, [ebp - 0x2c]
push ebx
push 0x80
push 2
push ebx
push ebx
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
mov dword [ebp - 0x50], edi
cmp edi, 0xffffffff
jne 0x4149f5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea esi, [ebp - 0x64]
call fcn.0042e310
push 0x555740
mov edx, esi
push edx
call fcn.004ecd9a
mov ecx, esi
lea edx, [ebp - 0x50]
mov byte [ebp - 4], 4
call fcn.00415430
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor byte [esi], 0x5c
xor byte [esi + 1], 0x40
xor byte [esi + 2], 0x3c
xor byte [esi + 3], 0x4f
xor byte [esi + 4], 0xe
xor byte [esi + 5], 0x8e
xor byte [esi + 6], 0x83
xor byte [esi + 7], 0xac
cmp dword [ebp - 0x18], 8
jb 0x414a3b
mov eax, dword [ebp - 0x2c]
push eax
call fcn.004e895a
add esp, 4
mov al, byte [ebp - 0x49]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.004e8965
mov esp, ebp
pop ebp
ret