Function at 0x52d370
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x1c
mov eax, dword [esp + 0x3c]
mov edx, dword [esp + 0x40]
push ebx
push ebp
mov ebp, ecx
push esi
xor ecx, ecx
push edi
mov dword [eax], ecx
mov eax, dword [esp + 0x54]
mov dword [edx], ecx
mov dword [esp + 0x10], ecx
mov dword [eax], ecx
mov dword [eax + 4], ecx
mov eax, dword [esp + 0x48]
mov dword [esp + 0x14], ecx
mov ebx, dword [eax]
cmp ebx, ecx
je 0x52d8e6
mov al, byte [ebp + 0x65]
test al, al
je 0x52d5f1
cmp byte [ebp + 0x65], 1
jne 0x52d478
movsx edx, byte [ebp + 0x66]
xor eax, eax
mov dword [ebp + 0x78], eax
mov dword [ebp + 0x7c], eax
mov eax, 4
sub eax, edx
cmp eax, ebx
jb 0x52d3d4
mov eax, ebx
mov esi, dword [esp + 0x34]
mov edi, dword [esp + 0x10]
mov ecx, eax
add esi, edi
lea edi, [edx + ebp + 0x68]
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
sub ebx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x10]
mov dl, byte [ebp + 0x66]
add ecx, eax
add dl, al
mov dword [esp + 0x10], ecx
mov ecx, dword [esp + 0x50]
mov byte [ebp + 0x66], dl
mov esi, dword [ecx]
add esi, eax
mov dword [ecx], esi
mov ecx, dword [esp + 0x48]
mov edx, dword [ecx]
sub edx, eax
mov dword [ecx], edx
mov al, byte [ebp + 0x66]
cmp al, 4
jne 0x52d8e6
mov eax, dword [ebp + 0x68]
push eax
call sub.WS2_32.dll_ntohl
cdq
mov dword [ebp + 0x78], eax
mov dword [ebp + 0x7c], edx
mov eax, dword [ebp + 0x78]
mov ecx, edx
cmp eax, 1
jne 0x52d449
test ecx, ecx
jne 0x52d449
mov byte [ebp + 0x64], 0xc
jmp 0x52d470
sub eax, 8
mov edx, 0
sbb ecx, edx
mov dword [ebp + 0x78], eax
mov eax, ecx
mov byte [ebp + 0x64], 4
cmp eax, edx
mov dword [ebp + 0x7c], ecx
jg 0x52d470
jl 0x52d46a
cmp dword [ebp + 0x78], edx
jae 0x52d470
mov dword [ebp + 0x78], edx
mov dword [ebp + 0x7c], edx
mov byte [ebp + 0x65], 2
mov byte [ebp + 0x67], 0
cmp byte [ebp + 0x65], 2
jne 0x52d566
movsx edx, byte [ebp + 0x67]
movsx eax, byte [ebp + 0x64]
sub eax, edx
cmp eax, ebx
jb 0x52d492
mov eax, ebx
mov esi, dword [esp + 0x34]
mov edi, dword [esp + 0x10]
mov ecx, eax
add esi, edi
lea edi, [edx + ebp + 0x6c]
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
sub ebx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [esp + 0x10]
mov dl, byte [ebp + 0x67]
add ecx, eax
add dl, al
mov dword [esp + 0x10], ecx
mov ecx, dword [esp + 0x50]
mov byte [ebp + 0x67], dl
mov esi, dword [ecx]
add esi, eax
mov dword [ecx], esi
mov ecx, dword [esp + 0x48]
mov edx, dword [ecx]
sub edx, eax
mov dword [ecx], edx
mov al, byte [ebp + 0x64]
cmp al, byte [ebp + 0x67]
jne 0x52d8e6
mov ecx, dword [ebp + 0x6c]
cmp al, 0xc
mov dword [esp + 0x24], ecx
mov byte [esp + 0x28], 0
jne 0x52d525
lea edx, [ebp + 0x70]
push edx
call fcn.00529090
mov ecx, eax
add esp, 4
sub ecx, 0x10
mov eax, 0
sbb edx, eax
mov dword [ebp + 0x78], ecx
mov ecx, edx
mov dword [ebp + 0x7c], edx
cmp ecx, eax
jg 0x52d525
jl 0x52d51f
cmp dword [ebp + 0x78], eax
jae 0x52d525
mov dword [ebp + 0x78], eax
mov dword [ebp + 0x7c], eax
mov esi, str.mdat
lea eax, [esp + 0x24]
mov dl, byte [eax]
mov cl, dl
cmp dl, byte [esi]
jne 0x52d552
test cl, cl
je 0x52d54e
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x52d552
add eax, 2
add esi, 2
test cl, cl
jne 0x52d52e
xor eax, eax
jmp 0x52d557
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x52d5ca
mov byte [ebp + 0x65], 3
mov dword [ebp + 0x60], 0
cmp byte [ebp + 0x65], 3
jne 0x52d3b1
mov ecx, dword [ebp + 0x60]
mov eax, dword [ebp + 0x78]
sub eax, ecx
cmp eax, ebx
jb 0x52d57e
mov eax, ebx
add ecx, eax
mov edi, dword [esp + 0x10]
mov dword [ebp + 0x60], ecx
mov ecx, dword [esp + 0x48]
add edi, eax
sub ebx, eax
mov edx, dword [ecx]
mov dword [esp + 0x10], edi
sub edx, eax
mov dword [ecx], edx
mov ecx, dword [esp + 0x50]
mov edi, dword [ecx]
add edi, eax
mov dword [ecx], edi
mov eax, dword [ebp + 0x60]
mov edx, dword [ebp + 0x78]
xor ecx, ecx
cmp edx, eax
jne 0x52d8e6
mov eax, dword [ebp + 0x7c]
cmp eax, ecx
jne 0x52d8e6
mov byte [ebp + 0x65], 1
mov byte [ebp + 0x66], cl
jmp 0x52d3b1
mov eax, dword [ebp + 0x78]
mov ecx, dword [ebp + 0x7c]
mov edx, eax
or edx, ecx
je 0x52d5ed
mov edx, dword [esp + 0x54]
mov dword [edx], eax
mov dword [edx + 4], ecx
mov eax, dword [ebp + 0x78]
mov ecx, dword [ebp + 0x7c]
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], ecx
mov byte [ebp + 0x65], 0
mov edx, dword [esp + 0x4c]
mov ecx, dword [esp + 0x38]
mov eax, dword [esp + 0x3c]
mov edi, dword [esp + 0x40]
mov edx, dword [edx]
xor esi, esi
sub ecx, edx
sbb eax, esi
mov esi, dword [esp + 0x44]
sub ecx, edi
sbb eax, esi
xor esi, esi
cmp eax, esi
jg 0x52d635
jl 0x52d61d
cmp ecx, ebx
jae 0x52d635
mov eax, dword [esp + 0x38]
mov ecx, dword [esp + 0x48]
sub eax, edx
mov esi, dword [ecx]
sub eax, edi
mov edx, eax
sub edx, ebx
mov ebx, eax
add esi, edx
mov dword [ecx], esi
mov al, byte [ebp + 0x5d]
test al, al
je 0x52d787
mov ecx, dword [ebp + 0x40]
mov eax, 0xb
sub eax, ecx
mov dword [esp + 0x20], ecx
cmp eax, ebx
jb 0x52d654
mov eax, ebx
mov edx, dword [esp + 0x34]
mov esi, dword [esp + 0x10]
add esi, edx
mov edx, dword [ebp + 0x40]
mov ecx, eax
sub ebx, eax
lea edi, [edx + ebp + 0x1c]
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 0x40]
mov edi, dword [esp + 0x10]
add ecx, eax
add edi, eax
cmp ecx, 0xb
mov dword [ebp + 0x40], ecx
mov dword [esp + 0x10], edi
jne 0x52d8e0
lea ecx, [ebp + 0x1d]
xor eax, eax
mov word [esp + 0x19], ax
mov byte [esp + 0x18], 0
mov dx, word [ecx]
mov byte [esp + 0x1b], al
mov word [esp + 0x19], dx
mov byte [ebp + 0x5d], 0
mov al, byte [ecx + 2]
mov dword [ebp + 0x40], 0
mov byte [esp + 0x1b], al
mov ecx, dword [esp + 0x18]
push ecx
call sub.WS2_32.dll_ntohl
lea edi, [ebp + 0x20]
mov dword [ebp + 0x54], eax
mov eax, edi
xor edx, edx
mov word [esp + 0x1d], dx
mov byte [esp + 0x1c], 0
mov cx, word [eax]
mov byte [esp + 0x1f], dl
mov word [esp + 0x1d], cx
mov dl, byte [eax + 2]
mov byte [esp + 0x1f], dl
mov eax, dword [esp + 0x1c]
push eax
call sub.WS2_32.dll_ntohl
movsx ecx, byte [ebp + 0x23]
mov edx, dword [ebp + 0x58]
mov esi, eax
mov eax, dword [ebp + 0x4c]
shl ecx, 0x18
or esi, ecx
lea ecx, [edx + esi]
cmp ecx, eax
jae 0x52d71d
sub eax, esi
mov byte [ebp + 0x5c], 1
mov dword [ebp + 0x58], eax
jmp 0x52d720
mov dword [ebp + 0x4c], ecx
mov al, byte [ebp + 0x5c]
test al, al
je 0x52d742
mov eax, dword [ebp + 0x58]
add eax, esi
push eax
push edi
call fcn.00529220
mov ecx, dword [ebp + 0x58]
add esp, 8
add ecx, esi
add edi, eax
shr ecx, 0x18
mov byte [edi], cl
mov ecx, dword [esp + 0x30]
lea edx, [esp + 0x14]
push 0
push edx
lea eax, [ebp + 0x1c]
push 0xb
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x52d8d4
mov ecx, dword [esp + 0x4c]
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x20]
mov edi, dword [ecx]
add edi, eax
mov dword [ecx], edi
mov ecx, dword [esp + 0x48]
mov esi, dword [ecx]
add esi, edx
cmp eax, 0xb
mov dword [ecx], esi
jne 0x52d8d4
mov al, byte [ebp + 0x5e]
test al, al
jne 0x52d804
mov esi, dword [ebp + 0x54]
mov ecx, dword [ebp + 0x50]
sub esi, ecx
cmp esi, ebx
jb 0x52d79c
mov esi, ebx
mov ecx, dword [esp + 0x34]
mov edx, dword [esp + 0x10]
lea eax, [esp + 0x14]
push 0
push eax
mov eax, dword [esp + 0x38]
add edx, ecx
push esi
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x52d8d4
mov ecx, dword [esp + 0x4c]
mov eax, dword [esp + 0x14]
mov edx, dword [ecx]
add edx, eax
cmp esi, eax
mov dword [ecx], edx
jne 0x52d8d4
mov eax, dword [esp + 0x10]
mov edi, dword [ebp + 0x50]
mov ecx, dword [ebp + 0x54]
add eax, esi
add edi, esi
mov dword [esp + 0x10], eax
mov eax, edi
sub ebx, esi
cmp ecx, eax
mov dword [ebp + 0x50], edi
jne 0x52d8e6
mov byte [ebp + 0x5e], 1
mov dword [ebp + 0x50], 0
mov ecx, dword [ebp + 0x44]
mov eax, 4
sub eax, ecx
mov dword [esp + 0x20], ecx
cmp eax, ebx
jb 0x52d818
mov eax, ebx
mov edx, dword [esp + 0x10]
mov esi, dword [esp + 0x34]
add esi, edx
mov edx, dword [ebp + 0x44]
mov ecx, eax
sub ebx, eax
lea edi, [edx + ebp + 0x27]
mov edx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 0x44]
mov edi, dword [esp + 0x10]
add ecx, eax
add edi, eax
cmp ecx, 4
mov dword [ebp + 0x44], ecx
mov dword [esp + 0x10], edi
jne 0x52d8e0
mov eax, dword [ebp + 0x27]
lea esi, [ebp + 0x27]
push eax
mov byte [ebp + 0x5e], 0
mov byte [ebp + 0x5d], 1
mov dword [ebp + 0x44], 0
call sub.WS2_32.dll_ntohl
mov ecx, dword [ebp + 0x54]
add ecx, 0xb
cmp ecx, eax
je 0x52d883
push ecx
call sub.WS2_32.dll_htonl
mov dword [esi], eax
mov ecx, dword [esp + 0x30]
lea eax, [esp + 0x14]
push 0
push eax
push 4
push esi
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x52d8d4
mov ecx, dword [esp + 0x4c]
mov eax, dword [esp + 0x14]
mov edx, dword [esp + 0x20]
mov edi, dword [ecx]
add edi, eax
mov dword [ecx], edi
mov ecx, dword [esp + 0x48]
mov esi, dword [ecx]
add esi, edx
cmp eax, 4
mov dword [ecx], esi
jne 0x52d8d4
test ebx, ebx
jne 0x52d3a6
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x1c
ret 0x28
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x1c
ret 0x28
mov ecx, dword [esp + 0x48]
sub dword [ecx], eax
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x1c
ret 0x28