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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x34
push ebx
push esi
push edi
xor ebx, ebx
mov byte [ebp - 1], 0
cmp dword [ebp + 0x24], 0x10
lea eax, [ebp + 0x10]
push ebx
cmovae eax, dword [ebp + 0x10]
push 0x80
push 4
push ebx
push 3
push 0xc0000000
push eax
mov dword [ebp - 0xc], ebx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, dword [ebp + 8]
mov edi, eax
mov al, byte [ebp - 2]
mov byte [ebp - 2], al
cmp edi, 0xffffffff
je 0x40aeed
push 0
lea eax, [ebp - 8]
push eax
push 0x20
lea eax, [ebp - 0x34]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [ebp - 0x34]
inc ebx
mov edx, eax
cmp ecx, dword [esi]
jne 0x40aed1
mov ecx, dword [ebp - 0x30]
cmp ecx, dword [esi + 4]
jne 0x40aed1
mov eax, dword [ebp - 0x28]
cmp eax, dword [esi + 0xc]
jne 0x40aed1
mov eax, dword [ebp - 0x24]
cmp eax, dword [esi + 0x10]
jne 0x40aed1
mov eax, dword [ebp - 0x2c]
cmp eax, dword [esi + 8]
jne 0x40aed1
mov eax, dword [ebp - 0x20]
mov cl, 1
mov byte [ebp - 1], cl
mov dword [esi + 0x14], eax
mov byte [ebp - 2], cl
jmp 0x40aed4
mov cl, byte [ebp - 1]
test edx, edx
je 0x40aee3
cmp dword [ebp - 8], 0
je 0x40aee3
cmp cl, 1
jne 0x40ae84
push edi
mov dword [ebp - 0xc], ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor edi, edi
push edi
push 0x80
push 4
push edi
push 3
push 0xc0000000
push str.CQ_VIDEO.DAT
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebx, eax
cmp ebx, 0xffffffff
je 0x40afc6
mov eax, dword [ebp - 0xc]
cmp eax, 1
jne 0x40af54
mov eax, dword [esi + 0xc]
mov ecx, dword [esi]
mov dword [ebp - 0x28], eax
mov eax, dword [esi + 0x10]
mov dword [ebp - 0x24], eax
mov eax, dword [esi + 8]
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp + 0xc]
push edi
mov dword [ebp - 0x20], eax
lea eax, [ebp - 0x10]
push eax
push 0x20
lea eax, [ebp - 0x34]
mov dword [ebp - 0x34], ecx
mov ecx, dword [esi + 4]
push eax
push ebx
mov dword [ebp - 0x30], ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
jmp 0x40afbf
dec eax
mov dword [ebp - 0xc], eax
push 0
lea eax, [ebp - 8]
inc edi
push eax
push 0x20
lea eax, [ebp - 0x34]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0xc]
cmp edi, eax
jne 0x40afaf
mov eax, dword [esi + 0x10]
mov ecx, dword [esi]
mov dword [ebp - 0x24], eax
mov eax, dword [esi + 8]
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp + 0xc]
push 0
mov dword [ebp - 0x20], eax
lea eax, [ebp - 0x10]
push eax
push 0x20
mov dword [ebp - 0x34], ecx
lea eax, [ebp - 0x34]
mov ecx, dword [esi + 4]
push eax
mov dword [ebp - 0x30], ecx
mov ecx, dword [esi + 0xc]
push ebx
mov dword [ebp - 0x28], ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp - 0xc]
cmp dword [ebp - 0x14], 0
je 0x40afbf
cmp dword [ebp - 8], 0
je 0x40afbf
cmp edi, eax
jne 0x40af58
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
movzx eax, byte [ebp - 2]
xor ebx, ebx
cmp byte [ebp - 1], bl
mov edx, dword [ebp + 0x24]
cmovne ebx, eax
cmp edx, 0x10
jb 0x40b002
mov ecx, dword [ebp + 0x10]
inc edx
mov eax, ecx
cmp edx, 0x1000
jb 0x40aff8
mov ecx, dword [ecx - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x40b00b
push edx
push ecx
call fcn.004c824c
add esp, 8
pop edi
pop esi
mov al, bl
pop ebx
mov esp, ebp
pop ebp
ret
call fcn.004f1161
int3