// File: /workspace/github_cpp_makefile_star2_O2/VanAndelInstitute[P]intent/src/seq_tools.cpp
// Function: format_barcode(ParsedBarcode, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
FastqRead format_barcode(ParsedBarcode bc, 
                         std::string id, 
                         std::string direction,
                         int format) {
  FastqRead read;
  int length = bc.barcode1.length();
  if(format == FORMAT_V2) {
      read.read = bc.barcode2 + 
                  bc.barcode1.substr(length - 8) + 
                  bc.barcode2.substr(4,4) + bc.UMI;
      read.quality = bc.barcode2_quality + 
                     bc.barcode1_quality.substr(length - 8) +
                     bc.barcode2_quality.substr(4,4) + bc.UMI_quality;
      read.direction = direction;
      read.id = id;
  } else if(format == FORMAT_V3) {
      read.read = bc.barcode2 + 
                  bc.barcode1.substr(length - 8) + 
                  bc.barcode2.substr(2,6) + bc.UMI;
      read.quality = bc.barcode2_quality + 
                     bc.barcode1_quality.substr(length - 8) +
                     bc.barcode2_quality.substr(2,6) + bc.UMI_quality;
      read.direction = direction;
      read.id = id;
  } else if(format == FORMAT_EXTENDED) {
      std::string cb1 = bc.barcode1;
      std::string cb1_q = bc.barcode1_quality;
      if(cb1.length() < 12) {
              cb1.insert(cb1.begin(), 12 - cb1.length(), 'G');
              cb1_q.insert(cb1_q.begin(), 12 - cb1_q.length(), 'A');
      }
      read.read = cb1 + 
                  bc.barcode2 + 
                  bc.barcode2 +
                  bc.UMI;
      read.quality =cb1_q + 
                  bc.barcode2_quality + 
                  bc.barcode2_quality +
                  bc.UMI_quality;
      read.direction = direction;
      read.id = id;
  } else {
    std::cout << "Bad barcode format specified\n\n";
    exit(0);
  }
  return(read);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
callq 0x26088
leaq 0x8(%r12), %rsi
cmpl $0x2, %ebp
je 0x25cfd
movq 0x10(%r12), %rax
cmpl $0x1, %ebp
je 0x25b7c
testl %ebp, %ebp
jne 0x25e7d
addl $-0x8, %eax
movslq %eax, %r13
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r13, %rdx
callq 0x6410
leaq 0x48(%r12), %rbp
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbp, %rsi
callq 0x26121
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rcx
movq %rbp, %rsi
movq %rcx, %rdx
callq 0x6410
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x15985
leaq 0x88(%r12), %rdx
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x158f5
leaq 0x20(%rbx), %rdi
leaq 0x88(%rsp), %rbp
movq %rbp, %rsi
callq 0x64d0
movq %rbp, %rdi
callq 0x6768
leaq 0x48(%rsp), %rdi
callq 0x6768
leaq 0x8(%rsp), %rdi
callq 0x6768
leaq 0x68(%rsp), %rdi
callq 0x6768
leaq 0x28(%rsp), %rdi
callq 0x6768
leaq 0x28(%r12), %rsi
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r13, %rdx
callq 0x6410
leaq 0x68(%r12), %r13
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %r13, %rsi
callq 0x26121
leaq 0x8(%rsp), %rdi
pushq $0x4
popq %rcx
movq %r13, %rsi
movq %rcx, %rdx
callq 0x6410
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x15985
addq $0xa8, %r12
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r12, %rdx
callq 0x158f5
jmp 0x25c9d
addl $-0x8, %eax
movslq %eax, %r13
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r13, %rdx
callq 0x6410
leaq 0x48(%r12), %rbp
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %rbp, %rsi
callq 0x26121
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $0x6
popq %rcx
movq %rbp, %rsi
callq 0x6410
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x15985
leaq 0x88(%r12), %rdx
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x158f5
leaq 0x20(%rbx), %rdi
leaq 0x88(%rsp), %rbp
movq %rbp, %rsi
callq 0x64d0
movq %rbp, %rdi
callq 0x6768
leaq 0x48(%rsp), %rdi
callq 0x6768
leaq 0x8(%rsp), %rdi
callq 0x6768
leaq 0x68(%rsp), %rdi
callq 0x6768
leaq 0x28(%rsp), %rdi
callq 0x6768
leaq 0x28(%r12), %rsi
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rcx
movq %r13, %rdx
callq 0x6410
leaq 0x68(%r12), %r13
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rdx
movq %r13, %rsi
callq 0x26121
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rdx
pushq $0x6
popq %rcx
movq %r13, %rsi
callq 0x6410
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x15985
addq $0xa8, %r12
leaq 0x88(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r12, %rdx
callq 0x158f5
leaq 0x60(%rbx), %rdi
leaq 0x88(%rsp), %r12
movq %r12, %rsi
callq 0x64d0
movq %r12, %rdi
callq 0x6768
leaq 0x48(%rsp), %rdi
callq 0x6768
leaq 0x8(%rsp), %rdi
callq 0x6768
leaq 0x68(%rsp), %rdi
callq 0x6768
leaq 0x28(%rsp), %rdi
callq 0x6768
leaq 0x40(%rbx), %rdi
movq %r15, %rsi
callq 0x6280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6280
jmp 0x25e68
leaq 0x88(%rsp), %rdi
callq 0x6580
leaq 0x28(%r12), %rsi
leaq 0x48(%rsp), %rdi
callq 0x6580
movq 0x90(%rsp), %rax
cmpq $0xb, %rax
ja 0x25d5b
leaq 0x88(%rsp), %rdi
movq (%rdi), %rsi
pushq $0xc
popq %r13
movq %r13, %rdx
subq %rax, %rdx
pushq $0x47
popq %rcx
callq 0x64e0
leaq 0x48(%rsp), %rdi
movq (%rdi), %rsi
subq 0x8(%rdi), %r13
pushq $0x41
popq %rcx
movq %r13, %rdx
callq 0x64e0
leaq 0x48(%r12), %r13
leaq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
movq %r13, %rdx
callq 0x26145
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x158f5
leaq 0x88(%r12), %rdx
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x158f5
leaq 0x20(%rbx), %rdi
leaq 0x68(%rsp), %r13
movq %r13, %rsi
callq 0x64d0
movq %r13, %rdi
callq 0x6768
leaq 0x28(%rsp), %rdi
callq 0x6768
leaq 0x8(%rsp), %rdi
callq 0x6768
leaq 0x68(%r12), %r13
leaq 0x8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
movq %r13, %rdx
callq 0x26145
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x158f5
addq $0xa8, %r12
leaq 0x68(%rsp), %rdi
leaq 0x28(%rsp), %rsi
movq %r12, %rdx
callq 0x158f5
leaq 0x60(%rbx), %rdi
leaq 0x68(%rsp), %r12
movq %r12, %rsi
callq 0x64d0
movq %r12, %rdi
callq 0x6768
leaq 0x28(%rsp), %rdi
callq 0x6768
leaq 0x8(%rsp), %rdi
callq 0x6768
leaq 0x40(%rbx), %rdi
movq %r15, %rsi
callq 0x6280
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6280
leaq 0x48(%rsp), %rdi
callq 0x6768
leaq 0x88(%rsp), %rdi
callq 0x6768
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x12134(%rip), %rdi     # 0x37fb8
leaq 0x3855(%rip), %rsi      # 0x296e0
callq 0x63c0
xorl %edi, %edi
callq 0x64c0
jmp 0x25f28
jmp 0x25f28
jmp 0x25ede
jmp 0x25ede
jmp 0x25ef1
jmp 0x25ebc
jmp 0x25ef1
jmp 0x25f02
jmp 0x25ecf
jmp 0x25f02
jmp 0x25f18
jmp 0x25f28
jmp 0x25f18
jmp 0x25f44
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x6768
jmp 0x25ed2
jmp 0x25f44
jmp 0x25ede
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6768
jmp 0x25f2b
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x6768
jmp 0x25ef4
jmp 0x25ef1
jmp 0x25f28
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6768
jmp 0x25f05
jmp 0x25f02
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x6768
jmp 0x25f1b
jmp 0x25f18
movq %rax, %r14
jmp 0x25f35
movq %rax, %r14
leaq 0x28(%rsp), %rdi
jmp 0x25f3d
jmp 0x25f44
jmp 0x25f44
jmp 0x25f44
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x6768
leaq 0x88(%rsp), %rdi
callq 0x6768
jmp 0x25f47
movq %rax, %r14
movq %rbx, %rdi
callq 0x14b72
movq %r14, %rdi
callq 0x66a0
nop