Function at 0x4a7280
Capabilities:
Encode data using xor

Disassembly:
push ebp
push edi
push esi
push ebx
mov ebx, ecx
sub esp, 0x3c
call method.AGB_APU.buffer_channel_1__
mov ecx, dword [ebx + 0xa0174]
add word [ebx + 0x40090], cx
cmp byte [ebx + 0x2006c], 0
je 0x4a7415
cmp byte [ebx + 0x2006f], 0
je 0x4a7408
fld qword [ebx + 0xa0180]
fld qword [ebx + 0x20058]
fdivr st(1)
fstp qword [esp + 8]
cvttsd2si esi, qword [esp + 8]
test ecx, ecx
jle 0x4a75ad
test esi, esi
lea eax, [esi + 7]
movzx edx, byte [ebx + 0x20075]
mov dword [esp + 0x1c], esi
cmovns eax, esi
mov ebp, dword [ebx + 0x2008c]
mov edi, ecx
mov byte [esp + 8], dl
sar eax, 3
mov dword [esp + 0x24], edx
xor edx, edx
mov dword [esp + 0x18], eax
lea esi, [esi]
cmp byte [esp + 8], 0
je 0x4a7369
mov ecx, dword [ebx + 0x20078]
add ecx, 1
movd xmm0, ecx
mov dword [ebx + 0x20078], ecx
movq qword [esp + 0x28], xmm0
fild qword [esp + 0x28]
fild dword [esp + 0x24]
fld st(2)
fmul dword [0x606cf0]
fmulp st(1)
fxch st(1)
fcompi st(1)
fstp st(0)
jb 0x4a7369
movzx eax, byte [ebx + 0x20074]
test al, al
jne 0x4a7680
mov ecx, dword [ebx + 0x20068]
test ecx, ecx
jne 0x4a76a8
mov dword [ebx + 0x20078], 0
test ebp, ebp
jle 0x4a75c8
mov eax, dword [ebx + 0x20088]
mov ecx, dword [esp + 0x1c]
mov esi, 0
mov word [esp + 0x10], 0x8000
add eax, 1
cmp eax, ecx
movzx ecx, word [ebx + 0x40092]
cmovae eax, esi
mov esi, dword [esp + 0x18]
mov word [esp + 0x22], cx
movzx ecx, byte [ebx + 0x20072]
mov dword [ebx + 0x20088], eax
imul ecx, esi
cmp eax, ecx
jae 0x4a75e8
movzx esi, word [esp + 0x22]
movzx ecx, word [esp + 0x10]
sub ebp, 1
lea eax, [esi + 1]
mov word [ebx + 0x40092], ax
mov word [ebx + esi*2 + 0x20090], cx
lea esi, [esi]
lea esi, [esi]
add edx, 1
cmp edi, edx
jne 0x4a7308
fstp st(0)
jmp 0x4a73f8
fstp st(0)
lea esi, [esi]
mov dword [ebx + 0x2008c], ebp
jmp 0x4a75af
cmp byte [ebx + 0x2006e], 0
jne 0x4a72b5
test ecx, ecx
jle 0x4a75af
mov esi, ecx
movzx edx, word [ebx + 0x40092]
xor eax, eax
and esi, 7
je 0x4a74f8
cmp esi, 1
je 0x4a74da
cmp esi, 2
je 0x4a74c4
cmp esi, 3
je 0x4a74ae
cmp esi, 4
je 0x4a7498
cmp esi, 5
je 0x4a7482
cmp esi, 6
je 0x4a746c
movzx eax, dx
mov edi, 0xffff8000
mov word [ebx + eax*2 + 0x20090], di
mov eax, 1
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
lea ebp, [edx + eax]
mov edi, 0xffff8000
add eax, 1
movzx esi, bp
mov word [ebx + esi*2 + 0x20090], di
cmp ecx, eax
je 0x4a75a2
lea ebp, [edx + eax]
mov edi, 0xffff8000
movzx esi, bp
lea ebp, [edx + eax + 1]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 2]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 3]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 4]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 5]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 6]
mov word [ebx + esi*2 + 0x20090], di
movzx esi, bp
mov edi, 0xffff8000
lea ebp, [edx + eax + 7]
mov word [ebx + esi*2 + 0x20090], di
add eax, 8
movzx esi, bp
mov edi, 0xffff8000
mov word [ebx + esi*2 + 0x20090], di
cmp ecx, eax
jne 0x4a74f8
add edx, ecx
mov word [ebx + 0x40092], dx
jmp 0x4a75af
fstp st(0)
mov ecx, ebx
call method.AGB_APU.buffer_channel_3__
add esp, 0x3c
mov ecx, ebx
pop ebx
pop esi
pop edi
pop ebp
jmp method.AGB_APU.buffer_channel_4__
jne 0x4a75dd
cmp byte [ebx + 0x20070], 0
jne 0x4a7638
fst qword [esp + 0x10]
cvttsd2si ebp, qword [esp + 0x10]
sub ebp, 1
jmp 0x4a73e0
movzx ecx, byte [ebx + 0x20073]
imul ecx, esi
cmp eax, ecx
jae 0x4a73b7
mov eax, dword [ebx + 0x20068]
test eax, eax
je 0x4a73b7
movd xmm1, eax
movq qword [esp + 0x28], xmm1
fild qword [esp + 0x28]
fmul qword [ebx + 0xa0198]
fsub dword [0x606cf4]
fstp qword [esp + 0x10]
cvttsd2si esi, qword [esp + 0x10]
mov dword [esp + 0x10], esi
jmp 0x4a73b7
movzx ebp, word [ebx + 0x40092]
mov esi, 0xffff8000
add edx, 1
lea eax, [ebp + 1]
mov word [ebx + 0x40092], ax
mov word [ebx + ebp*2 + 0x20090], si
mov ebp, 0xffffffff
mov byte [ebx + 0x2006c], 0
cmp edi, edx
je 0x4a73ef
cmp byte [esp + 8], 0
jne 0x4a730f
jmp 0x4a75dd
cmp al, 1
jne 0x4a735f
mov esi, dword [ebx + 0x20068]
cmp esi, 0xe
ja 0x4a735f
add esi, 1
mov dword [ebx + 0x20068], esi
jmp 0x4a735f
sub ecx, 1
mov dword [ebx + 0x20068], ecx
jmp 0x4a735f