Function at 0x412120
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x4c
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x60]
push 0x4921c8
push edi
xor ebp, ebp
call dword [sym.imp.MSVCRT.dll_fopen]
mov ebx, eax
add esp, 8
test ebx, ebx
jne 0x41215a
push edi
push 0x493690
call fcn.00445450
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
mov esi, dword [sym.imp.MSVCRT.dll_fread]
push ebx
push 0xe
lea eax, [esp + 0x2c]
push 1
push eax
call esi
lea edx, [esp + 0x34]
mov ecx, 0x49368c
add esp, 0x10
mov ax, word [edx]
cmp ax, word [ecx]
push ebx
je 0x41219f
call dword [sym.imp.MSVCRT.dll_fclose]
push edi
push 0x493678
call fcn.00445450
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
push 0x28
lea ecx, [esp + 0x3c]
push 1
push ecx
call esi
mov eax, dword [esp + 0x52]
add esp, 0x10
cmp ax, 0x18
jne 0x412301
push 0x10
call fcn.004225a0
mov ebp, eax
mov byte [ebp], 1
mov dx, word [esp + 0x3c]
mov word [ebp + 2], dx
mov ax, word [esp + 0x40]
movsx ecx, ax
movsx edx, dx
imul ecx, edx
shl ecx, 1
push ecx
mov word [ebp + 4], ax
mov dword [ebp + 0xc], 0
call fcn.004225a0
mov dword [ebp + 8], eax
mov ax, word [ebp + 2]
imul ax, ax, 3
mov edi, eax
lea ecx, [eax + 3]
and edi, 0xffff
and ecx, 0xfffc
push edi
sub ecx, eax
mov dword [esp + 0x1c], edi
mov dword [esp + 0x24], ecx
call fcn.004225e0
mov dword [esp + 0x20], eax
add esp, 0xc
movsx eax, word [ebp + 4]
test eax, eax
mov dword [esp + 0x60], 0
jle 0x41257d
jmp 0x412241
mov esi, dword [sym.imp.MSVCRT.dll_fread]
mov edx, dword [esp + 0x60]
push ebx
movsx ecx, word [ebp + 2]
sub eax, edx
mov edx, dword [ebp + 8]
dec eax
push edi
imul eax, ecx
mov ecx, dword [esp + 0x1c]
push 1
lea eax, [edx + eax*2]
push ecx
mov dword [esp + 0x30], eax
call esi
xor esi, esi
add esp, 0x10
cmp word [ebp + 2], si
jle 0x4122b8
mov edx, dword [esp + 0x14]
mov edi, dword [esp + 0x20]
lea eax, [edx + 1]
mov cl, byte [eax + 1]
xor dx, dx
shr cl, 3
mov dl, cl
mov cl, byte [eax]
shr cl, 3
movzx cx, cl
shl edx, 5
add edx, ecx
mov cl, byte [eax - 1]
shr cl, 3
movzx cx, cl
shl edx, 5
add edx, ecx
inc esi
mov word [edi], dx
add eax, 3
movsx edx, word [ebp + 2]
add edi, 2
cmp esi, edx
jl 0x41227a
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x18]
and eax, 0xffff
mov ecx, eax
dec eax
test ecx, ecx
je 0x4122d8
lea esi, [eax + 1]
push ebx
call dword [sym.imp.MSVCRT.dll_fgetc]
add esp, 4
dec esi
jne 0x4122cb
mov ecx, dword [esp + 0x60]
movsx eax, word [ebp + 4]
inc ecx
cmp ecx, eax
mov dword [esp + 0x60], ecx
jl 0x41223b
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
cmp ax, 0x10
jne 0x4123da
push 0x10
call fcn.004225a0
mov ebp, eax
xor edi, edi
mov byte [ebp], 1
mov dx, word [esp + 0x3c]
mov word [ebp + 2], dx
mov ax, word [esp + 0x40]
movsx ecx, ax
movsx edx, dx
imul ecx, edx
shl ecx, 1
push ecx
mov word [ebp + 4], ax
mov dword [ebp + 0xc], edi
call fcn.004225a0
mov cx, word [ebp + 2]
mov dword [ebp + 8], eax
movsx eax, word [ebp + 4]
shl cx, 1
add esp, 8
lea edx, [ecx + 3]
and edx, 0xfffc
sub edx, ecx
test eax, eax
jle 0x41257d
and ecx, 0xffff
and edx, 0xffff
mov dword [esp + 0x10], ecx
mov dword [esp + 0x18], edx
jmp 0x41237e
mov ecx, dword [esp + 0x10]
push ebx
push ecx
movsx ecx, word [ebp + 2]
sub eax, edi
mov edx, dword [ebp + 8]
dec eax
push 1
imul eax, ecx
lea eax, [edx + eax*2]
push eax
call esi
mov eax, dword [esp + 0x28]
add esp, 0x10
mov ecx, eax
dec eax
test ecx, ecx
je 0x4123bd
inc eax
mov dword [esp + 0x60], eax
push ebx
call dword [sym.imp.MSVCRT.dll_fgetc]
mov eax, dword [esp + 0x64]
add esp, 4
dec eax
mov dword [esp + 0x60], eax
jne 0x4123a8
movsx eax, word [ebp + 4]
inc edi
cmp edi, eax
jl 0x41237a
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
cmp ax, 8
jne 0x412568
push 0x10
call fcn.004225a0
mov ebp, eax
push 0x200
mov byte [ebp], 0
mov dx, word [esp + 0x40]
mov word [ebp + 2], dx
mov ax, word [esp + 0x44]
mov word [ebp + 4], ax
call fcn.004225a0
movsx ecx, word [ebp + 4]
movsx edx, word [ebp + 2]
imul ecx, edx
push ecx
mov dword [ebp + 0xc], eax
call fcn.004225a0
add esp, 0xc
mov dword [ebp + 8], eax
xor esi, esi
push ebx
push 1
lea eax, [esp + 0x24]
push 4
push eax
call dword [sym.imp.MSVCRT.dll_fread]
mov cl, byte [esp + 0x2e]
mov eax, dword [esp + 0x2c]
and cl, 0xf8
xor dx, dx
mov dl, cl
mov cl, ah
and cl, 0xf8
add esi, 2
movzx cx, cl
shr al, 3
shl edx, 5
movzx ax, al
add edx, ecx
add esp, 0x10
cmp esi, 0x200
lea ecx, [eax + edx*4]
mov edx, dword [ebp + 0xc]
mov word [esi + edx - 2], cx
jl 0x412429
mov eax, dword [esp + 0x42]
movsx ecx, word [ebp + 2]
and eax, 0xffff
imul eax, ecx
add eax, 7
sar eax, 3
add eax, 3
and eax, 0xfffc
mov esi, eax
lea ecx, [eax + 3]
and esi, 0xffff
and ecx, 0xfffc
push esi
sub ecx, eax
mov dword [esp + 0x14], esi
mov dword [esp + 0x1c], ecx
call fcn.004225e0
mov edi, eax
add esp, 4
movsx eax, word [ebp + 4]
test eax, eax
mov dword [esp + 0x14], edi
mov dword [esp + 0x60], 0
jle 0x41257d
mov ecx, dword [esp + 0x18]
and ecx, 0xffff
mov dword [esp + 0x18], ecx
jmp 0x4124eb
mov esi, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
mov ecx, dword [esp + 0x60]
push ebx
movsx edx, word [ebp + 2]
sub eax, ecx
mov ecx, dword [ebp + 8]
dec eax
push esi
imul eax, edx
add eax, ecx
push 1
push edi
mov dword [esp + 0x30], eax
call dword [sym.imp.MSVCRT.dll_fread]
movsx ecx, word [ebp + 2]
mov eax, ecx
mov esi, edi
mov edi, dword [esp + 0x30]
add esp, 0x10
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
mov eax, dword [esp + 0x18]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, eax
dec eax
test ecx, ecx
je 0x412543
lea esi, [eax + 1]
push ebx
call dword [sym.imp.MSVCRT.dll_fgetc]
add esp, 4
dec esi
jne 0x412536
mov ecx, dword [esp + 0x60]
movsx eax, word [ebp + 4]
inc ecx
cmp ecx, eax
mov dword [esp + 0x60], ecx
jl 0x4124e3
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
push edi
push 0x49366c
call fcn.00445450
add esp, 0xc
push ebx
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x4c
ret