// File: /workspace/github_c_makefile_star2_O0/jonof[P]jfaudiolib/src/multivoc.c
// Function: MV_StartDemandFeedPlayback
int MV_StartDemandFeedPlayback
   (
   void ( *function )( char **ptr, unsigned int *length ),
   int rate,
   int pitchoffset,
   int vol,
   int left,
   int right,
   int priority,
   unsigned int callbackval
   )

   {
   VoiceNode *voice;

   if ( !MV_Installed )
      {
      MV_SetErrorCode( MV_NotInstalled );
      return( MV_Error );
      }

   // Request a voice from the voice pool
   voice = MV_AllocVoice( priority );
   if ( voice == NULL )
      {
      MV_SetErrorCode( MV_NoVoices );
      return( MV_Error );
      }

   voice->wavetype    = DemandFeed;
   voice->bits        = 8;
   voice->channels    = 1;
   voice->GetSound    = MV_GetNextDemandFeedBlock;
   voice->NextBlock   = NULL;
   voice->DemandFeed  = function;
   voice->LoopStart   = NULL;
   voice->LoopCount   = 0;
   voice->BlockLength = 0;
   voice->position    = 0;
   voice->sound       = NULL;
   voice->length      = 0;
   voice->BlockLength = 0;
   voice->Playing     = TRUE;
   voice->Paused      = FALSE;
   voice->next        = NULL;
   voice->prev        = NULL;
   voice->priority    = priority;
   voice->callbackval = callbackval;

   MV_SetVoicePitch( voice, rate, pitchoffset );
   MV_SetVoiceVolume( voice, vol, left, right );
   MV_PlayVoice( voice );

   return( voice->handle );
   }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
cmpl $0x0, 0xfd86(%rip)      # 0x15c90
jne 0x5f22
movl $0x2, 0xfd7e(%rip)      # 0x15c94
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6057
movl 0x10(%rbp), %edi
callq 0x4af0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x5f4b
movl $0x4, 0xfd55(%rip)      # 0x15c94
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6057
movq -0x30(%rbp), %rax
movl $0x2, 0x10(%rax)
movq -0x30(%rbp), %rax
movb $0x8, 0x14(%rax)
movq -0x30(%rbp), %rax
movb $0x1, 0x15(%rax)
movq -0x30(%rbp), %rax
leaq 0xef(%rip), %rcx        # 0x6060
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x6c(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x58(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x60(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x30(%rbp), %rax
movl $0x1, 0x70(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x74(%rax)
movq -0x30(%rbp), %rax
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x8(%rax)
movl 0x10(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x7c(%rax)
movl 0x18(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xa0(%rax)
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x4dd0
movq -0x30(%rbp), %rdi
movl -0x1c(%rbp), %esi
movl -0x20(%rbp), %edx
movl -0x24(%rbp), %ecx
callq 0x5220
movq -0x30(%rbp), %rdi
callq 0x45a0
movq -0x30(%rbp), %rax
movl 0x78(%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq