// File: /workspace/github_c_makefile_star2_O1/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)
movl $0x4, %edi
movl %esi, %ecx
shll %cl, %edi
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x4(%rsp), %rcx
movl %edi, (%rcx)
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
movl $0x10, %esi
xorl %r9d, %r9d
callq 0x83f5b
testl %eax, %eax
je 0x1bf21
movl %eax, %edi
callq 0x83efc
leaq 0x710bc(%rip), %rdi     # 0x8cfce
movq %rax, %rsi
xorl %eax, %eax
callq 0x36050
jmp 0x1c027
movb $0x1, 0x20a328(%rip)    # 0x226250
leaq 0x1c4(%rip), %rdi       # 0x1c0f3
callq 0x840e5
leaq 0x71159(%rip), %rdi     # 0x8d094
xorl %esi, %esi
callq 0x32dbc
movl %eax, 0xb3888(%rip)     # 0xcf7d0
testl %eax, %eax
jns 0x1bf5a
leaq 0x7112c(%rip), %rdi     # 0x8d07f
xorl %eax, %eax
callq 0x2d800
leaq 0x10(%rsp), %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8440
movl 0xb385c(%rip), %edi     # 0xcf7d0
movl $0xfffff000, %esi       # imm = 0xFFFFF000
movl $0x2, %edx
callq 0x33214
movl 0xb3847(%rip), %edi     # 0xcf7d0
movq %rbx, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3302e
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1bfab
leaq 0x710f7(%rip), %rdi     # 0x8d09b
xorl %eax, %eax
callq 0x2d800
leaq 0x20a42e(%rip), %rbx    # 0x2263e0
xorl %r14d, %r14d
movl $0x1380, %edx           # imm = 0x1380
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8440
movl 0x10(%rsp,%r14), %eax
movl 0x14(%rsp,%r14), %ecx
shll $0xc, %eax
movl %eax, 0x4(%rbx,%r14,2)
movq $0x0, 0x8(%rbx,%r14,2)
movl %ecx, 0x10(%rbx,%r14,2)
movb $0x0, 0x14(%rbx,%r14,2)
addq $0xc, %r14
cmpq $0x9c0, %r14            # imm = 0x9C0
jne 0x1bfc4
xorl %eax, %eax
leaq 0x20a260(%rip), %rcx    # 0x226260
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movl %edx, (%rax,%rcx)
movups %xmm0, 0x4(%rax,%rcx)
movw $0x2, 0x14(%rax,%rcx)
movl %edx, 0x4(%rax,%rcx)
addq $0x18, %rax
cmpq $0x180, %rax            # imm = 0x180
jne 0x1c008
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
xorl %esi, %esi
callq 0x87b5d
testl %eax, %eax
je 0x1c054
movl %eax, %edi
callq 0x87b08
leaq 0x70f9c(%rip), %rdi     # 0x8cfe1
movq %rax, %rsi
xorl %eax, %eax
callq 0x36050
jmp 0x1c0e8
movb $0x1, 0x20a1f9(%rip)    # 0x226254
leaq 0x7106e(%rip), %rdi     # 0x8d0d0
xorl %esi, %esi
callq 0x32dbc
movl %eax, 0xb3765(%rip)     # 0xcf7d4
testl %eax, %eax
jns 0x1c081
leaq 0x71041(%rip), %rdi     # 0x8d0bb
xorl %eax, %eax
callq 0x2d800
leaq 0x216368(%rip), %rbx    # 0x2323f0
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8440
movl 0xb3737(%rip), %edi     # 0xcf7d4
movl $0xfffff000, %esi       # imm = 0xFFFFF000
movl $0x2, %edx
callq 0x33214
movl 0xb3722(%rip), %edi     # 0xcf7d4
movq %rbx, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x3302e
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1c0d4
leaq 0x71009(%rip), %rdi     # 0x8d0d6
xorl %eax, %eax
callq 0x2d800
movl $0xffffffff, 0xb36ee(%rip) # imm = 0xFFFFFFFF
movl $0x9, 0x217308(%rip)    # 0x2333f0
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r14
retq