Function at 0x477420
Capabilities:
Generate random numbers using a mersenne twister

Disassembly:
sub esp, 0xc
push ebx
mov ebx, dword [esp + 0x18]
push ebp
mov ebp, dword [esp + 0x18]
push esi
push edi
mov edi, eax
cmp ebx, 3
jl 0x477800
movzx eax, byte [esp + 0x28]
or ecx, 0xffffffff
sub ecx, eax
add ebx, ecx
cmp byte [0x51b94e], 0
mov dword [esp + 0x24], ebx
mov dword [esp + 0x10], edi
je 0x477565
mov byte [esp + 0x20], 0
mov eax, dword [ebp + 8]
push eax
push str._03u:
mov esi, ebx
call fcn.004ac070
add esp, 8
dec dword [0x5164e0]
lea edi, [edi + eax*2]
jne 0x477483
call fcn.00413d80
mov ecx, dword [0x519dfc]
mov eax, dword [ecx]
add ecx, 4
mov dword [0x519dfc], ecx
mov ecx, eax
shr ecx, 0xb
xor eax, ecx
mov edx, eax
and edx, 0xff3a58ad
shl edx, 7
xor eax, edx
mov ecx, eax
and ecx, 0xffffdf8c
shl ecx, 0xf
xor eax, ecx
mov ecx, eax
shr ecx, 0x12
xor ecx, eax
movzx eax, word [ebp]
cdq
push edx
push eax
push 0
push ecx
call fcn.004d94d0
inc ax
cmp byte [esp + 0x30], 0
movzx ebx, ax
mov dword [esp + 0x18], ebx
je 0x47751c
mov edx, dword [esp + 0x2c]
fild dword [esp + 0x2c]
test edx, edx
jns 0x4774ed
fadd dword [0x50f878]
fdiv qword [0x50f870]
sub esp, 8
fstp qword [esp]
push 0x50c2b0
call fcn.004a4b10
add esp, 4
push eax
mov eax, edi
sub eax, dword [esp + 0x1c]
sar eax, 1
sub esi, eax
call fcn.004ac070
add esp, 0xc
lea edi, [edi + eax*2]
movzx eax, word [ebp]
cmp eax, 0xf
je 0x47770b
cmp eax, 0x10
je 0x47770b
cmp eax, 7
ja 0x47753c
cmp eax, 1
jae 0x477557
cmp eax, 9
jb 0x4775fc
cmp eax, 0x20
ja 0x4775fc
cmp eax, 0x18
jae 0x4775fc
cmp byte [ebp + 2], 1
jbe 0x477595
mov ecx, dword [ebp + 0xc]
mov esi, dword [ecx + 0x14]
jmp 0x47759a
movzx esi, word [ebp + 4]
call fcn.0046bf30
mov byte [esp + 0x20], al
test al, al
je 0x477460
call fcn.00413e50
mov edx, dword [ebp + 8]
push 0
push edx
push 0
push eax
call fcn.004d94d0
add eax, 0xa
jmp 0x477463
mov esi, 0x4f5ac4
cmp byte [esp + 0x20], 0
je 0x4775aa
mov edx, 0x4f5ac4
mov ecx, edx
jmp 0x4775c7
mov ebp, dword [ebp + 0xc]
mov ecx, dword [ebp + 4]
mov edx, eax
imul edx, edx, 0x15
cmp word [ecx], 0
mov edx, dword [edx + 0x5168a0]
jne 0x4775c7
mov ecx, dword [ebp + 8]
mov ecx, dword [ecx + 0x18]
cmp eax, 9
jb 0x4775d6
cmp eax, 0x20
mov eax, 0x50c328
jbe 0x4775db
mov eax, 0x4f5ac4
push esi
push edx
push ecx
push eax
push str.u_t4hp_ed
call fcn.004a4b10
mov esi, dword [esp + 0x38]
mov edx, edi
sub edx, dword [esp + 0x24]
sar edx, 1
sub esi, edx
jmp 0x47776b
cmp eax, 0x6a
jne 0x477659
mov ebp, dword [ebp + 0xc]
mov eax, dword [ebp + 0x14]
cmp word [eax], 0
jne 0x477619
mov ecx, dword [ebp + 0x18]
test ecx, ecx
je 0x477619
mov ecx, dword [ecx + 0x18]
jmp 0x47761b
mov ecx, eax
mov eax, dword [ebp + 4]
cmp word [eax], 0
jne 0x47762a
mov eax, dword [ebp + 8]
mov eax, dword [eax + 0x18]
mov edx, dword [ebp + 0x24]
push edx
push ecx
push eax
push 0x50c358
call fcn.004a4b10
mov esi, dword [esp + 0x34]
add esp, 4
push eax
mov eax, edi
sub eax, dword [esp + 0x20]
sar eax, 1
sub esi, eax
call fcn.004ac070
add esp, 0x10
jmp 0x477777
cmp byte [esp + 0x20], 0
je 0x477663
movzx eax, bx
mov esi, dword [esp + 0x24]
movzx ecx, ax
imul ecx, ecx, 0x15
mov edx, dword [ecx + 0x5168a0]
mov eax, edi
sub eax, dword [esp + 0x10]
push edx
sar eax, 1
push 0x50c388
sub esi, eax
call fcn.004ac070
xor ebx, ebx
add esp, 8
lea edi, [edi + eax*2]
cmp byte [ebp + 2], bl
jbe 0x47777a
mov dword [esp + 0x14], ebx
cmp byte [esp + 0x20], 0
je 0x4776bc
movzx edx, word [esp + 0x18]
movzx ecx, bl
xor ecx, edx
xor ecx, 0xf0
push ecx
push 0x50c390
jmp 0x4776e2
mov eax, dword [ebp + 0xc]
add eax, dword [esp + 0x14]
cmp byte [eax], 0
je 0x4776d9
mov ecx, dword [eax + 4]
cmp word [ecx], 0
jne 0x4776d9
mov edx, dword [eax + 8]
mov eax, dword [edx + 0x18]
jmp 0x4776dc
mov eax, dword [eax + 4]
push eax
push 0x50c398
mov esi, dword [esp + 0x2c]
mov eax, edi
sub eax, dword [esp + 0x18]
sar eax, 1
sub esi, eax
call fcn.004ac070
movzx ecx, byte [ebp + 2]
add dword [esp + 0x1c], 0x10
inc ebx
add esp, 8
lea edi, [edi + eax*2]
cmp ebx, ecx
jl 0x47769d
jmp 0x47777a
mov cl, byte [ebp + 2]
cmp cl, 2
jbe 0x47771b
mov edx, dword [ebp + 0xc]
mov esi, dword [edx + 0x24]
jmp 0x477720
mov esi, 0x4f5ac4
cmp cl, 1
jbe 0x47772d
mov ecx, dword [ebp + 0xc]
mov edx, dword [ecx + 0x14]
jmp 0x477732
mov edx, 0x4f5ac4
mov ebp, dword [ebp + 0xc]
mov ecx, dword [ebp + 4]
cmp word [ecx], 0
jne 0x477744
mov ecx, dword [ebp + 8]
mov ecx, dword [ecx + 0x18]
push esi
push edx
mov edx, eax
imul edx, edx, 0x15
mov eax, dword [edx + 0x5168a0]
push eax
push ecx
push str.9.qb_uh6a_n___xc:
call fcn.004a4b10
mov esi, dword [esp + 0x38]
mov ecx, edi
sub ecx, dword [esp + 0x24]
sar ecx, 1
sub esi, ecx
add esp, 4
push eax
call fcn.004ac070
add esp, 0x14
lea edi, [edi + eax*2]
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x4777c9
cmp byte [esp + 0x30], 0
jne 0x4777c9
mov dword [esp + 0x30], eax
fild dword [esp + 0x30]
test eax, eax
jns 0x47779b
fadd dword [0x50f878]
fdiv qword [0x50f870]
mov ebx, dword [esp + 0x10]
mov esi, dword [esp + 0x24]
mov edx, edi
sub edx, ebx
sub esp, 8
sar edx, 1
sub esi, edx
fstp qword [esp]
push str.___0.2f_
call fcn.004ac070
add esp, 0xc
lea edi, [edi + eax*2]
jmp 0x4777cd
mov ebx, dword [esp + 0x10]
cmp byte [esp + 0x28], 0
je 0x4777df
mov eax, 0xd
mov word [edi], ax
add edi, 2
cmp byte [esp + 0x20], 0
mov dword [edi], 0xa
je 0x4777fd
xor eax, eax
mov word [ebx], ax
mov eax, ebx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret 0x14
lea eax, [edi + 2]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret 0x14