Function at 0x140031840
Capabilities:
Write file on windows

Disassembly:
push rbp
push rsi
push r12
push r14
push r15
sub rsp, 0x60
mov r14d, dword [rcx + 8]
xor esi, esi
mov rbp, rdx
test r14d, r14d
je 0x140031ae6
mov r12d, dword [rcx + 0xc]
test r12d, r12d
je 0x140031ae6
mov r15, qword [rcx]
test r15, r15
je 0x140031ae6
mov qword [rsp + 0x98], rbx
mov ebx, dword [rcx + 0x14]
mov qword [rsp + 0x58], rdi
lea edi, [rsi + 4]
mov qword [rsp + 0x50], r13
lea r13d, [rsi + 3]
mov byte [rsp + 0x90], sil
mov qword [rsp + 0xa8], r15
cmp ebx, 1
jne 0x1400318ad
mov edi, ebx
jmp 0x1400318f1
cmp ebx, 2
jne 0x1400318b6
mov edi, ebx
jmp 0x1400318f1
cmp ebx, edi
jne 0x1400318bf
mov edi, r13d
jmp 0x1400318f1
cmp ebx, 7
je 0x1400318f1
movups xmm0, xmmword [rcx]
movsd xmm1, qword [rcx + 0x10]
lea rcx, [rsp + 0x30]
movaps xmmword [rsp + 0x30], xmm0
movsd qword [rsp + 0x40], xmm1
call fcn.140031d20
mov qword [rsp + 0xa8], rax
mov byte [rsp + 0x90], 1
lea rdx, str..png
mov rcx, rbp
call fcn.1400085c0
test al, al
je 0x14003195f
mov edx, r14d
mov dword [rsp + 0xa0], esi
mov r9d, r12d
imul edx, edi
mov r12, qword [rsp + 0xa8]
lea rax, [rsp + 0xa0]
mov qword [rsp + 0x28], rax
mov r8d, r14d
mov rcx, r12
mov dword [rsp + 0x20], edi
call fcn.140032bf0
mov r8d, dword [rsp + 0xa0]
mov rdx, rax
mov rcx, rbp
mov rbx, rax
call fcn.1400347e0
mov rcx, rbx
movzx esi, al
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
jmp 0x140031a8a
lea rdx, str..qoi
mov rcx, rbp
call fcn.1400085c0
test al, al
je 0x140031a50
cmp ebx, 4
je 0x14003198a
cmp ebx, 7
jne 0x140031a3d
mov r13d, 4
lea rdx, [0x140052e20]
mov word [rsp + 0x3a], si
mov rcx, rbp
mov dword [rsp + 0x30], r14d
mov dword [rsp + 0x34], r12d
mov byte [rsp + 0x38], r13b
mov byte [rsp + 0x39], sil
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov r12, qword [rsp + 0xa8]
mov r14, rax
test rax, rax
je 0x140031a8a
lea r8, [rsp + 0xa0]
mov rcx, r12
lea rdx, [rsp + 0x30]
call fcn.140032800
mov r15, rax
test rax, rax
jne 0x1400319f2
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
jmp 0x140031a8a
movsxd rdi, dword [rsp + 0xa0]
mov r9, r14
mov r8, rdi
mov edx, 1
mov rcx, r15
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fflush]
mov rcx, r14
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ferror]
mov rcx, r14
mov ebx, eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov rcx, r15
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
test ebx, ebx
cmovne edi, esi
mov esi, edi
jmp 0x140031a8a
lea rdx, str.IMAGE:_Image_pixel_format_must_be_R8G8B8_or_R8G8B8A8
mov ecx, 4
call fcn.1400348e0
jmp 0x140031a82
lea rdx, str..raw
mov rcx, rbp
call fcn.1400085c0
test al, al
je 0x140031a82
mov r8d, ebx
mov edx, r12d
mov ecx, r14d
call fcn.140031b00
mov r8d, eax
mov rdx, r15
mov rcx, rbp
call fcn.1400347e0
movzx esi, al
mov r12, qword [rsp + 0xa8]
cmp byte [rsp + 0x90], 0
mov r13, qword [rsp + 0x50]
mov rdi, qword [rsp + 0x58]
mov rbx, qword [rsp + 0x98]
je 0x140031aaf
mov rcx, r12
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
lea rax, str.FILEIO:___s__Failed_to_export_image
test esi, esi
lea rdx, str.FILEIO:___s__Image_exported_successfully
mov r8, rbp
cmove rdx, rax
mov eax, esi
neg eax
sbb ecx, ecx
add ecx, 4
call fcn.1400348e0
test esi, esi
setne al
add rsp, 0x60
pop r15
pop r14
pop r12
pop rsi
pop rbp
ret
xor al, al
add rsp, 0x60
pop r15
pop r14
pop r12
pop rsi
pop rbp
ret