// File: /workspace/github_cpp_makefile_star2_O3/tobias93[P]piano/rtaudio/RtAudio.cpp
// Function: RtApi::openStream(RtAudio::StreamParameters*, RtAudio::StreamParameters*, unsigned long, unsigned int, unsigned int*, int (*)(void*, void*, unsigned int, double, unsigned int, void*), void*, RtAudio::StreamOptions*, void (*)(RtAudioError::Type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&))
void RtApi :: openStream( RtAudio::StreamParameters *oParams,
                          RtAudio::StreamParameters *iParams,
                          RtAudioFormat format, unsigned int sampleRate,
                          unsigned int *bufferFrames,
                          RtAudioCallback callback, void *userData,
                          RtAudio::StreamOptions *options,
                          RtAudioErrorCallback errorCallback )
{
  if ( stream_.state != STREAM_CLOSED ) {
    errorText_ = "RtApi::openStream: a stream is already open!";
    error( RtAudioError::INVALID_USE );
    return;
  }

  // Clear stream information potentially left from a previously open stream.
  clearStreamInfo();

  if ( oParams && oParams->nChannels < 1 ) {
    errorText_ = "RtApi::openStream: a non-NULL output StreamParameters structure cannot have an nChannels value less than one.";
    error( RtAudioError::INVALID_USE );
    return;
  }

  if ( iParams && iParams->nChannels < 1 ) {
    errorText_ = "RtApi::openStream: a non-NULL input StreamParameters structure cannot have an nChannels value less than one.";
    error( RtAudioError::INVALID_USE );
    return;
  }

  if ( oParams == NULL && iParams == NULL ) {
    errorText_ = "RtApi::openStream: input and output StreamParameters structures are both NULL!";
    error( RtAudioError::INVALID_USE );
    return;
  }

  if ( formatBytes(format) == 0 ) {
    errorText_ = "RtApi::openStream: 'format' parameter value is undefined.";
    error( RtAudioError::INVALID_USE );
    return;
  }

  unsigned int nDevices = getDeviceCount();
  unsigned int oChannels = 0;
  if ( oParams ) {
    oChannels = oParams->nChannels;
    if ( oParams->deviceId >= nDevices ) {
      errorText_ = "RtApi::openStream: output device parameter value is invalid.";
      error( RtAudioError::INVALID_USE );
      return;
    }
  }

  unsigned int iChannels = 0;
  if ( iParams ) {
    iChannels = iParams->nChannels;
    if ( iParams->deviceId >= nDevices ) {
      errorText_ = "RtApi::openStream: input device parameter value is invalid.";
      error( RtAudioError::INVALID_USE );
      return;
    }
  }

  bool result;

  if ( oChannels > 0 ) {

    result = probeDeviceOpen( oParams->deviceId, OUTPUT, oChannels, oParams->firstChannel,
                              sampleRate, format, bufferFrames, options );
    if ( result == false ) {
      error( RtAudioError::SYSTEM_ERROR );
      return;
    }
  }

  if ( iChannels > 0 ) {

    result = probeDeviceOpen( iParams->deviceId, INPUT, iChannels, iParams->firstChannel,
                              sampleRate, format, bufferFrames, options );
    if ( result == false ) {
      if ( oChannels > 0 ) closeStream();
      error( RtAudioError::SYSTEM_ERROR );
      return;
    }
  }

  stream_.callbackInfo.callback = (void *) callback;
  stream_.callbackInfo.userData = userData;
  stream_.callbackInfo.errorCallback = (void *) errorCallback;

  if ( options ) options->numberOfBuffers = stream_.nBuffers;
  stream_.state = STREAM_STOPPED;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
cmpl $-0x32, 0x1bc(%rdi)
jne 0x51c0
movq %r9, %r15
movl %r8d, %ebp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq 0x78(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x5724
testq %r13, %r13
je 0x51fd
cmpl $0x0, 0x4(%r13)
je 0x5335
testq %r12, %r12
jne 0x5206
movb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x521a
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x442f(%rip), %rcx      # 0x9604
movl $0x2c, %r8d
xorl %esi, %esi
callq 0x4310
movq %rbx, %rdi
movl $0x7, %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5592
testq %r12, %r12
je 0x5395
cmpl $0x0, 0x4(%r12)
je 0x5355
movl $0x0, 0x4(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x582a
testl %eax, %eax
je 0x5375
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
xorl %r9d, %r9d
movl $0x0, %ecx
testq %r13, %r13
je 0x5251
cmpl %eax, (%r13)
jae 0x53b5
movl 0x4(%r13), %ecx
cmpb $0x0, 0x4(%rsp)
jne 0x5267
cmpl %eax, (%r12)
jae 0x53d5
movl 0x4(%r12), %r9d
testl %ecx, %ecx
je 0x52a9
movl (%r13), %esi
movl 0x8(%r13), %r8d
movq (%rbx), %rax
subq $0x8, %rsp
movq %rbx, %rdi
xorl %edx, %edx
movl %ecx, %r13d
movl %r9d, 0xc(%rsp)
movl %ebp, %r9d
pushq 0x10(%rsp)
pushq %r15
pushq %r14
callq *0x68(%rax)
movl 0x24(%rsp), %r9d
movl %r13d, %ecx
addq $0x20, %rsp
testb %al, %al
je 0x53fb
testl %r9d, %r9d
movq 0x8(%rsp), %r13
je 0x52e9
movl (%r12), %esi
movl 0x8(%r12), %r8d
movq (%rbx), %rax
subq $0x8, %rsp
movq %rbx, %rdi
movl $0x1, %edx
movl %ecx, %r12d
movl %r9d, %ecx
movl %ebp, %r9d
pushq %r13
pushq %r15
pushq %r14
callq *0x68(%rax)
addq $0x20, %rsp
testb %al, %al
je 0x53ed
movq 0x10(%rsp), %rax
movq %rax, 0x268(%rbx)
movq 0x18(%rsp), %rax
movq %rax, 0x270(%rbx)
movq 0x20(%rsp), %rax
movq %rax, 0x278(%rbx)
testq %r13, %r13
je 0x531c
movl 0x1e8(%rbx), %eax
movl %eax, 0x4(%r13)
movl $0x0, 0x1bc(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x42e7(%rip), %rcx      # 0x9631
movl $0x6d, %r8d
jmp 0x51db
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x4335(%rip), %rcx      # 0x969f
movl $0x6c, %r8d
jmp 0x51db
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x43d1(%rip), %rcx      # 0x975b
movl $0x39, %r8d
jmp 0x51db
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x4362(%rip), %rcx      # 0x970c
movl $0x4e, %r8d
jmp 0x51db
leaq 0x180(%rbx), %rdi
movq 0x188(%rbx), %rdx
leaq 0x43cb(%rip), %rcx      # 0x9795
movl $0x3c, %r8d
jmp 0x51db
leaq 0x180(%rbx), %rdi
leaq 0x43ef(%rip), %rsi      # 0x97d2
callq 0x4280
jmp 0x51e2
testl %r12d, %r12d
je 0x53fb
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
movq %rbx, %rdi
movl $0x9, %esi
jmp 0x51ea