// File: /workspace/github_cpp_makefile_star2_O2/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 0x5048
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 0x5468
testq %r13, %r13
je 0x5074
cmpl $0x0, 0x4(%r13)
je 0x51a7
testq %r12, %r12
jne 0x507d
movb $0x1, %al
movl %eax, 0x4(%rsp)
jmp 0x5091
leaq 0x180(%rbx), %rdi
leaq 0x45ae(%rip), %rsi      # 0x9604
callq 0x43e0
pushq $0x7
popq %rsi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x532a
testq %r12, %r12
je 0x51e0
cmpl $0x0, 0x4(%r12)
je 0x51ba
movl $0x0, 0x4(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5564
testl %eax, %eax
je 0x51cd
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
xorl %r9d, %r9d
movl $0x0, %ecx
testq %r13, %r13
je 0x50c8
cmpl %eax, (%r13)
jae 0x51f3
movl 0x4(%r13), %ecx
cmpb $0x0, 0x4(%rsp)
jne 0x50de
cmpl %eax, (%r12)
jae 0x5206
movl 0x4(%r12), %r9d
testl %ecx, %ecx
je 0x5120
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 0x5227
testl %r9d, %r9d
movq 0x8(%rsp), %r13
je 0x515e
movl (%r12), %esi
movl 0x8(%r12), %r8d
movq (%rbx), %rax
subq $0x8, %rsp
pushq $0x1
popq %rdx
movq %rbx, %rdi
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 0x5219
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 0x5191
movl 0x1e8(%rbx), %eax
movl %eax, 0x4(%r13)
andl $0x0, 0x1bc(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x180(%rbx), %rdi
leaq 0x447c(%rip), %rsi      # 0x9631
jmp 0x5056
leaq 0x180(%rbx), %rdi
leaq 0x44d7(%rip), %rsi      # 0x969f
jmp 0x5056
leaq 0x180(%rbx), %rdi
leaq 0x4580(%rip), %rsi      # 0x975b
jmp 0x5056
leaq 0x180(%rbx), %rdi
leaq 0x451e(%rip), %rsi      # 0x970c
jmp 0x5056
leaq 0x180(%rbx), %rdi
leaq 0x4594(%rip), %rsi      # 0x9795
jmp 0x5056
leaq 0x180(%rbx), %rdi
leaq 0x45be(%rip), %rsi      # 0x97d2
jmp 0x5056
testl %r12d, %r12d
je 0x5227
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x38(%rax)
pushq $0x9
jmp 0x505d