Function at 0x140017030
Capabilities:
Read file on windows

Disassembly:
push rbp
push rsi
push r14
lea rbp, [rsp - 0x47]
sub rsp, 0xd0
mov rax, qword [0x1400dc040]
xor rax, rsp
mov qword [rbp + 0x17], rax
mov r14, rdx
lea r8, [0x1400b36e8]
mov rdx, rcx
mov rsi, rcx
lea rcx, [rbp - 0x29]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen_s]
mov r9, qword [rbp - 0x29]
test r9, r9
jne 0x140017095
lea ecx, [r9 + 2]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov r8, rsi
lea rdx, str.File_not_found:___s_._n
mov rcx, rax
call fcn.140016c80
xor eax, eax
jmp 0x140017238
mov edx, 0x10
lea rcx, [rbp + 7]
lea r8d, [rdx - 0xf]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov rcx, qword [rbp + 7]
cmp rcx, qword [0x1400dc0a8]
mov rax, qword [rbp + 0xf]
jne 0x1400170c8
cmp rax, qword [0x1400dc0b0]
jne 0x1400170c8
mov byte [r14], 0
jmp 0x140017116
cmp rcx, qword [str.KORGP]
jne 0x1400170e0
cmp rax, qword [0x1400dc0d0]
jne 0x1400170e0
mov byte [r14], 2
jmp 0x140017116
cmp rcx, qword [str.KORG_]
jne 0x1400170f8
cmp rax, qword [0x1400dc0a0]
jne 0x1400170f8
mov byte [r14], 1
jmp 0x140017116
cmp rcx, qword [str.KORGc]
jne 0x1400177af
cmp rax, qword [0x1400dc0c0]
jne 0x1400177af
mov byte [r14], 3
mov r9, qword [rbp - 0x29]
lea rcx, [rbp - 0x21]
xor eax, eax
xorps xmm0, xmm0
movups xmmword [rbp - 0x21], xmm0
mov qword [rbp - 1], rax
movups xmmword [rbp - 0x11], xmm0
lea edx, [rax + 4]
lea r8d, [rax + 1]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov eax, dword [0x1400b3850]
cmp dword [rbp - 0x21], eax
je 0x140017175
mov ecx, 2
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
lea rdx, str.Input_file___s__is_not_a_valid_PCG__bad_root_chunk_._n
mov r8, rsi
mov rcx, rax
call fcn.140016c80
mov rcx, qword [rbp - 0x29]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
xor eax, eax
jmp 0x140017238
mov qword [rsp + 0x100], rbx
mov qword [rsp + 0xc8], rdi
mov rdi, qword [rbp - 0x29]
mov rcx, rdi
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgetc]
mov ebx, eax
mov rcx, rdi
shl ebx, 0x18
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgetc]
shl eax, 0x10
mov rcx, rdi
or ebx, eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgetc]
shl eax, 8
mov rcx, rdi
or ebx, eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fgetc]
mov rcx, qword [rbp - 0x29]
or eax, ebx
mov dword [rbp - 0x1d], eax
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ftell]
mov rcx, qword [rbp - 0x29]
xor edx, edx
mov ebx, eax
lea r8d, [rdx + 2]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
mov rcx, qword [rbp - 0x29]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ftell]
mov rcx, qword [rbp - 0x29]
xor r8d, r8d
mov edi, eax
mov edx, ebx
sub edi, ebx
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
cmp dword [rbp - 0x1d], edi
je 0x140017250
mov ecx, 2
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov r8, rsi
lea rdx, str.Input_file___s__is_not_a_valid_PCG__incorrect_size_._n
mov rcx, rax
call fcn.140016c80
mov rcx, qword [rbp - 0x29]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
xor eax, eax
mov rbx, qword [rsp + 0x100]
mov rdi, qword [rsp + 0xc8]
mov rcx, qword [rbp + 0x17]
xor rcx, rsp
call fcn.140075e00
add rsp, 0xd0
pop r14
pop rsi
pop rbp
ret
mov ecx, edi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov edx, dword [rbp - 0x1d]
mov r8d, 1
mov r9, qword [rbp - 0x29]
mov rcx, rax
mov qword [rbp - 0x11], rax
mov byte [rbp - 0x15], 1
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
lea rcx, [rbp - 0x21]
call fcn.140016cd0
cmp dword [rbp - 9], 0
jne 0x140017302
mov ecx, 2
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov r8, rsi
lea rdx, str.Input_file___s__is_not_a_valid_PCG__empty_PCG__._n
mov rcx, rax
call fcn.140016c80
mov eax, dword [rbp - 9]
xor r14d, r14d
test eax, eax
je 0x1400172e4
mov rbx, qword [rbp - 1]
test rbx, rbx
je 0x1400172e4
mov edi, r14d
test eax, eax
je 0x1400172d7
nop dword [rax]
mov rcx, rbx
call fcn.140016e00
inc edi
add rbx, 0x28
cmp edi, dword [rbp - 9]
jb 0x1400172c0
mov rbx, qword [rbp - 1]
mov rcx, rbx
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov qword [rbp - 1], r14
cmp byte [rbp - 0x15], r14b
je 0x1400172f9
mov rcx, qword [rbp - 0x11]
test rcx, rcx
je 0x1400172f9
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov qword [rbp - 0x11], r14
jmp 0x14001721c
movzx ebx, byte [r14]
mov edx, 0x50
mov qword [rsp + 0xc0], r12
lea ecx, [rdx - 0x4f]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_calloc]
mov r12, rax
test rax, rax
je 0x140017326
mov byte [rax], bl
cmp dword [rbp - 9], 0
mov dword [rbp - 0x35], 0
jbe 0x140017736
mov r11d, dword [0x1400b385c]
mov edx, dword [0x1400b3844]
mov r8d, dword [0x1400b383c]
mov r9d, dword [0x1400b3860]
mov eax, dword [0x1400b3838]
mov ecx, dword [str.DIV1PBK1CSM1DKT1CBK1CMB1GLB1DBK1PCG1ABK1MBK1PRG1ARP1]
mov r10d, dword [0x1400b3848]
mov qword [rsp + 0xb8], r13
mov r13, qword [rbp - 1]
mov qword [rsp + 0xb0], r15
add r13, 0x18
mov r15, 0xffffffffffffffff
nop dword [rax]
nop dword [rax + rax]
mov ebx, dword [r13 - 0x18]
cmp ebx, r11d
je 0x1400174d0
cmp ebx, edx
je 0x1400174d0
cmp ebx, r8d
je 0x1400174d0
cmp ebx, r9d
je 0x1400174d0
cmp ebx, eax
je 0x14001740a
cmp ebx, ecx
je 0x14001740a
cmp ebx, r10d
je 0x14001740a
mov ecx, 2
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov ecx, ebx
movsx r8d, bl
shr ecx, 0x18
movsx r10d, cl
mov ecx, ebx
shr ecx, 0x10
movsx edx, cl
mov ecx, ebx
shr ecx, 8
mov dword [rsp + 0x28], r10d
movsx r9d, cl
mov rcx, rax
mov dword [rsp + 0x20], edx
lea rdx, str.BAD_QUAD___c_c_c_c__n
call fcn.140016c80
jmp 0x1400176dc
cmp dword [r13], 0
jne 0x14001770a
cmp ebx, eax
jne 0x140017420
lea rsi, [r12 + 0x38]
jmp 0x14001742e
lea rsi, [r12 + 0x40]
cmp ebx, ecx
je 0x14001742e
lea rsi, [r12 + 0x48]
mov rbx, qword [rsi]
test rbx, rbx
je 0x140017456
mov rcx, qword [rbx + 8]
test rcx, rcx
je 0x14001744d
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov qword [rbx + 8], 0
mov rcx, rbx
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov r14, qword [r13 - 8]
mov ecx, 0x10
mov r15d, dword [r13 - 0x14]
mov ebx, dword [r13 - 0x18]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov rdi, rax
test rax, rax
je 0x1400174c6
mov ecx, r15d
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
mov qword [rdi + 8], rax
mov dword [rdi], ebx
mov dword [rdi + 4], r15d
test rax, rax
je 0x1400174a8
test r14, r14
je 0x1400174c8
mov r8d, r15d
mov rdx, r14
mov rcx, rax
call sub.VCRUNTIME140.dll_memcpy
mov qword [rsi], rdi
jmp 0x1400176dc
mov rcx, rax
test rax, rax
je 0x1400174bd
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
xor r14d, r14d
mov qword [rdi + 8], r14
mov rcx, rdi
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
xor edi, edi
mov qword [rsi], rdi
jmp 0x1400176dc
mov ebx, dword [r13]
test ebx, ebx
je 0x14001770a
mov rdi, qword [r13 + 8]
xor esi, esi
mov dword [rbp - 0x39], esi
mov qword [rbp - 0x31], rdi
test ebx, ebx
je 0x14001770a
mov edx, dword [0x1400b3834]
mov ebx, dword [rdi]
mov r8d, dword [0x1400b384c]
mov ecx, dword [0x1400b3840]
mov eax, dword [0x1400b3858]
cmp ebx, edx
je 0x1400175b7
cmp ebx, eax
je 0x1400175b3
cmp ebx, ecx
je 0x1400175b3
cmp ebx, r8d
je 0x1400175b3
cmp ebx, dword [0x1400b3854]
je 0x1400175b3
movsx edi, byte [r13 - 0x15]
mov ecx, 2
movsx esi, byte [r13 - 0x16]
movsx r14d, byte [r13 - 0x17]
movsx r15d, byte [r13 - 0x18]
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov ecx, ebx
mov r9d, r14d
shr ecx, 0x18
mov r8d, r15d
movsx r11d, cl
mov ecx, ebx
shr ecx, 0x10
movsx r10d, cl
mov ecx, ebx
mov dword [rsp + 0x48], r11d
mov dword [rsp + 0x40], r10d
shr ecx, 8
movsx edx, cl
mov dword [rsp + 0x38], edx
lea rdx, str.__c_c_c_c__Unknown_QUAD___c_c_c_c__n
movsx ecx, bl
mov dword [rsp + 0x30], ecx
mov rcx, rax
mov dword [rsp + 0x28], edi
mov dword [rsp + 0x20], esi
call fcn.140016c80
mov rdi, qword [rbp - 0x31]
mov r15, 0xffffffffffffffff
mov esi, dword [rbp - 0x39]
jmp 0x1400176c5
cmp ebx, edx
jne 0x1400175be
lea rbx, [r12 + 0x28]
jmp 0x1400175e3
cmp ebx, eax
jne 0x1400175c9
lea rbx, [r12 + 0x20]
jmp 0x1400175e3
cmp ebx, ecx
jne 0x1400175d4
lea rbx, [r12 + 0x10]
jmp 0x1400175e3
cmp ebx, r8d
lea rbx, [r12 + 0x18]
je 0x1400175e3
lea rbx, [r12 + 8]
cmp qword [rbx], 0
jne 0x1400175fa
mov edx, 0x10
lea ecx, [rdx - 0xf]
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_calloc]
mov qword [rbx], rax
mov r10, qword [rdi + 0x10]
mov ecx, dword [rdi + 4]
sub ecx, 0xc
movzx eax, byte [r10 + 1]
movzx r8d, byte [r10]
movzx r9d, byte [r10 + 4]
movzx edx, byte [r10 + 8]
shl r8d, 8
or r8d, eax
shl r9d, 8
movzx eax, byte [r10 + 2]
shl edx, 8
shl r8d, 8
or r8d, eax
movzx eax, byte [r10 + 3]
shl r8d, 8
or r8d, eax
movzx eax, byte [r10 + 5]
or r9d, eax
movzx eax, byte [r10 + 6]
shl r9d, 8
or r9d, eax
movzx eax, byte [r10 + 7]
shl r9d, 8
or r9d, eax
movzx eax, byte [r10 + 9]
or edx, eax
movzx eax, byte [r10 + 0xa]
shl edx, 8
or edx, eax
movzx eax, byte [r10 + 0xb]
shl edx, 8
or edx, eax
lea rax, [r10 + 0xc]
mov qword [rsp + 0x28], rax
mov dword [rsp + 0x20], ecx
mov ecx, dword [rdi]
call fcn.140016e90
mov rbx, qword [rbx]
mov r14, rax
test rbx, rbx
je 0x1400176c5
test rax, rax
je 0x1400176c5
mov edx, dword [rbx]
mov eax, 8
mov rcx, qword [rbx + 8]
inc edx
mul rdx
cmovo rax, r15
mov rdx, rax
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_realloc]
mov ecx, dword [rbx]
mov qword [rbx + 8], rax
mov qword [rax + rcx*8], r14
inc dword [rbx]
inc esi
add rdi, 0x28
mov dword [rbp - 0x39], esi
mov qword [rbp - 0x31], rdi
cmp esi, dword [r13]
jb 0x1400174f1
mov r11d, dword [0x1400b385c]
mov edx, dword [0x1400b3844]
mov r8d, dword [0x1400b383c]
mov r9d, dword [0x1400b3860]
mov eax, dword [0x1400b3838]
mov ecx, dword [str.DIV1PBK1CSM1DKT1CBK1CMB1GLB1DBK1PCG1ABK1MBK1PRG1ARP1]
mov r10d, dword [0x1400b3848]
mov ebx, dword [rbp - 0x35]
add r13, 0x28
inc ebx
mov r15, 0xffffffffffffffff
mov dword [rbp - 0x35], ebx
cmp ebx, dword [rbp - 9]
jb 0x140017390
mov r15, qword [rsp + 0xb0]
mov r13, qword [rsp + 0xb8]
mov eax, dword [rbp - 9]
test eax, eax
je 0x140017778
mov rbx, qword [rbp - 1]
test rbx, rbx
je 0x140017778
xor edi, edi
test eax, eax
je 0x140017767
nop dword [rax]
mov rcx, rbx
call fcn.140016e00
inc edi
add rbx, 0x28
cmp edi, dword [rbp - 9]
jb 0x140017750
mov rbx, qword [rbp - 1]
mov rcx, rbx
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov qword [rbp - 1], 0
cmp byte [rbp - 0x15], 0
je 0x14001778d
mov rcx, qword [rbp - 0x11]
test rcx, rcx
je 0x14001778d
call qword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov rcx, qword [rbp - 0x29]
mov qword [rbp - 0x11], 0
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov rax, r12
mov r12, qword [rsp + 0xc0]
jmp 0x140017228
mov ecx, 2
call qword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
lea rdx, str.Input_file___s__is_not_a_valid_Triton_PCG__bad_header_._n
jmp 0x140017159