// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/teksnd.c
// Function: initsb
void
initsb(char digistat,char musistat,int mixrate,
    char numspeakers,char bytespersample,char intspersec,char quality)
{
     int err, channels = numspeakers, bitspersample = 4<<bytespersample;
     void *initdata = NULL;

     (void)digistat; (void)musistat; (void)intspersec; (void)quality;

     #ifdef _WIN32
     initdata = (void *) win_gethwnd();
     #endif

     err = FX_Init(ASS_AutoDetect, 16, &channels, &bitspersample, &mixrate, initdata);
     if (err != FX_Ok) {
          buildprintf("FX_Init error: %s\n", FX_ErrorString(err));
     } else {
          fxstarted = 1;

          FX_SetCallBack(soundcallback);
          setupdigi();
     }

     err = MUSIC_Init(ASS_AutoDetect, NULL);
     if (err != MUSIC_Ok) {
          buildprintf("MUSIC_Init error: %s\n", MUSIC_ErrorString(err));
     } else {
          musicstarted = 1;

          setupmidi();
     }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1018, %rsp           # imm = 0x1018
movl %r8d, %esi
movl %ecx, %eax
leaq 0xc(%rsp), %r8
movl %edx, (%r8)
pushq $0x4
popq %rdi
movl %esi, %ecx
shll %cl, %edi
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x4(%rsp), %rcx
movl %edi, (%rcx)
pushq $-0x2
popq %rdi
pushq $0x10
popq %rsi
xorl %r9d, %r9d
callq 0x79b3a
testl %eax, %eax
je 0x1a889
movl %eax, %edi
callq 0x79ae4
leaq 0x677f2(%rip), %rdi     # 0x82042
movq %rax, %rsi
xorl %eax, %eax
callq 0x33127
pushq $-0x2
popq %rdi
xorl %esi, %esi
callq 0x7d2a2
testl %eax, %eax
je 0x1a964
movl %eax, %edi
callq 0x7d254
leaq 0x677db(%rip), %rdi     # 0x82055
movq %rax, %rsi
xorl %eax, %eax
callq 0x33127
jmp 0x1a9f7
movb $0x1, 0x2049e0(%rip)    # 0x21f270
leaq 0x19d(%rip), %rdi       # 0x1aa34
callq 0x79c9c
leaq 0x67865(%rip), %rdi     # 0x82108
xorl %esi, %esi
callq 0x302de
movl %eax, %ebx
movl %eax, 0xadf1e(%rip)     # 0xc87d0
testl %eax, %eax
jns 0x1a8ca
leaq 0x67836(%rip), %rdi     # 0x820f3
xorl %eax, %eax
callq 0x2acb8
movl 0xadf06(%rip), %ebx     # 0xc87d0
leaq 0x10(%rsp), %r14
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x8440
pushq $0x2
popq %rdx
movl %ebx, %edi
movl $0xfffff000, %esi       # imm = 0xFFFFF000
callq 0x306cb
movl 0xadedd(%rip), %edi     # 0xc87d0
movq %r14, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x304e7
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1a915
leaq 0x67801(%rip), %rdi     # 0x8210f
xorl %eax, %eax
callq 0x2acb8
leaq 0x204ae4(%rip), %rbx    # 0x21f400
xorl %r14d, %r14d
movl $0x1380, %edx           # imm = 0x1380
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8440
cmpq $0x9c0, %r14            # imm = 0x9C0
je 0x1aa02
movl 0x10(%rsp,%r14), %eax
shll $0xc, %eax
movl %eax, 0x4(%rbx,%r14,2)
andq $0x0, 0x8(%rbx,%r14,2)
movl 0x14(%rsp,%r14), %eax
movl %eax, 0x10(%rbx,%r14,2)
movb $0x0, 0x14(%rbx,%r14,2)
addq $0xc, %r14
jmp 0x1a92e
movb $0x1, 0x204909(%rip)    # 0x21f274
leaq 0x677d2(%rip), %rdi     # 0x82144
xorl %esi, %esi
callq 0x302de
movl %eax, %ebx
movl %eax, 0xade53(%rip)     # 0xc87d4
testl %eax, %eax
jns 0x1a999
leaq 0x677a3(%rip), %rdi     # 0x8212f
xorl %eax, %eax
callq 0x2acb8
movl 0xade3b(%rip), %ebx     # 0xc87d4
leaq 0x210a70(%rip), %r14    # 0x22b410
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x8440
pushq $0x2
popq %rdx
movl %ebx, %edi
movl $0xfffff000, %esi       # imm = 0xFFFFF000
callq 0x306cb
movl 0xade10(%rip), %edi     # 0xc87d4
movq %r14, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x304e7
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1a9e6
leaq 0x6776b(%rip), %rdi     # 0x8214a
xorl %eax, %eax
callq 0x2acb8
orl $-0x1, 0xadddf(%rip)    # 0xc87cc
movl $0x9, 0x211a19(%rip)    # 0x22c410
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r14
retq
xorl %eax, %eax
leaq 0x204875(%rip), %rcx    # 0x21f280
cmpq $0x180, %rax            # imm = 0x180
je 0x1a85a
orq $-0x1, (%rax,%rcx)
andq $0x0, 0x8(%rax,%rcx)
andl $0x0, 0x10(%rax,%rcx)
movw $0x2, 0x14(%rax,%rcx)
addq $0x18, %rax
jmp 0x1aa0b