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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x6bc
mov eax, dword [0x1008f3a0]
xor eax, esp
mov dword [esp + 0x6b8], eax
push ebx
push esi
push edi
xor eax, eax
mov ebx, ecx
mov ecx, dword [ebx + 0x4768]
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], eax
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], eax
mov esi, edx
mov dl, byte [ebx + 0x4770]
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
lea eax, [esi + 8]
mov dword [esp + 0x1c], eax
mov dword [esp + 0x54], eax
mov eax, dword [ebx + 0x476c]
mov dword [esp + 0x5c], eax
mov dword [esp + 0x58], ecx
lea eax, [ebx + 0x4771]
lea ecx, [ebx + 0x4777]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x2c], esi
mov byte [esp + 0x60], dl
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], ecx
call fcn.1003af10
mov eax, dword [esi + 0xc]
mov edx, dword [eax + 8]
mov esi, dword [esi]
lea edi, [eax + 0x2c]
movzx eax, word [edi + 0xc]
push eax
mov dword [esp + 0x24], edi
mov dword [esp + 0x2c], edx
mov dword [esp + 0x1c], esi
call dword [sym.imp.WS2_32.dll_ntohs]
movzx eax, ax
cmp ax, 0x806
jne 0x100402f6
cmp byte [ebx + 0x18d], 0
je 0x10040360
cmp esi, 2
jne 0x10040360
push 1
call sub.WS2_32.dll_htons
cmp ax, word [edi + 0x14]
jne 0x10040360
mov esi, dword [edi + 0x26]
test esi, esi
je 0x10040360
mov eax, dword [ebx + 0x476c]
call fcn.10048650
push esi
mov dword [esp + 0x1c], eax
call dword [sym.imp.WS2_32.dll_htonl]
mov ecx, dword [esp + 0x18]
cmp eax, ecx
jne 0x10040360
mov eax, dword [ebx + 0x476c]
add eax, 0x5c
je 0x10040360
mov ebx, eax
lea esi, [esp + 0x74]
call fcn.100494d0
xor eax, eax
push 0x616
push eax
lea ecx, [esp + 0xb0]
push ecx
mov dword [esp + 0xac], eax
mov dword [esp + 0xb0], eax
call fcn.1005a450
add esp, 0xc
push 0x2a
mov eax, esi
push eax
lea ecx, [esp + 0xdc]
lea edx, [esp + 0xb0]
push ecx
mov dword [esp + 0xb0], edx
call fcn.1005a4d0
mov eax, dword [esp + 0x20]
mov esi, dword [eax + 0x476c]
add esp, 0xc
lea edx, [esp + 0xa0]
push edx
mov dword [esp + 0xb8], 0x2a
mov ebx, dword [esi + 0x68]
xor ecx, ecx
mov edx, edi
add edx, 6
push eax
lea esi, [ecx + 2]
call fcn.1003c2a0
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x6b8]
xor ecx, esp
call fcn.1005574a
mov esp, ebp
pop ebp
ret
cmp ax, 0x800
jne 0x10040360
add edi, 0xe
cmp esi, 2
mov dword [esp + 0x10], 0
jne 0x10040316
mov dword [esp + 0x10], 1
jmp 0x1004032e
cmp esi, 4
jne 0x10040325
mov dword [esp + 0x10], 2
jmp 0x1004032e
cmp esi, 3
jne 0x1004032e
mov dword [esp + 0x10], esi
mov esi, edi
call fcn.100437b0
test eax, eax
mov dword [esp + 0x24], eax
jne 0x10040391
mov edi, dword [esp + 0x10]
push ebx
mov ebx, dword [esp + 0x1c]
xor esi, esi
lea edx, [esp + 0x58]
call fcn.1003faf0
mov esi, eax
cmp esi, 1
je 0x1004053e
mov ebx, dword [esp + 0x14]
cmp dword [esp + 0x28], 1
mov edx, dword [esp + 0x1c]
lea ecx, [ebx + 0x198]
jne 0x10040539
call fcn.10046c40
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x6b8]
xor ecx, esp
call fcn.1005574a
mov esp, ebp
pop ebp
ret
cmp eax, 1
jne 0x1004047c
cmp dword [esp + 0x10], 0
je 0x10040360
lea esi, [esp + 0x30]
call fcn.10043e30
mov edi, dword [esp + 0x10]
xor eax, eax
push ebx
mov ebx, dword [esp + 0x1c]
lea esi, [esp + 0x78]
lea edx, [esp + 0x58]
mov byte [esp + 0x78], 0
mov dword [esp + 0x7c], eax
mov dword [esp + 0x80], eax
mov dword [esp + 0x84], eax
mov dword [esp + 0x88], eax
mov dword [esp + 0x8c], eax
mov dword [esp + 0x90], eax
call fcn.1003faf0
cmp byte [esp + 0x74], 0
mov esi, eax
je 0x10040353
mov edi, dword [esp + 0x14]
push 0
push 1
xor edx, edx
mov eax, edi
call fcn.1003fba0
mov eax, dword [esp + 0x78]
push eax
call dword [sym.imp.WS2_32.dll_htonl]
mov ecx, dword [esp + 0x8a]
mov dx, word [esp + 0x8e]
mov dword [esp + 0x48], ecx
mov cx, word [esp + 0x88]
mov word [esp + 0x4c], dx
mov edx, dword [esp + 0x80]
mov word [esp + 0x52], cx
mov dword [esp + 0x3c], eax
mov eax, dword [esp + 0x84]
mov dword [esp + 0x44], edx
mov edx, dword [esp + 0x10]
lea ecx, [esp + 0x3c]
push ecx
mov dword [esp + 0x52], eax
mov eax, dword [esp + 0x80]
push edx
lea ecx, [edi + 0x68]
lea edx, [esp + 0x38]
mov dword [esp + 0x48], eax
call fcn.10049950
jmp 0x10040353
cmp eax, 2
je 0x1004048a
cmp eax, 3
jne 0x10040360
cmp dword [esp + 0x10], 0
je 0x10040360
lea esi, [esp + 0x30]
call fcn.10043e30
add ebx, 0x68
mov eax, esi
mov esi, dword [esp + 0x10]
push ebx
mov dword [esp + 0x1c], ebx
lea ebx, [esp + 0x40]
mov ecx, esi
call fcn.10049880
test al, al
je 0x1004035c
mov eax, dword [esp + 0x14]
push 0
push 2
xor edx, edx
call fcn.1003fba0
mov ebx, dword [esp + 0x3c]
push esi
mov esi, edi
call fcn.100439b0
mov eax, dword [esp + 0x24]
movzx edx, word [esp + 0x50]
mov ecx, dword [esp + 0x4c]
mov dword [eax], ecx
mov ecx, dword [esp + 0x52]
mov word [eax + 4], dx
movzx edx, word [esp + 0x56]
mov dword [eax + 6], ecx
mov word [eax + 0xa], dx
mov eax, dword [esp + 0x30]
mov ecx, dword [eax + 0xc]
mov edx, dword [esp + 0x48]
mov eax, dword [esp + 0x44]
mov dword [ecx + 8], edx
mov ecx, dword [esp + 0x20]
add esp, 4
cmp dword [esp + 0x24], 3
mov dword [ecx], eax
jne 0x1004035c
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x18]
lea eax, [esp + 0x30]
call fcn.10049ad0
jmp 0x1004035c
call fcn.10046b50
mov ecx, dword [esp + 0x6c4]
pop edi
pop esi
pop ebx
xor ecx, esp
xor eax, eax
call fcn.1005574a
mov esp, ebp
pop ebp
ret