Function at 0x476b50
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 0x476fd4
movzx eax, byte [esp + 0x28]
or ecx, 0xffffffff
sub ecx, eax
add ebx, ecx
cmp byte [0x516737], 0
mov dword [esp + 0x24], ebx
mov dword [esp + 0x10], edi
je 0x476c95
mov byte [esp + 0x20], 0
mov eax, dword [ebp + 8]
push eax
push str._03u:
mov esi, ebx
call fcn.004a71f0
add esp, 8
dec dword [0x511510]
lea edi, [edi + eax*2]
jne 0x476bb3
call fcn.00414d40
mov ecx, dword [0x514e08]
mov eax, dword [ecx]
add ecx, 4
mov dword [0x514e08], 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.004d47d0
inc ax
cmp byte [esp + 0x30], 0
movzx edx, ax
mov dword [esp + 0x18], edx
je 0x476c4c
mov eax, dword [esp + 0x2c]
fild dword [esp + 0x2c]
test eax, eax
jns 0x476c1d
fadd dword [0x50a0a0]
fdiv qword [0x50a098]
sub esp, 8
fstp qword [esp]
push 0x506e80
call fcn.0049fc00
mov ecx, edi
sub ecx, dword [esp + 0x1c]
add esp, 4
sar ecx, 1
push eax
sub esi, ecx
call fcn.004a71f0
add esp, 0xc
lea edi, [edi + eax*2]
movzx eax, word [ebp]
cmp eax, 0xf
je 0x476f2a
cmp eax, 0x10
je 0x476f2a
cmp eax, 7
ja 0x476c6c
cmp eax, 1
jae 0x476c87
cmp eax, 9
jb 0x476d39
cmp eax, 0x20
ja 0x476d39
cmp eax, 0x18
jae 0x476d39
cmp byte [ebp + 2], 1
jbe 0x476cc5
mov edx, dword [ebp + 0xc]
mov esi, dword [edx + 0x14]
jmp 0x476cca
movzx esi, word [ebp + 4]
call fcn.0046d9e0
mov byte [esp + 0x20], al
test al, al
je 0x476b90
call fcn.00414e10
mov edx, dword [ebp + 8]
push 0
push edx
push 0
push eax
call fcn.004d47d0
add eax, 0xa
jmp 0x476b93
mov esi, 0x4e1a4c
cmp byte [esp + 0x20], 0
je 0x476cda
mov edx, 0x4e1a4c
mov ecx, edx
jmp 0x476cf7
mov ebp, dword [ebp + 0xc]
mov ecx, eax
imul ecx, ecx, 0x15
mov edx, dword [ecx + 0x5118d8]
mov ecx, dword [ebp + 4]
cmp word [ecx], 0
jne 0x476cf7
mov ecx, dword [ebp + 8]
mov ecx, dword [ecx + 0x18]
cmp eax, 9
jb 0x476d06
cmp eax, 0x20
mov eax, 0x506ef8
jbe 0x476d0b
mov eax, 0x4e1a4c
push esi
push edx
push ecx
push eax
push str.w_w_rw_rw_
call fcn.0049fc00
mov edx, edi
sub edx, dword [esp + 0x24]
add esp, 4
sar edx, 1
mov esi, ebx
push eax
sub esi, edx
call fcn.004a71f0
add esp, 0x14
lea edi, [edi + eax*2]
jmp 0x476ed5
cmp eax, 0x6a
jne 0x476d97
mov ebp, dword [ebp + 0xc]
mov eax, dword [ebp + 0x14]
cmp word [eax], 0
jne 0x476d56
mov ecx, dword [ebp + 0x18]
test ecx, ecx
je 0x476d56
mov ecx, dword [ecx + 0x18]
jmp 0x476d58
mov ecx, eax
mov eax, dword [ebp + 4]
cmp word [eax], 0
jne 0x476d67
mov eax, dword [ebp + 8]
mov eax, dword [eax + 0x18]
mov edx, dword [ebp + 0x24]
push edx
push ecx
push eax
push 0x506f28
call fcn.0049fc00
add esp, 4
push eax
mov eax, edi
sub eax, dword [esp + 0x20]
mov esi, ebx
sar eax, 1
sub esi, eax
call fcn.004a71f0
add esp, 0x10
lea edi, [edi + eax*2]
jmp 0x476ed5
mov ecx, 0xe2
cmp ax, cx
je 0x476dab
mov edx, 0xe3
cmp ax, dx
jne 0x476e25
cmp dword [ebp + 0x10], 0
je 0x476dfa
mov ecx, 0xe3
cmp ax, cx
mov ecx, 0x4e7bbc
je 0x476dc5
mov ecx, 0x4e1a4c
mov edx, dword [ebp + 0xc]
push ecx
mov ecx, dword [edx + 4]
mov edx, eax
imul edx, edx, 0x15
mov eax, dword [edx + 0x5118d8]
push ecx
mov ecx, edi
sub ecx, dword [esp + 0x18]
push eax
sar ecx, 1
mov esi, ebx
push str._s__s_s
sub esi, ecx
call fcn.004a71f0
add esp, 0x10
lea edi, [edi + eax*2]
jmp 0x476ed5
mov edx, 0xe3
cmp ax, dx
jne 0x476e25
mov eax, edi
sub eax, dword [esp + 0x10]
mov esi, ebx
sar eax, 1
push str.Default:
sub esi, eax
call fcn.004a71f0
add esp, 4
lea edi, [edi + eax*2]
jmp 0x476ed5
cmp byte [esp + 0x20], 0
je 0x476e31
movzx eax, word [esp + 0x18]
movzx ecx, ax
imul ecx, ecx, 0x15
mov edx, dword [ecx + 0x5118d8]
mov eax, edi
sub eax, dword [esp + 0x10]
push edx
sar eax, 1
mov esi, ebx
push 0x506f7c
sub esi, eax
call fcn.004a71f0
xor ebx, ebx
add esp, 8
lea edi, [edi + eax*2]
cmp byte [ebp + 2], bl
jbe 0x476ed1
mov dword [esp + 0x14], ebx
cmp byte [esp + 0x20], 0
je 0x476e84
movzx edx, word [esp + 0x18]
movzx ecx, bl
xor ecx, edx
xor ecx, 0xf0
push ecx
push 0x506f84
jmp 0x476eaa
mov eax, dword [ebp + 0xc]
add eax, dword [esp + 0x14]
cmp byte [eax], 0
je 0x476ea1
mov ecx, dword [eax + 4]
cmp word [ecx], 0
jne 0x476ea1
mov edx, dword [eax + 8]
mov eax, dword [edx + 0x18]
jmp 0x476ea4
mov eax, dword [eax + 4]
push eax
push 0x506f8c
mov esi, dword [esp + 0x2c]
mov eax, edi
sub eax, dword [esp + 0x18]
sar eax, 1
sub esi, eax
call fcn.004a71f0
movzx ecx, byte [ebp + 2]
add dword [esp + 0x1c], 0x10
inc ebx
add esp, 8
lea edi, [edi + eax*2]
cmp ebx, ecx
jl 0x476e65
mov ebx, dword [esp + 0x24]
mov eax, dword [esp + 0x2c]
test eax, eax
je 0x476f9c
cmp byte [esp + 0x30], 0
jne 0x476f9c
mov dword [esp + 0x30], eax
fild dword [esp + 0x30]
test eax, eax
jns 0x476efe
fadd dword [0x50a0a0]
fdiv qword [0x50a098]
mov ebp, dword [esp + 0x10]
mov edx, edi
sub edx, ebp
sub esp, 8
sar edx, 1
mov esi, ebx
sub esi, edx
fstp qword [esp]
push str.___0.2f_
call fcn.004a71f0
add esp, 0xc
lea edi, [edi + eax*2]
jmp 0x476fa0
mov cl, byte [ebp + 2]
cmp cl, 2
jbe 0x476f3a
mov edx, dword [ebp + 0xc]
mov esi, dword [edx + 0x24]
jmp 0x476f3f
mov esi, 0x4e1a4c
cmp cl, 1
jbe 0x476f4c
mov ecx, dword [ebp + 0xc]
mov edx, dword [ecx + 0x14]
jmp 0x476f51
mov edx, 0x4e1a4c
mov ebp, dword [ebp + 0xc]
mov ecx, dword [ebp + 4]
cmp word [ecx], 0
jne 0x476f63
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 + 0x5118d8]
push eax
push ecx
push str._4rw_rw_rw_r3_6rw_
call fcn.0049fc00
mov ecx, edi
sub ecx, dword [esp + 0x24]
add esp, 4
sar ecx, 1
mov esi, ebx
push eax
sub esi, ecx
call fcn.004a71f0
add esp, 0x14
lea edi, [edi + eax*2]
jmp 0x476ed5
mov ebp, dword [esp + 0x10]
cmp byte [esp + 0x28], 0
je 0x476fb2
mov eax, 0xd
mov word [edi], ax
add edi, 2
cmp byte [esp + 0x20], 0
mov dword [edi], 0xa
je 0x476fd1
xor eax, eax
mov word [ebp], ax
mov eax, ebp
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