// File: /workspace/github_cpp_makefile_star2_O3/tobias93[P]piano/rtaudio/RtAudio.cpp
// Function: RtApi::setConvertInfo(RtApi::StreamMode, unsigned int)
void RtApi :: setConvertInfo( StreamMode mode, unsigned int firstChannel )
{
  if ( mode == INPUT ) { // convert device to user buffer
    stream_.convertInfo[mode].inJump = stream_.nDeviceChannels[1];
    stream_.convertInfo[mode].outJump = stream_.nUserChannels[1];
    stream_.convertInfo[mode].inFormat = stream_.deviceFormat[1];
    stream_.convertInfo[mode].outFormat = stream_.userFormat;
  }
  else { // convert user to device buffer
    stream_.convertInfo[mode].inJump = stream_.nUserChannels[0];
    stream_.convertInfo[mode].outJump = stream_.nDeviceChannels[0];
    stream_.convertInfo[mode].inFormat = stream_.userFormat;
    stream_.convertInfo[mode].outFormat = stream_.deviceFormat[0];
  }

  if ( stream_.convertInfo[mode].inJump < stream_.convertInfo[mode].outJump )
    stream_.convertInfo[mode].channels = stream_.convertInfo[mode].inJump;
  else
    stream_.convertInfo[mode].channels = stream_.convertInfo[mode].outJump;

  // Set up the interleave/deinterleave offsets.
  if ( stream_.deviceInterleaved[mode] != stream_.userInterleaved ) {
    if ( ( mode == OUTPUT && stream_.deviceInterleaved[mode] ) ||
         ( mode == INPUT && stream_.userInterleaved ) ) {
      for ( int k=0; k<stream_.convertInfo[mode].channels; k++ ) {
        stream_.convertInfo[mode].inOffset.push_back( k * stream_.bufferSize );
        stream_.convertInfo[mode].outOffset.push_back( k );
        stream_.convertInfo[mode].inJump = 1;
      }
    }
    else {
      for ( int k=0; k<stream_.convertInfo[mode].channels; k++ ) {
        stream_.convertInfo[mode].inOffset.push_back( k );
        stream_.convertInfo[mode].outOffset.push_back( k * stream_.bufferSize );
        stream_.convertInfo[mode].outJump = 1;
      }
    }
  }
  else { // no (de)interleaving
    if ( stream_.userInterleaved ) {
      for ( int k=0; k<stream_.convertInfo[mode].channels; k++ ) {
        stream_.convertInfo[mode].inOffset.push_back( k );
        stream_.convertInfo[mode].outOffset.push_back( k );
      }
    }
    else {
      for ( int k=0; k<stream_.convertInfo[mode].channels; k++ ) {
        stream_.convertInfo[mode].inOffset.push_back( k * stream_.bufferSize );
        stream_.convertInfo[mode].outOffset.push_back( k * stream_.bufferSize );
        stream_.convertInfo[mode].inJump = 1;
        stream_.convertInfo[mode].outJump = 1;
      }
    }
  }

  // Add channel offset.
  if ( firstChannel > 0 ) {
    if ( stream_.deviceInterleaved[mode] ) {
      if ( mode == OUTPUT ) {
        for ( int k=0; k<stream_.convertInfo[mode].channels; k++ )
          stream_.convertInfo[mode].outOffset[k] += firstChannel;
      }
      else {
        for ( int k=0; k<stream_.convertInfo[mode].channels; k++ )
          stream_.convertInfo[mode].inOffset[k] += firstChannel;
      }
    }
    else {
      if ( mode == OUTPUT ) {
        for ( int k=0; k<stream_.convertInfo[mode].channels; k++ )
          stream_.convertInfo[mode].outOffset[k] += ( firstChannel * stream_.bufferSize );
      }
      else {
        for ( int k=0; k<stream_.convertInfo[mode].channels; k++ )
          stream_.convertInfo[mode].inOffset[k] += ( firstChannel  * stream_.bufferSize );
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rdi, %r14
cmpl $0x1, %esi
jne 0x7c36
movl 0x1f0(%r14), %eax
movl 0x1f8(%r14), %ecx
movl %ecx, 0x2e4(%r14)
movl %eax, 0x2e8(%r14)
movq 0x228(%r14), %rdx
movq %rdx, 0x2f0(%r14)
movq 0x218(%r14), %rdx
movq %rdx, 0x2f8(%r14)
movl $0x1, %r8d
jmp 0x7c70
movl 0x1ec(%r14), %ecx
movslq %esi, %r8
leaq (%r8,%r8,4), %rdx
shlq $0x4, %rdx
movl %ecx, 0x294(%r14,%rdx)
movl 0x1f4(%r14), %eax
movl %eax, 0x298(%r14,%rdx)
movups 0x218(%r14), %xmm0
movups %xmm0, 0x2a0(%r14,%rdx)
leaq (%r8,%r8,4), %rdx
shlq $0x4, %rdx
leaq (%r14,%rdx), %rbp
addq $0x290, %rbp            # imm = 0x290
cmpl %eax, %ecx
cmovll %ecx, %eax
movl %eax, (%rbp)
movb 0x1db(%r14,%r8), %dl
movb 0x1da(%r14), %cl
cmpb %cl, %dl
movl %esi, 0x14(%rsp)
movq %r8, 0x18(%rsp)
jne 0x7d2e
testb %dl, %dl
je 0x7dcd
movl $0x0, 0xc(%rsp)
testl %eax, %eax
jle 0x7efd
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %ecx, %ecx
leaq 0xc(%rsp), %r13
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7ce8
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7cf3
movq %r15, %rdi
movq %r13, %rdx
callq 0x8730
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7d0d
movl 0xc(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7d1c
movq %r12, %rdi
movq %r13, %rdx
callq 0x8730
movl 0xc(%rsp), %ecx
incl %ecx
movl %ecx, 0xc(%rsp)
movl (%rbp), %eax
cmpl %eax, %ecx
jl 0x7cd2
jmp 0x7efd
testl %esi, %esi
sete %dil
testb %dl, %dil
je 0x7e69
movl $0x0, 0xc(%rsp)
testl %eax, %eax
jle 0x7efd
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %ecx, %ecx
leaq 0xc(%rsp), %r13
imull 0x1e4(%r14), %ecx
movl %ecx, 0x10(%rsp)
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7d7e
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7d8b
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x85f4
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7da5
movl 0xc(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7db4
movq %r12, %rdi
movq %r13, %rdx
callq 0x8730
movl 0xc(%rsp), %ecx
movl $0x1, 0x4(%rbp)
incl %ecx
movl %ecx, 0xc(%rsp)
movl (%rbp), %eax
cmpl %eax, %ecx
jl 0x7d5c
jmp 0x7efd
testl %eax, %eax
jle 0x7efd
leaq 0x20(%rbp), %rax
movq %rax, 0x20(%rsp)
leaq 0x38(%rbp), %r12
xorl %r13d, %r13d
movabsq $0x100000001, %r15      # imm = 0x100000001
movl 0x1e4(%r14), %eax
imull %r13d, %eax
movl %eax, 0xc(%rsp)
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7e14
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7e23
movq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x85f4
movl 0x1e4(%r14), %eax
imull %r13d, %eax
movl %eax, 0xc(%rsp)
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7e48
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7e55
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
callq 0x85f4
movq %r15, 0x4(%rbp)
incl %r13d
movl (%rbp), %eax
cmpl %eax, %r13d
jl 0x7def
jmp 0x7efd
cmpl $0x1, %esi
jne 0x7e76
testb %cl, %cl
jne 0x7d3d
movl $0x0, 0xc(%rsp)
testl %eax, %eax
jle 0x7efd
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %ecx, %ecx
leaq 0x10(%rsp), %r13
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7ea7
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7eb4
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x8730
movl 0x1e4(%r14), %eax
imull 0xc(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7eda
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7ee5
movq %r12, %rdi
movq %r13, %rdx
callq 0x85f4
movl $0x1, 0x8(%rbp)
movl 0xc(%rsp), %ecx
incl %ecx
movl %ecx, 0xc(%rsp)
movl (%rbp), %eax
cmpl %eax, %ecx
jl 0x7e91
testl %ebx, %ebx
je 0x7fa5
movq 0x18(%rsp), %rcx
cmpb $0x1, 0x1db(%r14,%rcx)
jne 0x7f3b
cmpl $0x0, 0x14(%rsp)
je 0x7f67
testl %eax, %eax
jle 0x7fa5
movq 0x20(%rbp), %rax
xorl %ecx, %ecx
addl %ebx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7f2a
jmp 0x7fa5
cmpl $0x0, 0x14(%rsp)
je 0x7f82
testl %eax, %eax
jle 0x7fa5
movq 0x20(%rbp), %rax
xorl %ecx, %ecx
movl 0x1e4(%r14), %edx
imull %ebx, %edx
addl %edx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7f4c
jmp 0x7fa5
testl %eax, %eax
jle 0x7fa5
movq 0x38(%rbp), %rax
xorl %ecx, %ecx
addl %ebx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7f71
jmp 0x7fa5
testl %eax, %eax
jle 0x7fa5
movq 0x38(%rbp), %rax
xorl %ecx, %ecx
movl 0x1e4(%r14), %edx
imull %ebx, %edx
addl %edx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7f8c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq