Function at 0x402d80
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x47cbbd
mov eax, dword fs:[0]
push eax
sub esp, 0x30
mov eax, dword [0x4b4200]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
mov eax, dword [edi]
mov ebx, dword [ebp + 8]
mov dword [ebp - 0x18], ebx
cmp eax, 0xffffffff
je 0x402dcb
test eax, eax
je 0x402dcb
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi], 0xffffffff
mov eax, dword [ebp + 0xc]
mov dword [edi + 4], eax
test al, 8
je 0x402f9e
xorps xmm0, xmm0
mov dword [ebp - 0x24], 0
xor esi, esi
movq qword [ebp - 0x2c], xmm0
test ebx, ebx
je 0x402dfb
cmp word [ebx], si
je 0x402dfb
inc esi
cmp word [ebx + esi*2], 0
jne 0x402df3
mov ecx, 2
mov dword [ebp - 0x28], esi
lea eax, [esi + 1]
mul ecx
mov ecx, 0xffffffff
cmovb eax, ecx
push eax
call fcn.0046a3df
add esp, 4
mov dword [ebp - 0x2c], eax
test esi, esi
jle 0x402e46
mov ecx, eax
sub ebx, eax
mov edx, esi
nop word [eax + eax]
mov ax, word [ecx + ebx]
lea ecx, [ecx + 2]
mov word [ecx - 2], ax
sub edx, 1
jne 0x402e30
mov ebx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x2c]
xor ecx, ecx
mov byte [ebp - 0x24], 1
mov word [eax + esi*2], cx
push ecx
push 1
push 1
push ecx
mov dword [ebp - 4], ecx
lea ecx, [ebp - 0x2c]
push 0x49eae8
call fcn.00406350
mov esi, dword [ebp - 0x2c]
test eax, eax
je 0x402f8a
mov eax, dword [ebp - 0x28]
test eax, eax
jne 0x402e8e
test esi, esi
je 0x402e89
cmp word [esi], ax
je 0x402e89
inc eax
cmp word [esi + eax*2], 0
jne 0x402e81
mov dword [ebp - 0x28], eax
test eax, eax
setg byte [ebp - 0x24]
test eax, eax
jle 0x402ebd
lea ecx, [eax*2 - 2]
nop dword [eax]
cmp word [esi + ecx], 0x5c
lea edx, [esi + ecx]
jne 0x402eba
dec eax
xor ebx, ebx
sub ecx, 2
mov dword [ebp - 0x28], eax
mov word [edx], bx
test eax, eax
jne 0x402ea0
mov ebx, dword [ebp - 0x18]
push 0
push 1
push 0xffffffffffffffff
push 1
push 0x49eae8
lea ecx, [ebp - 0x2c]
call fcn.00406350
mov esi, dword [ebp - 0x2c]
cmp eax, 2
jle 0x402f13
lea ecx, [eax - 1]
mov eax, dword [ebp - 0x28]
test eax, eax
jne 0x402efb
test esi, esi
je 0x402ef8
cmp word [esi], ax
je 0x402ef8
nop dword [eax]
inc eax
cmp word [esi + eax*2], 0
jne 0x402ef0
mov dword [ebp - 0x28], eax
cmp eax, ecx
setge byte [ebp - 0x24]
jl 0x402f16
cmovl ecx, eax
mov eax, ecx
xor ecx, ecx
mov dword [ebp - 0x28], eax
mov word [esi + eax*2], cx
jmp 0x402f16
mov eax, dword [ebp - 0x28]
test eax, eax
jne 0x402f2e
test esi, esi
je 0x402f2b
cmp word [esi], ax
je 0x402f2b
inc eax
cmp word [esi + eax*2], 0
jne 0x402f23
mov dword [ebp - 0x28], eax
cmp eax, 2
jle 0x402f8a
test esi, esi
jne 0x402f4e
push 2
call fcn.0046a3df
mov esi, eax
add esp, 4
xor eax, eax
mov dword [ebp - 0x2c], esi
mov dword [ebp - 0x28], eax
mov word [esi], ax
mov ecx, esi
mov byte [ebp - 0x24], 1
call fcn.00404b20
test al, al
jne 0x402f8a
test esi, esi
je 0x402f6a
push esi
call fcn.00469dd3
add esp, 4
xor eax, eax
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.00469dc5
mov esp, ebp
pop ebp
ret 0xc
mov dword [ebp - 4], 0xffffffff
test esi, esi
je 0x402f9e
push esi
call fcn.00469dd3
add esp, 4
mov eax, dword [edi + 4]
mov edx, SysReAllocString
mov esi, eax
mov dword [ebp - 0x18], 0xc0000000
shr esi, 2
mov ecx, eax
not esi
mov dword [ebp - 0x38], 0
and esi, 1
test eax, 3
push 0
cmovne edx, dword [ebp - 0x18]
test al, 2
mov eax, 0
mov dword [ebp - 0x18], 3
sete al
test ecx, 3
push 0
lea eax, [eax*2 + 2]
cmove eax, dword [ebp - 0x18]
push eax
push 0
push esi
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x40300f
test eax, eax
je 0x40300f
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi], esi
test esi, esi
jne 0x403020
mov dword [edi], 0xffffffff
jmp 0x402f6a
cmp esi, 0xffffffff
je 0x402f6a
lea eax, [ebp - 0x34]
mov dword [ebp - 0x34], 0
push eax
push esi
mov dword [ebp - 0x30], 0
call dword [sym.imp.KERNEL32.dll_GetFileSizeEx]
test eax, eax
jne 0x40304e
xorps xmm0, xmm0
movlpd qword [ebp - 0x34], xmm0
mov ebx, dword [edi + 4]
mov eax, dword [ebp - 0x34]
mov esi, dword [ebp - 0x30]
mov dword [ebp - 0x18], eax
test bl, 0x10
je 0x403076
test bl, 1
je 0x40306f
push 0
push esi
push eax
mov ecx, edi
call fcn.00403790
mov eax, dword [edi]
jmp 0x402f6c
test eax, eax
jne 0x40312d
test esi, esi
jne 0x40312d
test bl, 0xe0
setne cl
test bl, 3
setne al
test al, cl
je 0x40306f
and ebx, 0x80
or ebx, 0x100
shr ebx, 7
push ebx
call fcn.0046a3df
mov esi, eax
add esp, 4
mov eax, dword [edi + 4]
test al, al
jns 0x4030c2
mov word [esi], 0xbbef
mov byte [esi + 2], 0xbf
jmp 0x4030d6
test al, 0x20
je 0x4030cd
mov word [esi], 0xfeff
jmp 0x4030d6
test al, 0x40
je 0x4030d6
mov word [esi], 0xfffe
push 0
lea eax, [ebp - 0x38]
push eax
push ebx
push esi
push dword [edi]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40311b
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x403109
test eax, eax
je 0x403109
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [edi], 0xffffffff
mov dword [edi + 4], 0
push esi
xor edi, edi
call fcn.00469dd3
add esp, 4
mov eax, edi
jmp 0x402f6c
mov edi, dword [edi]
push esi
call fcn.00469dd3
add esp, 4
mov eax, edi
jmp 0x402f6c
test bl, 2
jne 0x40306f
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
lea eax, [ebp - 0x38]
push 0
push eax
push 3
lea eax, [ebp - 0x1c]
mov word [ebp - 0x1c], 0
push eax
push dword [edi]
mov byte [ebp - 0x1a], 0
call ebx
test eax, eax
je 0x40306f
mov al, byte [ebp - 0x1c]
xor ecx, ecx
cmp al, 0xff
jne 0x40317f
cmp byte [ebp - 0x1b], 0xfe
jne 0x4031c0
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe3f
or eax, 0x20
jmp 0x4031bd
cmp al, 0xfe
jne 0x40319b
cmp byte [ebp - 0x1b], 0xff
jne 0x4031c0
mov eax, dword [edi + 4]
mov ecx, 2
and eax, 0xfffffe5f
or eax, 0x40
jmp 0x4031bd
cmp al, 0xef
jne 0x4031c0
cmp byte [ebp - 0x1b], 0xbb
jne 0x4031c0
cmp byte [ebp - 0x1a], 0xbf
jne 0x4031c0
mov eax, dword [edi + 4]
mov ecx, 3
and eax, 0xfffffe9f
or eax, 0x80
mov dword [edi + 4], eax
mov eax, dword [edi + 4]
test al, 1
je 0x40326f
test al, 0x60
mov ecx, edi
mov eax, dword [ebp - 0x18]
push 0
je 0x40322e
sub eax, 2
sbb esi, 0
push esi
push eax
call fcn.00403790
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x40321a
test eax, eax
je 0x40321a
push 0
lea ecx, [ebp - 0x30]
mov dword [ebp - 0x18], 0xffff
push ecx
push 2
lea ecx, [ebp - 0x18]
mov dword [ebp - 0x30], 0
push ecx
push eax
call ebx
mov eax, 0xffff
cmp ax, word [ebp - 0x18]
jne 0x40306f
push 1
push 0xffffffffffffffff
push 0xfffffffffffffffe
mov ecx, edi
call fcn.00403790
mov eax, dword [edi]
jmp 0x402f6c
sub eax, 1
sbb esi, 0
push esi
push eax
call fcn.00403790
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x40306f
test eax, eax
je 0x40306f
push 0
lea ecx, [ebp - 0x30]
mov byte [ebp - 0x1d], 0xff
push ecx
push 1
lea ecx, [ebp - 0x1d]
mov dword [ebp - 0x30], 0
push ecx
push eax
call ebx
mov eax, dword [edi]
jmp 0x402f6c
cmp ecx, dword [ebp - 0x38]
je 0x40306f
mov eax, dword [edi]
cmp eax, 0xffffffff
je 0x40306f
test eax, eax
je 0x40306f
push 0
push 0
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [edi]
jmp 0x402f6c