Function at 0x180016970
Capabilities:
Resolve function by parsing pe exports

Disassembly:
mov qword [rsp + 0x10], rbx
mov qword [rsp + 0x18], rbp
mov qword [rsp + 0x20], rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0xa0
mov rax, qword [rcx + 0xb8]
xor ebp, ebp
mov r14, r9
mov r15, r8
mov r12, rdx
mov rdi, rcx
cmp rax, qword [rcx + 0xc0]
jae 0x1800169be
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x1800169e2
cmp dword [rcx + 0x30], ebp
je 0x1800169e0
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x1800169e2
mov eax, ebp
movzx r13d, al
mov rax, qword [rdi + 0xb8]
cmp rax, qword [rdi + 0xc0]
jae 0x180016a07
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016a2e
cmp dword [rdi + 0x30], ebp
je 0x180016a2c
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016a2e
mov eax, ebp
movzx eax, al
mov dword [rsp + 0x28], eax
mov rax, qword [rdi + 0xb8]
cmp rax, qword [rdi + 0xc0]
jae 0x180016a56
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016a7d
cmp dword [rdi + 0x30], ebp
je 0x180016a7b
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016a7d
mov eax, ebp
mov rcx, rdi
movzx ebx, al
call fcn.180010c90
mov rcx, rdi
mov dword [rsp + 0x20], eax
call fcn.180010c90
mov rcx, qword [rdi + 0xb8]
mov dword [rsp + 0x3c], eax
cmp rcx, qword [rdi + 0xc0]
jae 0x180016ab9
movzx edx, byte [rcx]
inc rcx
mov qword [rdi + 0xb8], rcx
mov ecx, edx
jmp 0x180016ade
cmp dword [rdi + 0x30], ebp
je 0x180016adc
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
jmp 0x180016ade
mov ecx, ebp
movzx esi, cl
mov rcx, rdi
call fcn.180010c90
mov rcx, rdi
call fcn.180010c90
mov rcx, rdi
call fcn.180010c90
mov rcx, rdi
mov dword [rsp + 0x48], eax
call fcn.180010c90
mov rcx, qword [rdi + 0xb8]
mov dword [rsp + 0x44], eax
cmp rcx, qword [rdi + 0xc0]
jae 0x180016b2a
movzx edx, byte [rcx]
inc rcx
mov qword [rdi + 0xb8], rcx
mov ecx, edx
jmp 0x180016b4f
cmp dword [rdi + 0x30], ebp
je 0x180016b4d
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
jmp 0x180016b4f
mov ecx, ebp
mov rax, qword [rdi + 0xb8]
movzx edx, cl
mov dword [rsp + 0xd0], edx
cmp rax, qword [rdi + 0xc0]
jae 0x180016b7a
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016ba8
cmp dword [rdi + 0x30], ebp
je 0x180016ba6
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
mov edx, dword [rsp + 0xd0]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016ba8
mov eax, ebp
movzx eax, al
mov ecx, 1
mov qword [rsp + 0x70], rbp
mov dword [rsp + 0x24], ebp
mov dword [rsp + 0x38], ebp
mov qword [rsp + 0x78], rbp
cmp ebx, 8
jb 0x180016bcf
sub ebx, 8
mov qword [rsp + 0x78], rcx
mov r9d, dword [rsp + 0x48]
shr eax, 5
and eax, ecx
sub ecx, eax
mov dword [rsp + 0x68], ecx
cmp r9d, 1
jl 0x180016c84
mov r8d, dword [rsp + 0x44]
cmp r8d, 1
jl 0x180016c84
lea eax, [rbx - 1]
cmp eax, 2
ja 0x180016c84
lea eax, [rdx - 8]
test eax, 0xffffffe7
jne 0x180016c84
cmp dword [rsp + 0x28], ebp
mov ecx, dword [rsp + 0xf0]
cmovne edx, esi
mov dword [r12], r9d
mov dword [r15], r8d
mov r15d, edx
lea eax, [rcx - 1]
cmp eax, 3
ja 0x180016c3f
mov r12d, edx
shr r12d, 3
mov dword [rsp + 0x40], r12d
mov dword [r14], r12d
jmp 0x180016c55
mov eax, r15d
shr eax, 3
mov dword [rsp + 0x40], eax
mov ecx, eax
mov dword [rsp + 0xf0], eax
mov dword [r14], eax
mov ebx, r8d
imul ebx, r9d
mov eax, ebx
imul eax, ecx
movsxd rcx, eax
call fcn.18001f884
mov qword [rsp + 0x60], rax
mov r14, rax
test rax, rax
jne 0x180016ca7
lea rax, str.outofmem
mov qword [0x18004f6f0], rax
xor eax, eax
lea r11, [rsp + 0xa0]
mov rbx, qword [r11 + 0x38]
mov rbp, qword [r11 + 0x40]
mov rsi, qword [r11 + 0x48]
mov rsp, r11
pop r15
pop r14
pop r13
pop r12
pop rdi
ret
mov edx, r13d
mov rcx, rdi
call fcn.180015260
cmp dword [rsp + 0x28], ebp
je 0x180016d1a
mov edx, dword [rsp + 0x20]
mov rcx, rdi
call fcn.180015260
imul esi, dword [rsp + 0x3c]
mov eax, esi
cdq
and edx, 7
add eax, edx
sar eax, 3
movsxd rsi, eax
mov rcx, rsi
call fcn.18001f884
mov qword [rsp + 0x70], rax
mov r12, rax
test rax, rax
je 0x180016c76
mov r8d, esi
mov rdx, rax
mov rcx, rdi
call fcn.180010e60
test eax, eax
jne 0x180016d1a
mov rcx, r14
call fcn.18001f87c
mov rcx, r12
call fcn.18001f87c
lea rax, str.bad_palette
jmp 0x180016c7d
xor r10b, r10b
xor r14b, r14b
xor r12b, r12b
mov byte [rsp + 0xd0], r10b
xor r13b, r13b
test ebx, ebx
jle 0x180017093
mov rax, qword [rsp + 0x60]
mov r8d, 1
movzx esi, byte [rsp + 0x21]
mov r9d, ebp
mov qword [rsp + 0x30], rax
mov qword [rsp + 0x58], rax
lea rdx, [rax + 2]
mov eax, ebx
mov ebx, dword [rsp + 0x20]
mov r11, rdx
mov qword [rsp + 0x88], rax
mov qword [rsp + 0x50], rdx
mov qword [rsp + 0x80], rdx
cmp qword [rsp + 0x78], rbp
je 0x180016df3
test r9d, r9d
jne 0x180016de4
mov rax, qword [rdi + 0xb8]
cmp rax, qword [rdi + 0xc0]
jae 0x180016da2
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016dc9
cmp dword [rdi + 0x30], ebp
je 0x180016dc7
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016dc9
mov eax, ebp
movzx eax, al
mov r9d, eax
and r9d, 0x7f
inc r9d
shr eax, 7
mov dword [rsp + 0x38], eax
mov dword [rsp + 0x24], r9d
jmp 0x180016df3
cmp dword [rsp + 0x38], ebp
je 0x180016df3
test r8d, r8d
je 0x180016fbc
cmp dword [rsp + 0x28], ebp
je 0x180016e95
mov rax, qword [rdi + 0xb8]
cmp rax, qword [rdi + 0xc0]
jae 0x180016e1e
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016e45
cmp dword [rdi + 0x30], ebp
je 0x180016e43
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016e45
mov eax, ebp
mov r8d, dword [rsp + 0x40]
movzx eax, al
cmp eax, dword [rsp + 0x3c]
cmovge eax, ebp
imul r8d, eax
test r15d, r15d
je 0x180016f0e
mov eax, r8d
lea rcx, [rsp + 0x20]
lea r8, [rsp + 0x20]
mov edx, ebp
sub rax, r8
mov r8, qword [rsp + 0x70]
add r8, rax
nop dword [rax + rax]
movzx eax, byte [r8 + rcx]
add edx, 8
mov byte [rcx], al
lea rcx, [rcx + 1]
cmp edx, r15d
jl 0x180016e80
jmp 0x180016f05
test r15d, r15d
je 0x180016f0e
mov ebx, ebp
lea rsi, [rsp + 0x20]
nop dword [rax]
nop word [rax + rax]
mov rax, qword [rdi + 0xb8]
cmp rax, qword [rdi + 0xc0]
jae 0x180016ed1
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016ef8
cmp dword [rdi + 0x30], ebp
je 0x180016ef6
mov rcx, rdi
call fcn.180014f80
mov rax, qword [rdi + 0xb8]
movzx ecx, byte [rax]
inc rax
mov qword [rdi + 0xb8], rax
mov eax, ecx
jmp 0x180016ef8
mov eax, ebp
mov byte [rsi], al
add ebx, 8
inc rsi
cmp ebx, r15d
jl 0x180016eb0
movzx esi, byte [rsp + 0x21]
mov ebx, dword [rsp + 0x20]
cmp r15d, 8
je 0x180016f79
cmp r15d, 0x10
je 0x180016f5f
cmp r15d, 0x18
je 0x180016f44
cmp r15d, 0x20
jne 0x180016f92
movzx r10d, byte [rsp + 0x23]
movzx r12d, sil
movzx r13d, byte [rsp + 0x22]
movzx r14d, bl
mov byte [rsp + 0xd0], r10b
jmp 0x180016f9b
movzx r13d, byte [rsp + 0x22]
mov r10b, 0xff
mov byte [rsp + 0xd0], r10b
movzx r12d, sil
movzx r14d, bl
jmp 0x180016f9b
movzx r13d, bl
mov byte [rsp + 0xd0], sil
movzx r12d, bl
movzx r14d, bl
movzx r10d, sil
jmp 0x180016f9b
mov r10b, 0xff
movzx r13d, bl
mov byte [rsp + 0xd0], r10b
movzx r12d, bl
movzx r14d, bl
jmp 0x180016f9b
movzx r10d, byte [rsp + 0xd0]
mov r9d, dword [rsp + 0x24]
mov r11, qword [rsp + 0x80]
mov rdx, qword [rsp + 0x50]
mov dword [rsp + 0x90], ebp
mov r8, qword [rsp + 0x90]
mov ecx, dword [rsp + 0xf0]
sub ecx, 1
je 0x18001702e
sub ecx, 1
je 0x180016ffa
mov rax, qword [rsp + 0x30]
sub ecx, 1
je 0x180016fed
cmp ecx, 1
jne 0x180017059
mov byte [r11 - 2], r13b
mov byte [r11 - 1], r12b
mov byte [r11], r14b
mov byte [r11 + 1], r10b
jmp 0x180017059
mov byte [rdx - 2], r13b
mov byte [rdx - 1], r12b
mov byte [rdx], r14b
jmp 0x180017059
movzx eax, r12b
imul edx, eax, 0x96
movzx eax, r13b
imul ecx, eax, 0x4d
movzx eax, r14b
add edx, ecx
imul ecx, eax, 0x1d
mov rax, qword [rsp + 0x58]
add edx, ecx
mov byte [rax + 1], r10b
shr edx, 8
mov byte [rax], dl
mov rdx, rax
mov rax, qword [rsp + 0x30]
jmp 0x180017054
movzx eax, r12b
imul edx, eax, 0x96
movzx eax, r13b
imul ecx, eax, 0x4d
movzx eax, r14b
add edx, ecx
imul ecx, eax, 0x1d
mov rax, qword [rsp + 0x30]
add edx, ecx
shr edx, 8
mov byte [rax], dl
mov rdx, qword [rsp + 0x50]
add qword [rsp + 0x58], 2
dec r9d
add r11, 4
mov dword [rsp + 0x24], r9d
add rdx, 3
mov qword [rsp + 0x80], r11
inc rax
mov qword [rsp + 0x50], rdx
sub qword [rsp + 0x88], 1
mov qword [rsp + 0x30], rax
jne 0x180016d75
mov rsi, qword [rsp + 0x60]
cmp dword [rsp + 0x68], ebp
je 0x180017118
mov r14d, dword [rsp + 0x44]
test r14d, r14d
jle 0x180017118
mov ebx, dword [rsp + 0x48]
lea r10d, [r14 - 1]
imul ebx, dword [rsp + 0xf0]
mov r11d, ebp
imul r10d, dword [rsp + 0x48]
mov edi, ebx
neg edi
imul r10d, dword [rsp + 0xf0]
nop
mov r8d, ebx
test ebx, ebx
jle 0x18001710a
movsxd rax, r11d
movsxd r9, r10d
sub r9, rax
lea rdx, [rax + rsi]
nop dword [rax]
nop dword [rax + rax]
movzx eax, byte [r9 + rdx]
dec r8d
movzx ecx, byte [rdx]
mov byte [rdx], al
mov byte [r9 + rdx], cl
lea rdx, [rdx + 1]
test r8d, r8d
jg 0x1800170f0
add r11d, ebx
add r10d, edi
add ebp, 2
cmp ebp, r14d
jl 0x1800170d0
mov rax, qword [rsp + 0x70]
test rax, rax
je 0x18001712a
mov rcx, rax
call fcn.18001f87c
mov rax, rsi
jmp 0x180016c86