// File: /workspace/github_c_makefile_star2_O0/jonof[P]jfaudiolib/src/fx_man.c
// Function: FX_Init
int FX_Init
   (
   int SoundCard,
   int numvoices,
   int * numchannels,
   int * samplebits,
   int * mixrate,
   void * initdata
   )

   {
   int devicestatus;
   int mincard, maxcard, card;

   if ( FX_Installed )
      {
      FX_Shutdown();
      }

   if (SoundCard == ASS_AutoDetect)
      {
      mincard = ASS_NoSound + 1;
      maxcard = ASS_NumSoundCards - 1;
      }
   else if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards)
      {
      FX_SetErrorCode( FX_InvalidCard );
      return FX_Error;
      }
   else
      {
      mincard = SoundCard;
      maxcard = SoundCard;
      }

   for (card = mincard; card <= maxcard; card++)
      {
      if (!SoundDriver_IsPCMSupported(card))
         {
         continue;
         }
      else if (SoundCard == ASS_AutoDetect)
         {
         ASS_Message("FX_Init: trying %s\n", SoundDriver_GetName(card));
         }

      devicestatus = MV_Init( card, mixrate, numvoices, numchannels, samplebits, initdata );
      if (devicestatus == MV_Ok)
         {
         FX_Installed = TRUE;
         return FX_Ok;
         }
      }

   if (SoundCard == ASS_AutoDetect)
      {
      // A failure to autodetect falls back to no sound.
      card = ASS_NoSound;

      devicestatus = MV_Init( card, mixrate, numvoices, numchannels, samplebits, initdata );
      if ( devicestatus == MV_Ok )
         {
         FX_Installed = TRUE;
         return FX_Ok;
         }
      }

   FX_SetErrorCode( FX_MultiVocError );
   return FX_Error;
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpl $0x0, 0x126c3(%rip)     # 0x15c88
je 0x35cc
callq 0x3700
cmpl $-0x2, -0x8(%rbp)
jne 0x35e2
movl $0x1, -0x38(%rbp)
movl $0x6, -0x3c(%rbp)
jmp 0x3612
cmpl $0x0, -0x8(%rbp)
jl 0x35ee
cmpl $0x7, -0x8(%rbp)
jl 0x3604
movl $0x3, 0x1268c(%rip)     # 0x15c84
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x36eb
movl -0x8(%rbp), %eax
movl %eax, -0x38(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3612
movl -0x38(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jg 0x3694
movl -0x40(%rbp), %edi
callq 0x2d70
cmpl $0x0, %eax
jne 0x362f
jmp 0x3689
cmpl $-0x2, -0x8(%rbp)
jne 0x364e
movl -0x40(%rbp), %edi
callq 0x2e00
movq %rax, %rsi
leaq 0xbdb0(%rip), %rdi      # 0xf3f7
movb $0x0, %al
callq 0xd640
jmp 0x3650
movl -0x40(%rbp), %edi
movq -0x28(%rbp), %rsi
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x7b50
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x3687
movl $0x1, 0x1260a(%rip)     # 0x15c88
movl $0x0, -0x4(%rbp)
jmp 0x36eb
jmp 0x3689
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x3618
cmpl $-0x2, -0x8(%rbp)
jne 0x36da
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %edi
movq -0x28(%rbp), %rsi
movl -0xc(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x7b50
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x36d8
movl $0x1, 0x125b9(%rip)     # 0x15c88
movl $0x0, -0x4(%rbp)
jmp 0x36eb
jmp 0x36da
movl $0x4, 0x125a0(%rip)     # 0x15c84
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)