// File: /workspace/github_cpp_makefile_star2_O1/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
movslq %esi, %rdi
cmpl $0x1, %esi
jne 0x7bd9
movl 0x1f0(%r14), %eax
movl 0x1f8(%r14), %ecx
movl %ecx, 0x2e4(%r14)
movl %eax, 0x2e8(%r14)
movq 0x228(%r14), %rax
movq %rax, 0x2f0(%r14)
movq 0x218(%r14), %rax
movq %rax, 0x2f8(%r14)
jmp 0x7c1d
movl 0x1ec(%r14), %eax
leaq (%rdi,%rdi,4), %rcx
shlq $0x4, %rcx
movl %eax, 0x294(%r14,%rcx)
movl 0x1f4(%r14), %eax
movl %eax, 0x298(%r14,%rcx)
movq 0x218(%r14), %rax
movq %rax, 0x2a0(%r14,%rcx)
movq 0x220(%r14), %rax
movq %rax, 0x2a8(%r14,%rcx)
leaq (%rdi,%rdi,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rbp
addq $0x290, %rbp            # imm = 0x290
movl 0x4(%rbp), %eax
movl 0x8(%rbp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, (%rbp)
movb 0x1db(%r14,%rdi), %cl
movb 0x1da(%r14), %al
cmpb %al, %cl
movl %esi, 0x14(%rsp)
movq %rdi, 0x18(%rsp)
jne 0x7ce1
testb %al, %al
je 0x7d7e
movl $0x0, 0xc(%rsp)
cmpl $0x0, (%rbp)
jle 0x7eae
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %eax, %eax
leaq 0xc(%rsp), %r13
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7c9d
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7ca8
movq %r15, %rdi
movq %r13, %rdx
callq 0x86e4
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7cc2
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7ccd
movq %r12, %rdi
movq %r13, %rdx
callq 0x86e4
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
cmpl (%rbp), %eax
jl 0x7c87
jmp 0x7eae
testl %esi, %esi
sete %dl
testb %cl, %dl
je 0x7e1a
movl $0x0, 0xc(%rsp)
cmpl $0x0, (%rbp)
jle 0x7eae
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %eax, %eax
leaq 0xc(%rsp), %r13
imull 0x1e4(%r14), %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7d31
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7d3e
movq %r15, %rdi
leaq 0x10(%rsp), %rdx
callq 0x85a8
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7d58
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7d63
movq %r12, %rdi
movq %r13, %rdx
callq 0x86e4
movl $0x1, 0x4(%rbp)
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
cmpl (%rbp), %eax
jl 0x7d0f
jmp 0x7eae
cmpl $0x0, (%rbp)
jle 0x7eae
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 0x7dc7
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7dd6
movq 0x20(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0x85a8
movl 0x1e4(%r14), %eax
imull %r13d, %eax
movl %eax, 0xc(%rsp)
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7dfb
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7e08
movq %r12, %rdi
leaq 0xc(%rsp), %rdx
callq 0x85a8
movq %r15, 0x4(%rbp)
incl %r13d
cmpl (%rbp), %r13d
jl 0x7da2
jmp 0x7eae
cmpl $0x1, %esi
jne 0x7e27
testb %al, %al
jne 0x7cee
movl $0x0, 0xc(%rsp)
cmpl $0x0, (%rbp)
jle 0x7eae
leaq 0x20(%rbp), %r15
leaq 0x38(%rbp), %r12
xorl %eax, %eax
leaq 0x10(%rsp), %r13
movq 0x28(%rbp), %rsi
cmpq 0x30(%rbp), %rsi
je 0x7e5a
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x28(%rbp)
jmp 0x7e67
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x86e4
movl 0x1e4(%r14), %eax
imull 0xc(%rsp), %eax
movl %eax, 0x10(%rsp)
movq 0x40(%rbp), %rsi
cmpq 0x48(%rbp), %rsi
je 0x7e8d
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x40(%rbp)
jmp 0x7e98
movq %r12, %rdi
movq %r13, %rdx
callq 0x85a8
movl $0x1, 0x8(%rbp)
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
cmpl (%rbp), %eax
jl 0x7e44
testl %ebx, %ebx
je 0x7f59
movl (%rbp), %eax
movq 0x18(%rsp), %rcx
cmpb $0x1, 0x1db(%r14,%rcx)
jne 0x7eef
cmpl $0x0, 0x14(%rsp)
je 0x7f1b
testl %eax, %eax
jle 0x7f59
movq 0x20(%rbp), %rax
xorl %ecx, %ecx
addl %ebx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7ede
jmp 0x7f59
cmpl $0x0, 0x14(%rsp)
je 0x7f36
testl %eax, %eax
jle 0x7f59
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 0x7f00
jmp 0x7f59
testl %eax, %eax
jle 0x7f59
movq 0x38(%rbp), %rax
xorl %ecx, %ecx
addl %ebx, (%rax,%rcx,4)
incq %rcx
movslq (%rbp), %rdx
cmpq %rdx, %rcx
jl 0x7f25
jmp 0x7f59
testl %eax, %eax
jle 0x7f59
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 0x7f40
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq