Function at 0x40558e
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
push ebx
push esi
push edi
xor edi, edi
push dword [ebp + 8]
mov dword [0x40d540], edi
mov dword [ebp - 0x18], edi
mov dword [ebp - 4], edi
call fcn.00405b07
test eax, eax
pop ecx
je 0x405ad6
movzx esi, word [0x40d746]
mov eax, dword [0x40d768]
mov ecx, dword [0x40d7c0]
xor edx, edx
mov dword [0x40d570], eax
mov eax, dword [0x40d540]
cmp esi, edi
mov dword [ebp - 0x30], esi
mov dword [0x40d55c], ecx
jle 0x405603
lea edi, [eax + 0xc]
mov ebx, dword [edi + 4]
add ebx, dword [edi]
cmp ebx, ecx
ja 0x4055f7
inc edx
add edi, 0x28
cmp edx, esi
jl 0x4055e4
jmp 0x405603
lea ecx, [edx + edx*4]
or byte [eax + ecx*8 + 0x27], 0x80
lea ecx, [eax + ecx*8 + 0x24]
mov ecx, dword [0x40d7e0]
lea ebx, [esi + esi*4]
shl ebx, 3
xor edi, edi
mov edx, dword [ebx + eax - 0x1c]
mov dword [ebp - 0x24], edi
cmp ecx, edx
jne 0x405684
mov eax, dword [0x40d7e4]
mov dword [ebp - 0x20], edx
push eax
push 0x40
mov dword [ebp - 0x24], eax
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
cmp eax, edi
mov dword [ebp - 0x18], eax
je 0x405ad6
mov eax, dword [0x40d540]
dec esi
push edi
push edi
lea ebx, [esi + esi*4]
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
shl ebx, 3
mov dword [ebp - 0x30], esi
push dword [ebx + eax + 0x14]
push dword [ebp + 8]
call edi
lea eax, [ebp - 0x10]
push 0
push eax
push dword [ebp - 0x24]
push dword [ebp - 0x18]
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [0x40d540]
push 0
push 0
push dword [ebx + eax + 0x14]
push dword [ebp + 8]
call edi
jmp 0x4056a1
cmp ecx, edi
jne 0x405adb
mov eax, dword [0x40d790]
push 2
push edi
push edi
push dword [ebp + 8]
mov dword [ebp - 0x20], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [0x40d548]
mov dword [0x40d544], esi
mov esi, dword [0x40d83c]
lea ecx, [eax + eax*4]
mov eax, dword [0x40d540]
shl ecx, 3
lea edi, [ebx + eax]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [0x40d564]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, 0x1000
cmp eax, ecx
ja 0x4056de
mov eax, ecx
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov edx, eax
test edx, edx
mov dword [ebp - 0x1c], edx
je 0x405ab8
mov eax, dword [0x40d554]
mov ecx, dword [0x40d83c]
mov edi, edx
mov dword [ebp - 0x28], edx
lea eax, [eax + eax*4]
add edx, 8
mov dword [ebp - 8], edx
xor edx, edx
mov esi, dword [ecx + eax*8 + 0xc]
lea eax, [ecx + eax*8]
mov ecx, dword [0x40d564]
mov dword [ebp - 0x14], edx
add esi, dword [eax + 8]
sub esi, ecx
mov eax, ecx
add esi, dword [0x40d838]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [0x40d548]
cmp ecx, edx
jle 0x405afa
mov eax, dword [0x40d540]
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0xc], ebx
jmp 0x405755
xor edx, edx
mov ecx, dword [ebp - 0xc]
push 1
push edx
push edx
push dword [ebp + 8]
lea esi, [ecx + eax]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [ebp - 0x2c]
mov ebx, dword [ebp - 0x20]
mov dword [esi + 0x14], eax
mov eax, dword [0x40d83c]
mov dword [esi + 0xc], ebx
mov ecx, dword [ecx + eax + 0x10]
mov eax, dword [0x40d77c]
mov dword [ebp - 0x20], eax
neg dword [ebp - 0x20]
lea edx, [ecx + eax - 1]
and edx, dword [ebp - 0x20]
mov dword [esi + 0x10], edx
mov edx, dword [ebp - 0x14]
cmp edx, dword [0x40d554]
jne 0x405823
mov ecx, dword [0x40d564]
mov edi, dword [ebp - 0x24]
add eax, ecx
push 0
lea edx, [ecx + edi]
mov dword [0x40d7e0], ebx
lea eax, [eax + edi - 1]
mov dword [esi + 8], edx
and eax, dword [ebp - 0x20]
mov dword [0x40d7e4], edx
mov dword [esi + 0x10], eax
lea eax, [ebp - 0x10]
mov esi, dword [sym.imp.KERNEL32.dll_WriteFile]
push eax
push edi
push dword [ebp - 0x18]
push dword [ebp + 8]
call esi
mov edi, dword [ebp - 0x1c]
lea eax, [ebp - 0x10]
push 0
push eax
push dword [0x40d564]
push edi
push dword [ebp + 8]
call esi
mov ecx, 0x400
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, dword [ebp - 0xc]
push eax
lea eax, [ebp - 0x10]
push eax
mov eax, dword [0x40d540]
mov eax, dword [ecx + eax + 0x10]
sub eax, dword [0x40d564]
sub eax, dword [ebp - 0x24]
push eax
push dword [ebp - 0x1c]
push dword [ebp + 8]
call esi
jmp 0x405972
push ecx
push 0x40
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov edi, eax
test edi, edi
mov dword [ebp - 4], edi
je 0x405ab8
mov eax, dword [0x40d83c]
mov ecx, dword [ebp - 0x2c]
add eax, ecx
mov ecx, dword [eax + 0x10]
mov edx, dword [eax + 0xc]
mov eax, dword [0x40d838]
mov dword [ebp - 0x20], ecx
lea esi, [edx + eax]
mov eax, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov esi, dword [0x40d720]
lea ecx, [edx + eax]
mov eax, dword [ebp - 0x28]
mov dword [ebp - 0x38], ecx
mov eax, dword [eax]
cmp ecx, eax
jbe 0x4058fb
mov ecx, dword [0x40d560]
mov edi, dword [ebp - 0x1c]
add ecx, edi
mov dword [ebp - 0x34], ecx
mov ecx, dword [ebp - 0x34]
cmp dword [ebp - 8], ecx
jae 0x4058fb
mov ecx, eax
mov eax, dword [ebp - 0x28]
sub ecx, edx
mov eax, dword [eax + 4]
sub eax, 8
shr eax, 1
mov edi, eax
dec eax
test edi, edi
je 0x4058e3
inc eax
mov dword [ebp - 0x20], eax
mov eax, dword [ebp - 8]
mov ax, word [eax]
mov edi, eax
and di, 0xf000
cmp di, 0x3000
jne 0x4058da
mov edi, dword [ebp - 4]
and eax, 0xfff
add eax, ecx
add eax, edi
mov edi, dword [0x40d774]
sub edi, dword [esi + 0x34]
sub edi, edx
add edi, ebx
add dword [eax], edi
add dword [ebp - 8], 2
dec dword [ebp - 0x20]
jne 0x4058ab
mov eax, dword [ebp - 0x28]
add ecx, ebx
mov dword [eax], ecx
mov eax, dword [ebp - 8]
add dword [ebp - 8], 8
mov dword [ebp - 0x28], eax
mov eax, dword [eax]
cmp dword [ebp - 0x38], eax
ja 0x405889
mov eax, dword [ebp - 0x14]
cmp eax, dword [0x40d550]
jne 0x405947
mov eax, dword [esi + 0x80]
mov ecx, ebx
sub eax, edx
sub ecx, edx
add eax, dword [ebp - 4]
mov esi, dword [eax]
test esi, esi
je 0x405947
and dword [eax + 8], 0
and dword [eax + 4], 0
add dword [eax + 0xc], ecx
add dword [eax + 0x10], ecx
add esi, ecx
mov dword [eax], esi
sub esi, ebx
add esi, dword [ebp - 4]
mov edx, dword [esi]
add edx, ecx
mov dword [esi], edx
mov edx, dword [esi + 4]
add esi, 4
test edx, edx
jne 0x405934
add eax, 0x14
jmp 0x405915
mov ecx, dword [ebp - 0xc]
lea eax, [ebp - 0x10]
push 0
push eax
mov eax, dword [0x40d540]
push dword [ecx + eax + 0x10]
push dword [ebp - 4]
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_WriteFile]
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
and dword [ebp - 4], 0
mov eax, dword [0x40d540]
mov ecx, dword [ebp - 0xc]
add dword [ebp - 0x2c], 0x28
add dword [ebp - 0xc], 0x28
mov edx, dword [ecx + eax + 8]
mov ecx, dword [0x40d778]
lea edx, [edx + ecx - 1]
neg ecx
and edx, ecx
mov ecx, dword [0x40d548]
add ebx, edx
inc dword [ebp - 0x14]
cmp dword [ebp - 0x14], ecx
mov dword [ebp - 0x20], ebx
jl 0x405753
xor edx, edx
mov esi, dword [ebp - 0x30]
mov dword [0x40d810], edx
mov dword [0x40d814], edx
mov dword [0x40d818], edx
mov dword [0x40d81c], edx
mov edx, dword [0x40d54c]
mov edi, dword [0x40d558]
add edx, esi
add ecx, esi
xor esi, esi
lea edx, [edx + edx*4]
mov word [0x40d746], cx
movzx ecx, cx
mov edx, dword [eax + edx*8 + 0xc]
mov dword [0x40d790], ebx
add edi, edx
mov dword [0x40d760], esi
mov dword [0x40d7c0], edi
mov edi, dword [0x40d720]
mov edi, dword [edi + 0x84]
mov dword [0x40d7c4], edi
mov edi, dword [0x40d56c]
add edx, edi
xor edi, edi
mov dword [0x40d768], edx
xor edx, edx
test ecx, ecx
mov dword [0x40d75c], edi
mov dword [0x40d764], edx
jle 0x405a66
add eax, 0x10
mov ebx, dword [eax + 0x14]
test bl, 0x20
je 0x405a40
add edi, dword [eax]
test bl, 0x40
je 0x405a47
add esi, dword [eax]
test bl, 0x80
je 0x405a4e
add edx, dword [eax]
add eax, 0x28
dec ecx
jne 0x405a36
mov dword [0x40d764], edx
mov dword [0x40d760], esi
mov dword [0x40d75c], edi
mov eax, dword [0x40d568]
push 0
add eax, 0xffffff08
push 0
push eax
push dword [ebp + 8]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [sym.imp.KERNEL32.dll_WriteFile]
lea eax, [ebp - 0x10]
push 0
push eax
push 0xf8
push 0x40d740
push dword [ebp + 8]
call esi
lea eax, [ebp - 0x10]
push 0
push eax
movzx eax, word [0x40d746]
lea eax, [eax + eax*4]
shl eax, 3
push eax
push dword [0x40d540]
push dword [ebp + 8]
call esi
cmp dword [ebp - 0x18], 0
je 0x405ac7
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
cmp dword [ebp - 0x1c], 0
je 0x405ad6
push dword [ebp - 0x1c]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [0x40d540]
pop edi
pop esi
test eax, eax
pop ebx
je 0x405ae9
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
cmp dword [ebp - 4], 0
je 0x405af8
push dword [ebp - 4]
call dword [sym.imp.KERNEL32.dll_GlobalFree]
leave
ret
mov eax, dword [0x40d540]
mov ebx, dword [ebp - 0x20]
jmp 0x4059ad