Function at 0x511eb0
Capabilities:
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x78
mov edx, dword [esp + 0x7c]
xor eax, eax
mov dword [esp + 0x50], 0
mov dword [esp + 0x54], 0
mov dword [esp + 4], eax
mov dword [esp + 8], getpeername
test edx, edx
je 0x511ee8
cmp dword [esp + 0x88], eax
je 0x511ee8
cmp dword [edx + 0x20], 2
je 0x511ef1
mov eax, 6
add esp, 0x78
ret
mov ecx, dword [edx + 8]
push ebx
mov ebx, dword [edx]
push ebp
mov ebp, dword [edx + 4]
push esi
mov esi, dword [edx + 0x10]
push edi
mov edi, dword [edx + 0x14]
mov edx, dword [edx + 0xc]
lea eax, [esi + esi]
mov dword [esp + 0x4c], ebx
sub ecx, eax
mov dword [esp + 0x54], ebp
sub esi, ebx
mov dword [esp + 0x28], 5
add esi, esi
mov dword [esp + 0x2c], esi
lea eax, [ecx + ebx]
mov dword [esp + 0x80], esi
mov dword [esp + 0x68], eax
lea eax, [edi + edi]
sub edx, eax
sub edi, ebp
add edi, edi
mov dword [esp + 0x30], edi
mov dword [esp + 0x84], edi
lea eax, [edx + ebp]
mov dword [esp + 0x6c], eax
mov eax, dword [esp + 0x90]
shl eax, 0xa
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x94]
shl eax, 0xa
mov dword [esp + 0x38], eax
xor eax, eax
mov dword [esp + 0x24], eax
nop
mov ebp, eax
mov dword [esp + 0x20], 0
mov dword [esp + 0x10], ebp
nop
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x10]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x68]
mov edx, dword [esp + 0x1c]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x40], eax
mov esi, dword [esp + 0x40]
mov eax, dword [esp + 0x80]
mov edx, dword [esp + 0x10]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x6c]
mov edx, dword [esp + 0x1c]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x44], eax
mov edi, dword [esp + 0x44]
mov eax, dword [esp + 0x84]
mov edx, dword [esp + 0x10]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x50], eax
mov ebx, dword [esp + 0x48]
add ebx, esi
mov esi, dword [esp + 0x50]
add ebx, dword [esp + 0x4c]
add esi, edi
add esi, dword [esp + 0x54]
shl ebx, 0xa
mov eax, ebx
shl esi, 0xa
sub eax, dword [esp + 0x34]
mov dword [esp + 0x70], eax
mov eax, esi
sub eax, dword [esp + 0x38]
mov dword [esp + 0x74], eax
lea eax, [esp + 0x70]
push eax
call fcn.004b9aa0
add esp, 4
cmp eax, dword [esp + 0x18]
jge 0x5120a5
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], ebp
mov dword [esp + 0x60], ebx
mov dword [esp + 0x64], esi
lea esi, [ebp*2]
mov dword [esp + 0x1c], esi
mov eax, dword [esp + 0x68]
mov edx, dword [esp + 0x1c]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x58], eax
mov ebp, dword [esp + 0x58]
add ebp, dword [esp + 0x2c]
mov dword [esp + 0x1c], esi
mov eax, dword [esp + 0x6c]
mov edx, dword [esp + 0x1c]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x70]
cdq
mov edi, dword [esp + 0x5c]
and edx, 0x3ff
add edi, dword [esp + 0x30]
lea ebx, [edx + eax]
mov eax, dword [esp + 0x74]
cdq
and edx, 0x3ff
sar ebx, 0xa
mov dword [esp + 0x70], ebx
lea esi, [edx + eax]
mov eax, edi
imul eax, edi
sar esi, 0xa
mov dword [esp + 0x74], esi
cdq
and edx, 0x3f
lea ecx, [edx + eax]
mov eax, ebp
imul eax, ebp
sar ecx, 6
cdq
and edx, 0x3f
add eax, edx
sar eax, 6
add ecx, eax
mov eax, ebx
imul eax, dword [esp + 0x68]
imul ebx, ebp
add eax, eax
cdq
and edx, 0x3f
add eax, edx
sar eax, 6
add ecx, eax
mov eax, esi
imul eax, dword [esp + 0x6c]
imul esi, edi
add eax, eax
cdq
and edx, 0x3f
add eax, edx
sar eax, 6
add ecx, eax
mov eax, esi
cdq
and edx, 0x3f
push ecx
lea ecx, [edx + eax]
mov eax, ebx
cdq
and edx, 0x3f
sar ecx, 6
add eax, edx
sar eax, 6
add ecx, eax
push ecx
call fcn.004b52a0
mov ecx, dword [esp + 0x18]
add esp, 8
sub ecx, eax
mov dword [esp + 0x10], ecx
cmp ecx, 0x10000
ja 0x5121d1
mov ebp, dword [esp + 0x20]
inc ebp
mov dword [esp + 0x20], ebp
cmp bp, 4
mov ebp, ecx
jb 0x511f80
mov eax, dword [esp + 0x24]
add eax, 0x4000
sub dword [esp + 0x28], 1
mov dword [esp + 0x24], eax
jne 0x511f70
mov eax, dword [esp + 0x68]
mov edx, dword [esp + 0x14]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x5c]
mov ecx, dword [esp + 0x2c]
lea eax, [ecx + eax*2]
mov dword [esp + 0x78], eax
mov eax, dword [esp + 0x6c]
mov edx, dword [esp + 0x14]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x5c]
mov ecx, dword [esp + 0x30]
mov ebx, dword [esp + 0x34]
lea eax, [ecx + eax*2]
mov dword [esp + 0x7c], eax
mov eax, dword [esp + 0x60]
sub eax, ebx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x5c]
mov edx, dword [esp + 0x7c]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x58], eax
mov eax, dword [esp + 0x64]
mov ebp, dword [esp + 0x38]
sub eax, ebp
mov esi, dword [esp + 0x58]
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x5c]
mov edx, dword [esp + 0x78]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x54], eax
sub esi, dword [esp + 0x54]
mov edi, dword [esp + 0x98]
mov eax, dword [esp + 0x18]
sets cl
mov dword [edi], eax
mov eax, dword [esp + 0x14]
lea ecx, [ecx*2 - 1]
mov byte [edi + 8], cl
test eax, eax
je 0x5122fd
cmp eax, 0x10000
je 0x5122fd
mov dword [edi + 4], 0x10000
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x78
ret
sub dword [esp + 0x60], ebx
lea eax, [esp + 0x78]
sub dword [esp + 0x64], ebp
push eax
call fcn.004b9b20
lea eax, [esp + 0x64]
push eax
call fcn.004b9b20
add esp, 8
mov eax, dword [esp + 0x78]
mov edx, dword [esp + 0x64]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x5c], eax
mov esi, dword [esp + 0x5c]
mov eax, dword [esp + 0x7c]
mov edx, dword [esp + 0x60]
imul edx
mov ecx, edx
sar ecx, 0x1f
add ecx, 0x8000
add eax, ecx
adc edx, 0
shr eax, 0x10
shl edx, 0x10
add eax, edx
mov dword [esp + 0x58], eax
sub esi, dword [esp + 0x58]
xor eax, eax
mov dword [edi + 4], esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x78
ret