// File: /workspace/github_c_makefile_star2_O3/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 0x86af5
testl %eax, %eax
je 0x1c095
movl %eax, %edi
callq 0x86a94
leaq 0x74028(%rip), %rdi     # 0x900ae
movq %rax, %rsi
xorl %eax, %eax
callq 0x372d1
jmp 0x1c1a4
movb $0x1, 0x20d1d4(%rip)    # 0x229270
leaq 0x1d1(%rip), %rdi       # 0x1c274
callq 0x86c7a
leaq 0x740c5(%rip), %rdi     # 0x90174
xorl %esi, %esi
callq 0x34174
movl %eax, %ebx
movl %eax, 0xb6712(%rip)     # 0xd27d0
testl %eax, %eax
jns 0x1c0d6
leaq 0x74096(%rip), %rdi     # 0x9015f
xorl %eax, %eax
callq 0x2eb88
movl 0xb66fa(%rip), %ebx     # 0xd27d0
leaq 0x10(%rsp), %r14
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x8440
movl %ebx, %edi
movl $0xfffff000, %esi       # imm = 0xFFFFF000
movl $0x2, %edx
callq 0x345aa
movl 0xb66cf(%rip), %edi     # 0xd27d0
movq %r14, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x343bc
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1c123
leaq 0x7405f(%rip), %rdi     # 0x9017b
xorl %eax, %eax
callq 0x2eb88
leaq 0x20d2d6(%rip), %rbx    # 0x229400
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 0x1c13c
xorl %eax, %eax
leaq 0x20d108(%rip), %rcx    # 0x229280
movq $-0x1, (%rax,%rcx)
movq $0x0, 0x8(%rax,%rcx)
movl $0x0, 0x10(%rax,%rcx)
movw $0x2, 0x14(%rax,%rcx)
addq $0x18, %rax
cmpq $0x180, %rax            # imm = 0x180
jne 0x1c178
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
xorl %esi, %esi
callq 0x8a76f
testl %eax, %eax
je 0x1c1d1
movl %eax, %edi
callq 0x8a718
leaq 0x73eff(%rip), %rdi     # 0x900c1
movq %rax, %rsi
xorl %eax, %eax
callq 0x372d1
jmp 0x1c269
movb $0x1, 0x20d09c(%rip)    # 0x229274
leaq 0x73fd1(%rip), %rdi     # 0x901b0
xorl %esi, %esi
callq 0x34174
movl %eax, %ebx
movl %eax, 0xb65e6(%rip)     # 0xd27d4
testl %eax, %eax
jns 0x1c206
leaq 0x73fa2(%rip), %rdi     # 0x9019b
xorl %eax, %eax
callq 0x2eb88
movl 0xb65ce(%rip), %ebx     # 0xd27d4
leaq 0x219203(%rip), %r14    # 0x235410
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x8440
movl %ebx, %edi
movl $0xfffff000, %esi       # imm = 0xFFFFF000
movl $0x2, %edx
callq 0x345aa
movl 0xb65a1(%rip), %edi     # 0xd27d4
movq %r14, %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x343bc
cmpl $0x1000, %eax           # imm = 0x1000
je 0x1c255
leaq 0x73f68(%rip), %rdi     # 0x901b6
xorl %eax, %eax
callq 0x2eb88
movl $0xffffffff, 0xb656d(%rip) # imm = 0xFFFFFFFF
movl $0x9, 0x21a1a7(%rip)    # 0x236410
addq $0x1018, %rsp           # imm = 0x1018
popq %rbx
popq %r14
retq