Function at 0x140004990
Capabilities:
Read file on windows
Read pipe
Write file on windows

Disassembly:
mov qword [rsp + 0x18], rbx
push rbp
push rsi
push rdi
push r14
push r15
lea rbp, [rsp - 0xff50]
mov eax, 0x10050
call fcn.1400b9380
sub rsp, rax
mov rax, qword [0x140125080]
xor rax, rsp
mov qword [rbp + 0xff40], rax
mov eax, dword [rcx + 8]
mov r14, rdx
dec eax
mov rdi, rcx
test eax, 0xfffffffd
jne 0x140004e0a
xor r15d, r15d
nop dword [rax + rax]
mov rbx, qword [rdi]
test rbx, rbx
je 0x140004d8b
mov rcx, qword [rbx + 8]
cmp rcx, 0xffffffffffffffff
je 0x140004d8b
lea rax, [rbp + 0xff30]
mov qword [rsp + 0x28], r15
xor r9d, r9d
mov qword [rsp + 0x20], rax
xor r8d, r8d
mov dword [rbp + 0xff30], r15d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x140004d76
cmp dword [rbp + 0xff30], 8
jb 0x140004d8b
mov rcx, qword [rbx + 8]
lea r9, [rbp + 0xff38]
mov r8d, 8
mov dword [rbp + 0xff38], r15d
lea rdx, [rsp + 0x30]
mov qword [rsp + 0x20], r15
call qword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x140004d76
mov ecx, dword [rsp + 0x34]
test ecx, ecx
je 0x140004b06
mov rbx, qword [rdi]
mov esi, ecx
test rbx, rbx
je 0x140004c1c
mov rcx, qword [rbx + 8]
cmp rcx, 0xffffffffffffffff
je 0x140004c1c
lea rax, [rbp + 0xff30]
mov qword [rsp + 0x28], r15
xor r9d, r9d
mov qword [rsp + 0x20], rax
xor r8d, r8d
mov dword [rbp + 0xff30], r15d
xor edx, edx
call qword [sym.imp.KERNEL32.dll_PeekNamedPipe]
test eax, eax
je 0x140004c07
mov eax, dword [rbp + 0xff30]
cmp rax, rsi
jb 0x140004c1c
mov rcx, qword [rbx + 8]
lea r9, [rbp + 0xff38]
mov r8d, esi
mov dword [rbp + 0xff38], r15d
lea rdx, [rsp + 0x38]
mov qword [rsp + 0x20], r15
call qword [sym.imp.KERNEL32.dll_ReadFile]
cmp eax, 1
jne 0x140004c07
mov eax, dword [rsp + 0x34]
mov byte [rsp + rax + 0x38], r15b
mov ecx, dword [rsp + 0x34]
mov eax, dword [rsp + 0x30]
test eax, eax
je 0x140004b2e
sub eax, 1
je 0x140004d62
sub eax, 1
je 0x140004c82
sub eax, 1
je 0x140004b75
cmp eax, 1
je 0x1400049e0
lea rcx, str.Bad_ipc_frame
mov dword [rdi + 0x60], 2
mov r8d, 1
lea rdx, [rdi + 0x64]
sub r8, rcx
nop dword [rax]
lea rax, [r8 + rcx]
cmp rax, 0x100
jae 0x140004dcc
movzx eax, byte [rcx]
inc rcx
mov byte [rdx], al
inc rdx
cmp byte [rcx], r15b
jne 0x140004b50
jmp 0x140004dcc
mov rax, qword [rdi]
mov dword [rsp + 0x30], 4
test rax, rax
je 0x140004bc7
mov r10, qword [rax + 8]
cmp r10, 0xffffffffffffffff
je 0x140004bc7
lea ebx, [rcx + 8]
mov dword [rbp + 0xff30], r15d
mov r8d, ebx
mov qword [rsp + 0x20], r15
lea r9, [rbp + 0xff30]
mov rcx, r10
lea rdx, [rsp + 0x30]
call qword [sym.imp.KERNEL32.dll_WriteFile]
cmp eax, 1
jne 0x140004bc7
cmp dword [rbp + 0xff30], ebx
je 0x1400049e0
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140004be6
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140004be6
mov ecx, dword [rdi + 0x60]
lea rdx, [rdi + 0x64]
call r8
mov rbx, qword [rdi]
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r15b
mov dword [rdi + 8], r15d
jmp 0x1400049e0
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov byte [rbx], r15b
mov qword [rbx + 8], 0xffffffffffffffff
lea rdx, [rdi + 0x64]
mov dword [rdi + 0x60], 2
lea rcx, str.Partial_data_in_frame
mov r8d, 1
mov r9, rdx
sub r8, rcx
nop word [rax + rax]
lea rax, [r8 + rcx]
cmp rax, 0x100
jae 0x140004c5d
movzx eax, byte [rcx]
inc rcx
mov byte [r9], al
inc r9
cmp byte [rcx], r15b
jne 0x140004c40
mov byte [r9], r15b
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140004dee
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140004dee
jmp 0x140004de8
lea rdx, [rsp + 0x38]
mov rcx, r14
call fcn.140004e40
mov rcx, r14
call fcn.140002800
mov dword [rdi + 0x60], eax
test r14, r14
je 0x140004d13
lea r8, str.message
mov qword [rbp + 0xff38], r15
lea rdx, [rbp + 0xff38]
mov rcx, r14
call fcn.140003f50
mov eax, dword [r14]
movabs rdx, 0xffffffffffff
mov rcx, qword [r14 + 8]
and rcx, rdx
shl rax, 5
add rax, rcx
mov rcx, qword [rbp + 0xff38]
cmp rcx, rax
je 0x140004d13
movzx eax, word [rcx + 0x1e]
shr ax, 0xa
test al, 1
je 0x140004d13
add rcx, 0x10
mov eax, 0x1000
test word [rcx + 0xe], ax
jne 0x140004d05
mov rcx, qword [rcx + 8]
and rcx, rdx
mov rax, rcx
test rcx, rcx
je 0x140004dcf
jmp 0x140004d1d
lea rax, [0x1400cc772]
mov rcx, rax
lea rdx, [rdi + 0x64]
cmp byte [rax], r15b
je 0x140004dcc
mov r8d, 1
sub r8, rax
nop dword [rax]
nop word [rax + rax]
lea rax, [r8 + rcx]
cmp rax, 0x100
jae 0x140004dcc
movzx eax, byte [rcx]
inc rcx
mov byte [rdx], al
inc rdx
cmp byte [rcx], r15b
jne 0x140004d40
jmp 0x140004dcc
lea rdx, [rsp + 0x38]
mov rcx, r14
call fcn.140004e40
mov al, 1
jmp 0x140004e0c
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov byte [rbx], r15b
mov qword [rbx + 8], 0xffffffffffffffff
mov rax, qword [rdi]
cmp byte [rax], r15b
jne 0x140004e0a
mov r8d, 1
lea rcx, str.Pipe_closed
mov dword [rdi + 0x60], r8d
lea rdx, [rdi + 0x64]
sub r8, rcx
nop dword [rax + rax]
lea rax, [r8 + rcx]
cmp rax, 0x100
jae 0x140004dcc
movzx eax, byte [rcx]
inc rcx
mov byte [rdx], al
inc rdx
cmp byte [rcx], r15b
jne 0x140004db0
mov byte [rdx], r15b
mov r8, qword [rdi + 0x18]
test r8, r8
je 0x140004dee
mov eax, dword [rdi + 8]
dec eax
test eax, 0xfffffffd
jne 0x140004dee
lea rdx, [rdi + 0x64]
mov ecx, dword [rdi + 0x60]
call r8
mov rbx, qword [rdi]
mov rcx, qword [rbx + 8]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rbx + 8], 0xffffffffffffffff
mov byte [rbx], r15b
mov dword [rdi + 8], r15d
xor al, al
mov rcx, qword [rbp + 0xff40]
xor rcx, rsp
call fcn.1400b8800
mov rbx, qword [rsp + 0x10090]
add rsp, 0x10050
pop r15
pop r14
pop rdi
pop rsi
pop rbp
ret