Function at 0x541830
Capabilities:
Resolve function by parsing pe exports
Write file on windows

Disassembly:
sub esp, 0x38
mov eax, dword [0x70a308]
xor eax, esp
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x3c]
mov edx, dword [esp + 0x5c]
push ebx
mov ebx, dword [esp + 0x58]
push ebp
push esi
mov esi, ecx
mov ecx, dword [esp + 0x4c]
push edi
xor edi, edi
mov dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x68]
mov dword [ecx], edi
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x70]
mov dword [edx], edi
mov dword [eax], edi
mov dword [eax + 4], edi
mov ebp, dword [ebx]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x28], ecx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x38], eax
mov dword [esp + 0x10], edi
mov dword [esp + 0x18], edi
cmp ebp, edi
je 0x541d53
cmp byte [esi + 0x65], 0
je 0x541aa1
jmp 0x5418a0
cmp byte [esi + 0x65], 1
jne 0x54194f
xor eax, eax
mov dword [esi + 0x78], eax
mov dword [esi + 0x7c], eax
movsx eax, byte [esi + 0x66]
mov ebx, 4
sub ebx, eax
cmp ebx, ebp
jb 0x5418c3
mov ebx, ebp
mov edx, dword [esp + 0x1c]
mov edi, dword [esp + 0x10]
push ebx
add edx, edi
push edx
lea eax, [eax + esi + 0x68]
push eax
call fcn.005fa190
add byte [esi + 0x66], bl
mov eax, dword [esp + 0x38]
add dword [eax], ebx
mov eax, dword [esp + 0x20]
sub dword [eax], ebx
add edi, ebx
add esp, 0xc
sub ebp, ebx
cmp byte [esi + 0x66], 4
mov dword [esp + 0x10], edi
jne 0x541d53
mov eax, dword [esi + 0x68]
push eax
call dword [sym.imp.WS2_32.dll_ntohl]
cdq
mov dword [esi + 0x78], eax
mov dword [esi + 0x7c], edx
mov ecx, edx
cmp eax, 1
jne 0x54191f
test ecx, ecx
jne 0x54191f
mov byte [esi + 0x64], 0xc
jmp 0x541943
sub eax, 8
mov edx, 0
sbb ecx, edx
cmp ecx, edx
mov byte [esi + 0x64], 4
mov dword [esi + 0x78], eax
mov dword [esi + 0x7c], ecx
jg 0x541943
jl 0x54193d
cmp eax, edx
jae 0x541943
mov dword [esi + 0x78], edx
mov dword [esi + 0x7c], edx
mov ebx, dword [esp + 0x14]
mov byte [esi + 0x65], 2
mov byte [esi + 0x67], 0
cmp byte [esi + 0x65], 2
jne 0x541a24
movsx eax, byte [esi + 0x67]
movsx ebx, byte [esi + 0x64]
sub ebx, eax
cmp ebx, ebp
jb 0x541969
mov ebx, ebp
mov ecx, dword [esp + 0x1c]
mov edi, dword [esp + 0x10]
push ebx
add ecx, edi
push ecx
lea edx, [eax + esi + 0x6c]
push edx
call fcn.005fa190
add byte [esi + 0x67], bl
mov eax, dword [esp + 0x38]
add dword [eax], ebx
mov eax, dword [esp + 0x20]
sub dword [eax], ebx
mov al, byte [esi + 0x64]
add edi, ebx
add esp, 0xc
sub ebp, ebx
mov dword [esp + 0x10], edi
cmp al, byte [esi + 0x67]
jne 0x541d53
mov ecx, dword [esi + 0x6c]
mov dword [esp + 0x3c], ecx
mov byte [esp + 0x40], 0
cmp al, 0xc
jne 0x5419e3
lea edx, [esi + 0x70]
push edx
call fcn.00540e40
add esp, 4
sub eax, 0x10
mov edi, 0
sbb edx, edi
cmp edx, edi
mov dword [esi + 0x78], eax
mov dword [esi + 0x7c], edx
jg 0x5419e5
jl 0x5419db
cmp eax, edi
jae 0x5419e5
mov dword [esi + 0x78], edi
mov dword [esi + 0x7c], edi
jmp 0x5419e5
xor edi, edi
mov ecx, str.mdat
lea eax, [esp + 0x3c]
mov edi, edi
mov dl, byte [eax]
cmp dl, byte [ecx]
jne 0x541a10
test dl, dl
je 0x541a0c
mov dl, byte [eax + 1]
cmp dl, byte [ecx + 1]
jne 0x541a10
add eax, 2
add ecx, 2
test dl, dl
jne 0x5419f0
xor eax, eax
jmp 0x541a15
sbb eax, eax
sbb eax, 0xffffffff
cmp eax, edi
je 0x541a76
mov ebx, dword [esp + 0x14]
mov byte [esi + 0x65], 3
mov dword [esi + 0x60], edi
cmp byte [esi + 0x65], 3
jne 0x5418a0
mov ecx, dword [esi + 0x60]
mov eax, dword [esi + 0x78]
sub eax, ecx
cmp eax, ebp
jb 0x541a3c
mov eax, ebp
add dword [esp + 0x10], eax
add ecx, eax
mov dword [esi + 0x60], ecx
sub dword [ebx], eax
mov ecx, dword [esp + 0x2c]
add dword [ecx], eax
mov edx, dword [esi + 0x78]
sub ebp, eax
mov eax, dword [esi + 0x60]
xor ecx, ecx
cmp edx, eax
jne 0x541d53
mov eax, dword [esi + 0x7c]
cmp eax, ecx
jne 0x541d53
mov byte [esi + 0x65], 1
mov byte [esi + 0x66], cl
jmp 0x5418a0
mov eax, dword [esi + 0x78]
mov ecx, dword [esi + 0x7c]
mov edx, eax
or edx, ecx
je 0x541a99
mov edx, dword [esp + 0x38]
mov dword [edx], eax
mov dword [edx + 4], ecx
mov eax, dword [esi + 0x78]
mov ecx, dword [esi + 0x7c]
mov dword [esp + 0x54], eax
mov dword [esp + 0x58], ecx
mov ebx, dword [esp + 0x14]
mov byte [esi + 0x65], 0
mov edx, dword [esp + 0x28]
mov edx, dword [edx]
mov ecx, dword [esp + 0x54]
mov eax, dword [esp + 0x58]
xor edi, edi
sub ecx, edx
sbb eax, edi
sub ecx, dword [esp + 0x5c]
sbb eax, dword [esp + 0x60]
cmp eax, edi
jg 0x541ad9
jl 0x541ac7
cmp ecx, ebp
jae 0x541ad9
mov eax, dword [esp + 0x54]
sub eax, edx
sub eax, dword [esp + 0x5c]
mov ecx, eax
sub ecx, ebp
add dword [ebx], ecx
mov ebp, eax
cmp byte [esi + 0x5d], 0
je 0x541c28
mov eax, dword [esi + 0x40]
mov edi, 0xb
sub edi, eax
mov dword [esp + 0x30], eax
cmp edi, ebp
jb 0x541af7
mov edi, ebp
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x1c]
mov ecx, dword [esi + 0x40]
add edx, eax
push edi
push edx
lea edx, [ecx + esi + 0x1c]
push edx
call fcn.005fa190
add dword [esi + 0x40], edi
mov eax, dword [esi + 0x40]
add dword [esp + 0x1c], edi
add esp, 0xc
sub ebp, edi
cmp eax, 0xb
jne 0x541d51
movzx ecx, byte [esi + 0x1f]
mov edi, dword [sym.imp.WS2_32.dll_ntohl]
xor eax, eax
mov word [esp + 0x21], ax
mov byte [esp + 0x23], al
movzx eax, word [esi + 0x1d]
mov word [esp + 0x21], ax
mov byte [esp + 0x23], cl
mov byte [esp + 0x20], 0
mov edx, dword [esp + 0x20]
push edx
mov byte [esi + 0x5d], 0
mov dword [esi + 0x40], 0
call edi
movzx ecx, byte [esi + 0x22]
mov dword [esi + 0x54], eax
xor eax, eax
mov word [esp + 0x25], ax
mov byte [esp + 0x27], al
movzx eax, word [esi + 0x20]
lea ebx, [esi + 0x20]
mov word [esp + 0x25], ax
mov byte [esp + 0x27], cl
mov byte [esp + 0x24], 0
mov edx, dword [esp + 0x24]
push edx
call edi
mov ecx, dword [esi + 0x58]
mov edi, eax
movsx eax, byte [esi + 0x23]
shl eax, 0x18
or edi, eax
mov eax, dword [esi + 0x4c]
add ecx, edi
cmp ecx, eax
jae 0x541bb1
sub eax, edi
mov byte [esi + 0x5c], 1
mov dword [esi + 0x58], eax
jmp 0x541bc8
cmp eax, edi
ja 0x541bc0
mov byte [esi + 0x5c], 0
mov dword [esi + 0x58], 0
mov edx, dword [esi + 0x58]
add edx, edi
mov dword [esi + 0x4c], edx
cmp byte [esi + 0x5c], 0
je 0x541be9
mov eax, dword [esi + 0x58]
add eax, edi
push eax
push ebx
call fcn.00540e80
mov ecx, dword [esi + 0x58]
add ebx, eax
add ecx, edi
add esp, 8
shr ecx, 0x18
mov byte [ebx], cl
mov ecx, dword [esp + 0x34]
push 0
lea edx, [esp + 0x1c]
push edx
push 0xb
lea eax, [esi + 0x1c]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x541d3a
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x28]
add dword [ecx], eax
mov edx, dword [esp + 0x30]
mov ecx, dword [esp + 0x14]
add dword [ecx], edx
cmp eax, 0xb
jne 0x541d3a
mov ebx, ecx
cmp byte [esi + 0x5e], 0
jne 0x541c92
mov edi, dword [esi + 0x54]
sub edi, dword [esi + 0x50]
cmp edi, ebp
jb 0x541c3a
mov edi, ebp
mov edx, dword [esp + 0x10]
mov ecx, dword [esp + 0x1c]
push 0
lea eax, [esp + 0x1c]
push eax
mov eax, dword [esp + 0x3c]
push edi
add ecx, edx
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x541d3a
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x28]
add dword [ecx], eax
cmp edi, eax
jne 0x541d3a
add dword [esi + 0x50], edi
mov eax, dword [esi + 0x50]
add dword [esp + 0x10], edi
sub ebp, edi
cmp dword [esi + 0x54], eax
jne 0x541d53
mov byte [esi + 0x5e], 1
mov dword [esi + 0x50], 0
mov eax, dword [esi + 0x44]
mov edi, 4
sub edi, eax
mov dword [esp + 0x30], eax
cmp edi, ebp
jb 0x541ca6
mov edi, ebp
mov edx, dword [esp + 0x10]
mov ecx, dword [esp + 0x1c]
mov eax, dword [esi + 0x44]
add ecx, edx
push edi
push ecx
lea ecx, [eax + esi + 0x27]
push ecx
call fcn.005fa190
add dword [esi + 0x44], edi
mov eax, dword [esi + 0x44]
add dword [esp + 0x1c], edi
add esp, 0xc
sub ebp, edi
cmp eax, 4
jne 0x541d51
mov eax, dword [esi + 0x27]
lea edi, [esi + 0x27]
push eax
mov byte [esi + 0x5e], 0
mov byte [esi + 0x5d], 1
mov dword [esi + 0x44], 0
call dword [sym.imp.WS2_32.dll_ntohl]
mov ecx, dword [esi + 0x54]
add ecx, 0xb
cmp ecx, eax
je 0x541d02
push ecx
call dword [sym.imp.WS2_32.dll_htonl]
mov dword [edi], eax
mov eax, dword [esp + 0x34]
push 0
lea edx, [esp + 0x1c]
push edx
push 4
push edi
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x541d3a
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x28]
add dword [ecx], eax
mov ecx, dword [esp + 0x30]
add dword [ebx], ecx
cmp eax, 4
jne 0x541d3a
test ebp, ebp
jne 0x541891
jmp 0x541d53
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x34]
xor ecx, esp
call fcn.005f85e7
add esp, 0x38
ret 0x28
sub dword [ebx], edi
mov ecx, dword [esp + 0x44]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
mov eax, 1
call fcn.005f85e7
add esp, 0x38
ret 0x28