Function at 0x52d580
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 0x52db09
mov al, byte [ebp + 0x65]
test al, al
je 0x52d801
cmp byte [ebp + 0x65], 1
jne 0x52d688
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 0x52d5e4
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 0x52db09
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 0x52d659
test ecx, ecx
jne 0x52d659
mov byte [ebp + 0x64], 0xc
jmp 0x52d680
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 0x52d680
jl 0x52d67a
cmp dword [ebp + 0x78], edx
jae 0x52d680
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 0x52d776
movsx edx, byte [ebp + 0x67]
movsx eax, byte [ebp + 0x64]
sub eax, edx
cmp eax, ebx
jb 0x52d6a2
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 0x52db09
mov ecx, dword [ebp + 0x6c]
cmp al, 0xc
mov dword [esp + 0x24], ecx
mov byte [esp + 0x28], 0
jne 0x52d735
lea edx, [ebp + 0x70]
push edx
call fcn.005292a0
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 0x52d735
jl 0x52d72f
cmp dword [ebp + 0x78], eax
jae 0x52d735
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 0x52d762
test cl, cl
je 0x52d75e
mov dl, byte [eax + 1]
mov cl, dl
cmp dl, byte [esi + 1]
jne 0x52d762
add eax, 2
add esi, 2
test cl, cl
jne 0x52d73e
xor eax, eax
jmp 0x52d767
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
je 0x52d7da
mov byte [ebp + 0x65], 3
mov dword [ebp + 0x60], 0
cmp byte [ebp + 0x65], 3
jne 0x52d5c1
mov ecx, dword [ebp + 0x60]
mov eax, dword [ebp + 0x78]
sub eax, ecx
cmp eax, ebx
jb 0x52d78e
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 0x52db09
mov eax, dword [ebp + 0x7c]
cmp eax, ecx
jne 0x52db09
mov byte [ebp + 0x65], 1
mov byte [ebp + 0x66], cl
jmp 0x52d5c1
mov eax, dword [ebp + 0x78]
mov ecx, dword [ebp + 0x7c]
mov edx, eax
or edx, ecx
je 0x52d7fd
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 0x52d845
jl 0x52d82d
cmp ecx, ebx
jae 0x52d845
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 0x52d9aa
mov ecx, dword [ebp + 0x40]
mov eax, 0xb
sub eax, ecx
mov dword [esp + 0x20], ecx
cmp eax, ebx
jb 0x52d864
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 0x52db03
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
add edx, esi
cmp edx, eax
jae 0x52d92c
sub eax, esi
mov byte [ebp + 0x5c], 1
mov dword [ebp + 0x58], eax
jmp 0x52d943
cmp eax, esi
ja 0x52d93b
mov byte [ebp + 0x5c], 0
mov dword [ebp + 0x58], 0
mov eax, dword [ebp + 0x58]
add eax, esi
mov dword [ebp + 0x4c], eax
mov al, byte [ebp + 0x5c]
test al, al
je 0x52d965
mov ecx, dword [ebp + 0x58]
add ecx, esi
push ecx
push edi
call fcn.00529430
mov edx, dword [ebp + 0x58]
add esp, 8
add edx, esi
add edi, eax
shr edx, 0x18
mov byte [edi], dl
mov edx, dword [esp + 0x30]
lea eax, [esp + 0x14]
push 0
push eax
lea ecx, [ebp + 0x1c]
push 0xb
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x52daf7
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 0x52daf7
mov al, byte [ebp + 0x5e]
test al, al
jne 0x52da27
mov esi, dword [ebp + 0x54]
mov ecx, dword [ebp + 0x50]
sub esi, ecx
cmp esi, ebx
jb 0x52d9bf
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 0x52daf7
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 0x52daf7
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 0x52db09
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 0x52da3b
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 0x52db03
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 0x52daa6
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 0x52daf7
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 0x52daf7
test ebx, ebx
jne 0x52d5b6
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