Function at 0x4017ac
Capabilities:
Encode data using xor

Disassembly:
push rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x518
mov rbx, rdx
xor ecx, ecx
mov r8d, 0x1000000
mov edx, 0x100000
call qword [sym.imp.KERNEL32.dll_HeapCreate]
test rax, rax
mov r12, rax
je 0x402457
mov edx, 8
lea rsi, [0x00497020]
lea rax, section..text
lea r8d, [rdx + 0x48]
mov rcx, r12
mov byte [rsp + 0x68], 0
mov qword [0x00497028], rsi
mov qword [0x00497020], rsi
mov qword [rsp + 0x58], rbx
mov qword [rsp + 0x60], rax
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
test rax, rax
mov rdi, rax
je 0x40244e
xor ecx, ecx
call qword [sym.imp.KERNEL32.dll_GetModuleHandleA]
mov ebp, 0x4b000
mov edx, 8
mov rcx, r12
mov r8, rbp
mov qword [rdi + 0x30], 0
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
xor r9d, r9d
xor r8d, r8d
xor edx, edx
xor ecx, ecx
mov qword [rdi + 0x38], rax
call qword [sym.imp.KERNEL32.dll_CreateEventA]
test rax, rax
mov qword [rdi], rax
je 0x40244e
mov rcx, rdi
mov dword [rsp + 0x578], 0
xor r14d, r14d
xor r13d, r13d
call fcn.00401068
lea rbx, [section..textbss]
test eax, eax
je 0x4023d5
mov rcx, qword [rdi + 0x38]
test rcx, rcx
je 0x4023d5
lea rax, [0x004446e4]
mov qword [rsp + 0x70], rax
lea rax, [0x00446fd0]
mov qword [rsp + 0x78], rax
lea rax, [0x004497a8]
mov qword [rsp + 0x80], rax
lea rax, [0x0044c180]
mov qword [rsp + 0x88], rax
lea rax, [0x0044e970]
mov qword [rsp + 0x90], rax
lea rax, [0x00451408]
mov qword [rsp + 0x98], rax
lea rax, [0x00453e94]
mov qword [rsp + 0xa0], rax
lea rax, [0x00456694]
mov qword [rsp + 0xa8], rax
lea rax, [0x00458fe0]
mov qword [rsp + 0xb0], rax
lea rax, [0x0045b984]
mov qword [rsp + 0xb8], rax
lea rax, [0x0045e348]
mov qword [rsp + 0xc0], rax
lea rax, [0x00460cf4]
mov qword [rsp + 0xc8], rax
lea rax, [0x004636c0]
mov qword [rsp + 0xd0], rax
lea rax, [0x00465dac]
mov qword [rsp + 0xd8], rax
lea rax, [0x00468628]
mov qword [rsp + 0xe0], rax
lea rax, [0x0046ae8c]
mov qword [rsp + 0xe8], rax
lea rax, [0x0046d78c]
mov qword [rsp + 0xf0], rax
lea rax, [0x00470098]
mov qword [rsp + 0xf8], rax
lea rax, [0x0047294c]
mov qword [rsp + 0x100], rax
lea rax, [0x00475108]
mov qword [rsp + 0x108], rax
lea rax, [0x00477884]
mov qword [rsp + 0x110], rax
lea rax, [0x0047a17c]
mov qword [rsp + 0x118], rax
lea rax, [0x0047cad8]
mov qword [rsp + 0x120], rax
lea rax, [0x0047f304]
mov qword [rsp + 0x128], rax
lea rax, [0x00481bb0]
mov qword [rsp + 0x130], rax
lea rax, [0x00484684]
mov qword [rsp + 0x138], rax
lea rax, [0x0048703c]
mov qword [rsp + 0x140], rax
lea rax, [0x00489ae0]
mov qword [rsp + 0x148], rax
lea rax, [0x0048c154]
mov qword [rsp + 0x150], rax
lea rax, [0x0048e7ec]
mov qword [rsp + 0x158], rax
lea rax, [0x00490f60]
mov qword [rsp + 0x160], rax
lea rax, [0x004936b0]
mov qword [rsp + 0x168], rax
lea rax, [0x0044482c]
mov qword [rsp + 0x270], rax
lea rax, [0x00447168]
mov qword [rsp + 0x278], rax
lea rax, [0x004497b4]
mov qword [rsp + 0x280], rax
lea rax, [0x0044c258]
mov qword [rsp + 0x288], rax
lea rax, [0x0044e9c8]
mov qword [rsp + 0x290], rax
lea rax, [0x00451488]
mov qword [rsp + 0x298], rax
lea rax, [0x00454030]
mov qword [rsp + 0x2a0], rax
lea rax, [0x0045671c]
mov qword [rsp + 0x2a8], rax
lea rax, [0x00459018]
mov qword [rsp + 0x2b0], rax
lea rax, [0x0045ba64]
mov qword [rsp + 0x2b8], rax
lea rax, [0x0045e3f8]
mov qword [rsp + 0x2c0], rax
lea rax, [0x00460dec]
mov qword [rsp + 0x2c8], rax
lea rax, [0x00463870]
mov qword [rsp + 0x2d0], rax
lea rax, [0x00465e58]
mov qword [rsp + 0x2d8], rax
lea rax, [0x0046869c]
mov qword [rsp + 0x2e0], rax
lea rax, [0x0046b008]
mov qword [rsp + 0x2e8], rax
lea rax, [0x0046d8f4]
mov qword [rsp + 0x2f0], rax
lea rax, [0x004701f0]
mov qword [rsp + 0x2f8], rax
lea rax, [0x00472ad4]
mov qword [rsp + 0x300], rax
lea rax, [0x0047527c]
mov qword [rsp + 0x308], rax
lea rax, [0x00477984]
mov qword [rsp + 0x310], rax
lea rax, [0x0047a28c]
mov qword [rsp + 0x318], rax
lea rax, [0x0047cbe0]
mov qword [rsp + 0x320], rax
lea rax, [0x0047f378]
mov qword [rsp + 0x328], rax
lea rax, [0x00481bf0]
mov qword [rsp + 0x330], rax
lea rax, [0x004846e0]
mov qword [rsp + 0x338], rax
lea rax, [0x004870c0]
mov qword [rsp + 0x340], rax
lea rax, [0x00489cdc]
mov qword [rsp + 0x348], rax
lea rax, [0x0048c354]
mov qword [rsp + 0x350], rax
lea rax, [0x0048e950]
mov qword [rsp + 0x358], rax
lea rax, [0x0049108c]
mov qword [rsp + 0x360], rax
lea rax, [0x00493788]
mov qword [rsp + 0x368], rax
lea rax, [0x004448d8]
mov qword [rsp + 0x370], rax
lea rax, [0x004472d8]
mov qword [rsp + 0x378], rax
lea rax, [0x00449954]
mov qword [rsp + 0x380], rax
lea rax, [0x0044c4c0]
mov qword [rsp + 0x388], rax
lea rax, [0x0044ea08]
mov qword [rsp + 0x390], rax
lea rax, [0x004514a4]
mov qword [rsp + 0x398], rax
lea rax, [0x0045411c]
mov qword [rsp + 0x3a0], rax
lea rax, [0x004568b4]
mov qword [rsp + 0x3a8], rax
lea rax, [0x004591c4]
mov qword [rsp + 0x3b0], rax
lea rax, [0x0045ba94]
mov qword [rsp + 0x3b8], rax
lea rax, [0x0045e4bc]
mov qword [rsp + 0x3c0], rax
lea rax, [0x00460e20]
mov qword [rsp + 0x3c8], rax
lea rax, [0x00463ad8]
mov qword [rsp + 0x3d0], rax
lea rax, [0x0046609c]
mov qword [rsp + 0x3d8], rax
lea rax, [0x0046893c]
mov qword [rsp + 0x3e0], rax
lea rax, [0x0046b034]
mov qword [rsp + 0x3e8], rax
lea rax, [0x0046d944]
mov qword [rsp + 0x3f0], rax
lea rax, [0x004702dc]
mov qword [rsp + 0x3f8], rax
lea rax, [0x00472c84]
mov qword [rsp + 0x400], rax
lea rax, [0x0047545c]
mov qword [rsp + 0x408], rax
lea rax, [0x00477a74]
mov qword [rsp + 0x410], rax
lea rax, [0x0047a30c]
mov qword [rsp + 0x418], rax
lea rax, [0x0047cdd4]
mov qword [rsp + 0x420], rax
lea rax, [0x0047f5c4]
mov qword [rsp + 0x428], rax
lea rax, [0x00481ca0]
mov qword [rsp + 0x430], rax
lea rax, [0x00484858]
mov qword [rsp + 0x438], rax
lea rax, [0x004870cc]
mov qword [rsp + 0x440], rax
lea rax, [0x00489f1c]
mov qword [rsp + 0x448], rax
lea rax, [0x0048c58c]
mov qword [rsp + 0x450], rax
lea rax, [0x0048eb40]
mov qword [rsp + 0x458], rax
lea rax, [0x00491308]
mov qword [rsp + 0x460], rax
lea rax, [0x004937a4]
mov qword [rsp + 0x468], rax
lea rax, [0x004469ac]
mov qword [rsp + 0x170], rax
lea rax, [0x00449154]
mov qword [rsp + 0x178], rax
lea rax, [0x0044bb68]
mov qword [rsp + 0x180], rax
lea rax, [0x0044e364]
mov qword [rsp + 0x188], rax
lea rax, [0x00450dfc]
mov qword [rsp + 0x190], rax
lea rax, [0x00453870]
mov qword [rsp + 0x198], rax
lea rax, [0x004560b0]
mov qword [rsp + 0x1a0], rax
lea rax, [0x004589b0]
mov qword [rsp + 0x1a8], rax
lea rax, [0x0045b360]
mov qword [rsp + 0x1b0], rax
lea rax, [0x0045dd48]
mov qword [rsp + 0x1b8], rax
lea rax, [0x004606d0]
mov qword [rsp + 0x1c0], rax
lea rax, [0x00463084]
mov qword [rsp + 0x1c8], rax
lea rax, [0x0046574c]
mov qword [rsp + 0x1d0], rax
lea rax, [0x00467fe0]
mov qword [rsp + 0x1d8], rax
lea rax, [0x0046a880]
mov qword [rsp + 0x1e0], rax
lea rax, [0x0046d180]
mov qword [rsp + 0x1e8], rax
lea rax, [0x0046fa68]
mov qword [rsp + 0x1f0], rax
lea rax, [0x00472310]
mov qword [rsp + 0x1f8], rax
lea rax, [0x00474ad8]
mov qword [rsp + 0x200], rax
lea rax, [0x00477260]
mov qword [rsp + 0x208], rax
lea rax, [0x00479b70]
mov qword [rsp + 0x210], rax
lea rax, [0x0047c4a8]
mov qword [rsp + 0x218], rax
lea rax, [0x0047ecc8]
mov qword [rsp + 0x220], rax
lea rax, [0x004815a8]
mov qword [rsp + 0x228], rax
lea rax, [0x00483ff4]
mov qword [rsp + 0x230], rax
lea rax, [0x004869f4]
mov qword [rsp + 0x238], rax
lea rax, [0x004894c0]
mov rdx, rbp
mov qword [rsp + 0x240], rax
lea rax, [0x0048bb18]
mov qword [rsp + 0x248], rax
lea rax, [0x0048e1b0]
mov qword [rsp + 0x250], rax
lea rax, [0x0049096c]
mov qword [rsp + 0x258], rax
lea rax, [0x004930bc]
mov qword [rsp + 0x260], rax
lea rax, [0x00495a80]
mov qword [rsp + 0x268], rax
call fcn.00432414
xor esi, esi
mov qword [rdi + 0x30], rax
lea r15d, [r14 + 0x20]
mov rbx, qword [rsp + rsi + 0x70]
mov rcx, qword [rdi + 0x30]
mov r8d, dword [rbx]
add rcx, qword [rdi + 0x38]
lea rdx, [rbx + 4]
call sub.msvcrt.dll_memcpy
mov ecx, dword [rbx]
mov r8, qword [rsp + rsi + 0x270]
add rcx, qword [rdi + 0x30]
mov rax, rbp
lea rdx, [rsp + 0x38]
mov qword [rdi + 0x30], rcx
mov r9d, dword [r8]
sub rax, rcx
add rcx, qword [rdi + 0x38]
add r8, 4
mov qword [rsp + 0x38], rax
call fcn.00401408
mov r11, qword [rsp + 0x38]
mov rax, qword [rdi + 0x38]
add qword [rdi + 0x30], r11
mov rcx, qword [rdi + 0x30]
mov rbx, rbp
mov rbp, qword [rsp + rsi + 0x370]
sub rbx, rcx
lea r11, [rcx + rax]
xor ecx, ecx
xor r8d, r8d
xor edx, edx
xor r10d, r10d
cmp dword [rbp], ecx
lea r9, [rbp + 4]
jbe 0x402123
mov al, byte [r9]
cmp al, 0x61
jl 0x4020c2
cmp al, 0x66
jg 0x4020c2
sub al, 0x57
jmp 0x4020cc
cmp al, 0x30
jl 0x4020da
cmp al, 0x39
jg 0x4020da
sub al, 0x30
add edx, 1
mov byte [rsp + rcx + 0x570], al
add rcx, 1
cmp edx, 2
jne 0x402115
mov eax, r8d
cmp rax, rbx
jae 0x402123
mov al, byte [rsp + 0x570]
add r8d, 1
xor edx, edx
shl al, 4
or al, byte [rsp + 0x571]
mov byte [r11], al
add r11, 1
xor ecx, ecx
mov byte [rsp + 0x571], cl
mov byte [rsp + 0x570], cl
add r10d, 1
add r9, 1
cmp r10d, dword [rbp]
jb 0x4020b3
mov rdx, qword [rsp + rsi + 0x170]
mov eax, r8d
mov ebp, 0x4b000
add qword [rdi + 0x30], rax
mov rcx, qword [rdi + 0x30]
mov rax, qword [rdi + 0x38]
lea r8, [rcx + rax]
mov r9, rbp
sub r9, rcx
mov rcx, r12
call fcn.004011dc
add rsi, 8
add qword [rdi + 0x30], rax
sub r15, 1
jne 0x402032
test byte [rdi + 0x30], 0xf
jne 0x4023c7
lea rcx, [rsp + 0x480]
lea rdx, str.Roland_GS_Sound_Set_Microsoft__P__1996_Roland_Corporation
lea r8d, [r15 + 0x3a]
call sub.msvcrt.dll_memcpy
mov r8, qword [rdi + 0x30]
lea edx, [r15 + 8]
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
test rax, rax
mov rbp, rax
je 0x4023c7
lea r8d, [r15 + 0x10]
lea rdx, [0x00444690]
lea rcx, [rsp + 0x38]
call sub.msvcrt.dll_memcpy
mov r15, qword [rdi + 0x30]
mov rbx, qword [rdi + 0x38]
test r15, r15
je 0x402233
lea rsi, [rsp + 0x38]
mov r13, rbp
sub rsi, rbx
lea rcx, [rsp + 0x470]
mov r8d, SafeArrayGetLBound
mov rdx, rbx
call sub.msvcrt.dll_memcpy
mov rcx, r13
mov r8d, SafeArrayGetLBound
sub rcx, rbx
mov rdx, r8
mov r11, rbx
mov al, byte [rsi + r11]
xor al, byte [r11]
mov byte [rcx + r11], al
add r11, 1
sub rdx, 1
jne 0x4021f7
lea rdx, [rsp + 0x470]
lea rcx, [rsp + 0x38]
call sub.msvcrt.dll_memcpy
add rbx, 0x10
sub rsi, 0x10
add r13, 0x10
sub r15, 0x10
jne 0x4021cf
mov r13, r14
cmp word [rbp], 0x5346
jne 0x4023b9
movzx edx, word [rbp + 2]
cmp dx, 0xa
jae 0x4023b9
movzx eax, dx
xor r15d, r15d
test dx, dx
lea rcx, [rax + rax*2]
lea rsi, [rbp + 4]
lea rbx, [rbp + rcx*4 + 4]
mov qword [rsp + 0x570], rbx
je 0x4023b9
cmp dword [rsi], 0xbf0e967b
je 0x402330
cmp dword [rsi], 0xcc81fc5d
je 0x4022e2
cmp dword [rsi], 0xfa9d947f
jne 0x4023a4
mov ebx, dword [rsi + 8]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
lea r8, [rbx + 5]
mov rcx, rax
mov edx, 8
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov rbx, qword [rsp + 0x570]
test rax, rax
mov r14, rax
je 0x4023a4
mov ecx, dword [rsi + 8]
mov dword [rax], ecx
mov edx, dword [rsi + 4]
mov r8d, dword [rsi + 8]
lea rcx, [rax + 4]
add rdx, rbx
call sub.msvcrt.dll_memcpy
mov qword [rsp + 0x48], r14
jmp 0x4023a4
mov ebx, dword [rsi + 8]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
lea r8, [rbx + 5]
mov rcx, rax
mov edx, 8
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov rbx, qword [rsp + 0x570]
test rax, rax
mov r13, rax
je 0x4023a4
mov ecx, dword [rsi + 8]
mov dword [rax], ecx
mov edx, dword [rsi + 4]
mov r8d, dword [rsi + 8]
lea rcx, [rax + 4]
add rdx, rbx
call sub.msvcrt.dll_memcpy
mov qword [rsp + 0x50], r13
jmp 0x4023a4
cmp dword [rsi + 8], 0x10000
jae 0x4023a4
lea rdx, [rsp + 0x480]
lea rcx, [rsp + 0x4c0]
mov r8d, 4
call fcn.00401544
lea rdx, [rsp + 0x490]
lea rcx, [rsp + 0x30]
mov r8d, 8
call sub.msvcrt.dll_memcpy
mov r9d, dword [rsi + 8]
mov r8d, dword [rsi + 4]
lea rax, [rsp + 0x30]
lea rdx, [section..textbss]
lea rcx, [rsp + 0x4c0]
shr r9d, 3
add r8, rbx
mov qword [rsp + 0x20], rax
call fcn.00401758
mov dword [rsp + 0x578], 1
movzx eax, word [rbp + 2]
add r15d, 1
add rsi, 0xc
cmp r15d, eax
jb 0x402271
mov r8, rbp
xor edx, edx
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_HeapFree]
lea rsi, [0x00497020]
lea rbx, [section..textbss]
mov rcx, qword [rdi]
mov edx, 0x3e8
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
mov rcx, qword [rdi]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [rsp + 0x578], 0
je 0x402442
test r14, r14
je 0x402442
test r13, r13
je 0x402442
lea rcx, [rsp + 0x48]
call rbx
jmp 0x402442
mov rax, qword [rbx + 8]
mov rcx, qword [rbx]
mov qword [rax], rcx
mov qword [rcx + 8], rax
mov rax, qword [rbx + 0x10]
test rax, rax
je 0x40242e
mov rcx, qword [rbx + 0x20]
xor edx, edx
mov r8d, 0x8000
call rax
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
mov rbx, qword [0x00497020]
cmp rbx, rsi
jne 0x402409
mov rcx, r12
call qword [sym.imp.KERNEL32.dll_HeapDestroy]
add rsp, 0x518
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
pop rbx
ret