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

Disassembly:
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x20
mov rsi, rcx
mov rcx, rdx
mov rbx, rdx
call sub.msvcrt.dll_ftell
lea rcx, [0x0040d0c0]
mov r9, rbx
mov r8d, 1
mov edx, 0x10
mov edi, eax
call sub.msvcrt.dll_fread
cmp rax, 1
je 0x401890
lea rcx, str._s:_Failed_to_read_ELF_header_n
mov rdx, rsi
call fcn.004023d0
mov eax, 1
add rsp, 0x20
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
ret
cmp dword [0x0040d0c0], 0x464c457f
jne 0x40186a
cmp byte [0x0040d0c5], 2
mov r12, qword [0x00409ca0]
je 0x401af0
mov rax, qword [fcn.00402a00]
mov rbp, qword [0x00409cd0]
mov qword [r12], rax
mov rax, qword [0x00409cf0]
mov qword [rbp], rax
movzx eax, byte [0x0040d0c4]
cmp al, 1
je 0x401c80
cmp al, 2
jne 0x40186a
lea rcx, [0x0040d050]
mov r9, rbx
mov r8d, 1
mov edx, 0x30
call sub.msvcrt.dll_fread
cmp rax, 1
jne 0x40186a
mov edx, 2
lea rcx, [0x0040d050]
call qword [r12]
mov edx, 2
lea rcx, [0x0040d052]
mov word [0x0040d0f0], ax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d054]
mov word [0x0040d0f2], ax
call qword [r12]
mov edx, 8
lea rcx, [0x0040d058]
mov dword [0x0040d0e8], eax
call qword [r12]
mov edx, 8
lea rcx, [0x0040d060]
mov qword [0x0040d0d0], rax
call qword [r12]
mov edx, 8
lea rcx, [0x0040d068]
mov qword [0x0040d0d8], rax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d070]
mov qword [0x0040d0e0], rax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d074]
mov dword [0x0040d0ec], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d076]
mov dword [0x0040d0f4], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d078]
mov dword [0x0040d0f8], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d07a]
mov dword [0x0040d0fc], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d07c]
mov dword [0x0040d100], eax
call qword [r12]
mov edx, 2
mov dword [0x0040d104], eax
lea rcx, [0x0040d07e]
call qword [r12]
mov rdx, qword [0x0040d0c8]
mov dword [0x0040d108], eax
mov rax, qword [0x0040d0c0]
mov qword [0x0040d048], rdx
mov qword [0x0040d040], rax
xor r8d, r8d
mov edx, edi
mov rcx, rbx
call sub.msvcrt.dll_fseek
test eax, eax
jne 0x401b40
movzx r8d, byte [0x0040d0c6]
cmp r8b, 1
jne 0x401b12
movzx edx, word [0x0040d0f2]
mov ecx, dword [0x00407158]
cmp edx, ecx
mov eax, edx
je 0x401bc0
movzx r8d, byte [0x0040d0c4]
mov r9d, dword [0x00407144]
cmp r9d, 0xffffffff
mov r10d, r8d
je 0x401bf0
cmp r9d, 3
setne al
cmp r8d, r9d
setne r11b
and eax, r11d
test al, al
jne 0x401bd0
mov r9d, dword [0x00407140]
cmp r9d, 3
je 0x401b54
cmp r8d, r9d
je 0x401b54
lea rcx, str._s:_Unmatched_output_EI_CLASS:__d_is_not__d_n
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
mov rax, qword [fcn.00402450]
mov rbp, qword [0x00409cd0]
mov qword [r12], rax
mov rax, qword [0x00409ce0]
mov qword [rbp], rax
jmp 0x4018cd
lea rcx, str._s:_Unsupported_EI_VERSION:__d_is_not__d_n
mov r9d, 1
mov rdx, rsi
call fcn.004023d0
mov eax, 1
add rsp, 0x20
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
ret
lea rcx, str._s:_Failed_to_seek_to_ELF_header_n
mov rdx, rsi
call fcn.004023d0
jmp 0x401a58
mov r9d, dword [0x0040715c]
cmp r9d, 0xffffffff
je 0x401b82
cmp edx, r9d
je 0x401b82
lea rcx, str._s:_Unmatched_e_machine:__d_is_not__d_n
mov r8d, edx
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
mov r9d, dword [0x00407154]
movzx r8d, word [0x0040d0f0]
cmp r9d, 0xffffffff
je 0x401c30
cmp r8d, r9d
je 0x401c30
lea rcx, str._s:_Unmatched_e_type:__d_is_not__d_n
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
xor eax, eax
jmp 0x40187e
lea rcx, str._s:_Unmatched_input_EI_CLASS:__d_is_not__d_n
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
cmp dx, 6
je 0x401e06
jbe 0x401e00
sub ax, 0xb4
cmp ax, 1
ja 0x401df0
cmp r8d, 2
mov r9d, 2
setne al
mov dword [0x00407144], r9d
jmp 0x401aae
movzx r8d, byte [0x0040d0c7]
mov r9d, dword [0x0040714c]
cmp r8d, r9d
je 0x401c63
cmp r9d, 0xffffffff
je 0x401c63
lea rcx, str._s:_Unmatched_EI_OSABI:__d_is_not__d_n
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
cmp r10b, 1
je 0x401ec0
cmp r10b, 2
je 0x401e20
call sub.msvcrt.dll_abort
nop dword [rax]
lea rcx, [0x0040d090]
mov r9, rbx
mov r8d, 1
mov edx, 0x24
call sub.msvcrt.dll_fread
cmp rax, 1
jne 0x40186a
mov edx, 2
lea rcx, [0x0040d090]
call qword [r12]
mov edx, 2
lea rcx, [0x0040d092]
mov word [0x0040d0f0], ax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d094]
mov word [0x0040d0f2], ax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d098]
mov dword [0x0040d0e8], eax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d09c]
mov qword [0x0040d0d0], rax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d0a0]
mov qword [0x0040d0d8], rax
call qword [r12]
mov edx, 4
lea rcx, [0x0040d0a4]
mov qword [0x0040d0e0], rax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d0a8]
mov dword [0x0040d0ec], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d0aa]
mov dword [0x0040d0f4], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d0ac]
mov dword [0x0040d0f8], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d0ae]
mov dword [0x0040d0fc], eax
call qword [r12]
mov edx, 2
lea rcx, [0x0040d0b0]
mov dword [0x0040d100], eax
call qword [r12]
mov edx, 2
mov dword [0x0040d104], eax
lea rcx, [0x0040d0b2]
call qword [r12]
mov rdx, qword [0x0040d0c8]
mov dword [0x0040d108], eax
mov rax, qword [0x0040d0c0]
mov qword [0x0040d088], rdx
mov qword [0x0040d080], rax
jmp 0x401a43
xor eax, eax
mov r9d, 3
jmp 0x401c1b
cmp dx, 3
jne 0x401df0
cmp r8d, 1
mov r9d, 1
setne al
jmp 0x401c1b
cmp ecx, 0xffffffff
je 0x401e38
movsxd rdx, ecx
mov r8d, 2
lea rcx, [0x0040d052]
call qword [rbp]
mov eax, dword [0x00407150]
cmp eax, 0xffffffff
je 0x401e56
movsxd rdx, eax
mov r8d, 2
lea rcx, [0x0040d050]
call qword [rbp]
mov eax, dword [0x00407148]
cmp eax, 0xffffffff
je 0x401e67
mov byte [0x0040d047], al
lea rcx, [0x0040d040]
mov r9, rbx
mov r8d, 1
mov edx, 0x40
call sub.msvcrt.dll_fwrite
cmp rax, 1
sete al
movzx eax, al
cmp eax, 1
je 0x401bc0
call qword [sym.imp.msvcrt.dll__errno]
mov ecx, dword [rax]
call sub.msvcrt.dll_strerror
lea rcx, str._s:_Failed_to_update_ELF_header:__s_n
mov r8, rax
mov rdx, rsi
call fcn.004023d0
mov eax, 1
jmp 0x40187e
cmp ecx, 0xffffffff
je 0x401ed8
movsxd rdx, ecx
mov r8d, 2
lea rcx, [0x0040d092]
call qword [rbp]
mov eax, dword [0x00407150]
cmp eax, 0xffffffff
je 0x401ef6
movsxd rdx, eax
mov r8d, 2
lea rcx, [0x0040d090]
call qword [rbp]
mov eax, dword [0x00407148]
cmp eax, 0xffffffff
je 0x401f07
mov byte [0x0040d087], al
lea rcx, [0x0040d080]
mov r9, rbx
mov r8d, 1
mov edx, 0x34
call sub.msvcrt.dll_fwrite
cmp rax, 1
sete al
movzx eax, al
jmp 0x401e8b