// File: /workspace/github_c_makefile_star2_O3/calmopyrin[P]tedplay/Tedsound.cpp
// Function: TED::oscillatorInit()
void TED::oscillatorInit()
{
	unsigned int i;

	oscillatorReset();

	int im = 0xff;
    for (i = 0; i < 256; i++) {
		im = (im << 1) | (((im >> 7) ^ (im >> 5) ^ (im >> 4) ^ (im >> 1)) & 1);
		noise[i] = im & 1;
    }
	for (i = 0; i < 64; i++) {
		int chdbl = (i & 0x30) == 0x30;
		int vol = ((i & 0x0F) < 9 ? (i & 0x0F) : 8);
		int nonl = ((chdbl && vol > 1) ? vol * vol * 54 - 173 * vol + 162 : 0);
		volumeTable[i] = (vol && i & 0x30) ?
			(nonl + (586 + (vol - 1) * 1024) << (chdbl ? 1 : 0)) : 0;
	}
	oscStep = (1 << PRECISION) << 0;

	// set player specific parameters
	waveForm[0] = waveForm[1] = 1;
	masterVolume = AMP(8);
	setplaybackSpeed(3);
	enableChannel(0, true);
	enableChannel(1, true);
	enableChannel(2, true);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
movl %eax, 0x1a72a(%rip)     # 0x264e4
movl %eax, 0x1a72c(%rip)     # 0x264ec
movl %eax, 0x1a722(%rip)     # 0x264e8
movl %eax, 0x1a724(%rip)     # 0x264f0
movq $0x0, 0x1a721(%rip) # 0x264f8
movl %eax, 0x1a723(%rip)     # 0x26500
movw %ax, 0x1a720(%rip)      # 0x26504
movw %ax, 0x1a71b(%rip)      # 0x26506
movl %eax, 0x1a717(%rip)     # 0x26508
movl %eax, 0x1a715(%rip)     # 0x2650c
movl %eax, 0x1a713(%rip)     # 0x26510
movl %eax, 0x1a711(%rip)     # 0x26514
movl $0xff, %ecx
leaq 0x1a711(%rip), %rdx     # 0x26520
movl %ecx, %esi
shrl $0x7, %esi
movl %ecx, %edi
shrl $0x5, %edi
xorl %esi, %edi
movl %ecx, %esi
shrl $0x4, %esi
movl %ecx, %r8d
shrl %r8d
xorl %esi, %r8d
xorl %edi, %r8d
andl $0x1, %r8d
leal (%r8,%rcx,2), %ecx
movb %r8b, (%rax,%rdx)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xbe0f
movdqa 0x49b5(%rip), %xmm0     # 0x10800
xorl %eax, %eax
movdqa 0x49bb(%rip), %xmm1     # 0x10810
pxor %xmm3, %xmm3
movdqa 0x49cf(%rip), %xmm4     # 0x10830
movdqa 0x49d7(%rip), %xmm5     # 0x10840
movdqa 0x49df(%rip), %xmm6     # 0x10850
movdqa 0x49e7(%rip), %xmm7     # 0x10860
movdqa 0x49ee(%rip), %xmm8     # 0x10870
movdqa 0x49f5(%rip), %xmm9     # 0x10880
movdqa 0x49fc(%rip), %xmm10    # 0x10890
leaq 0x1a785(%rip), %rcx     # 0x26620
movdqa 0x49fc(%rip), %xmm11    # 0x108a0
movdqa %xmm0, %xmm13
pand %xmm1, %xmm13
movdqa %xmm0, %xmm15
pand 0x4964(%rip), %xmm15    # 0x10820
movdqa %xmm15, %xmm14
pcmpeqd %xmm3, %xmm14
movdqa %xmm13, %xmm12
pcmpeqd %xmm3, %xmm12
por %xmm14, %xmm12
movdqa %xmm15, %xmm2
pcmpgtd %xmm4, %xmm2
pcmpeqd %xmm1, %xmm13
pand %xmm13, %xmm2
movdqa %xmm5, %xmm14
pcmpgtd %xmm15, %xmm14
pand %xmm14, %xmm15
pandn %xmm5, %xmm14
por %xmm15, %xmm14
movdqa %xmm14, %xmm15
pmaddwd %xmm6, %xmm15
paddd %xmm7, %xmm15
pmaddwd %xmm14, %xmm15
paddd %xmm8, %xmm15
pand %xmm2, %xmm15
pslld $0xa, %xmm14
paddd %xmm15, %xmm14
paddd %xmm9, %xmm14
psrld $0x1f, %xmm13
pslld $0x17, %xmm13
paddd %xmm10, %xmm13
cvttps2dq %xmm13, %xmm2
pshufd $0xf5, %xmm14, %xmm13   # xmm13 = xmm14[1,1,3,3]
pmuludq %xmm2, %xmm14
pshufd $0xf5, %xmm2, %xmm2     # xmm2 = xmm2[1,1,3,3]
pmuludq %xmm13, %xmm2
pshufd $0xe8, %xmm14, %xmm13   # xmm13 = xmm14[0,2,2,3]
pshufd $0xe8, %xmm2, %xmm2     # xmm2 = xmm2[0,2,2,3]
punpckldq %xmm2, %xmm13   # xmm13 = xmm13[0],xmm2[0],xmm13[1],xmm2[1]
pandn %xmm13, %xmm12
movdqa %xmm12, (%rax,%rcx)
paddd %xmm11, %xmm0
addq $0x10, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0xbea4
movb $0x1, 0x1a78f(%rip)     # 0x26720
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xb61b0(%rbx)
movl $0x180, 0x1a534(%rip)   # imm = 0x180
movl $0x4, 0xb71b8(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0xbcc0
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0xbcc0
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %edx
popq %rbx
jmp 0xbcc0