// File: /workspace/github_c_makefile_star2_O2/jsh58[P]Genrich/Genrich.c
// Function: getBAMscore
float getBAMscore(char* extra, int len) {
  if (extra == NULL)
    return NOSCORE;

  // check auxiliary field
  char tag[3], val;
  tag[2] = '\0';
  int i = 0;
  while (i < len - 4) {

    // load tag and value
    for (int j = 0; j < 3; j++) {
      if (j < 2)
        tag[j] = extra[i];
      else
        val = extra[i];
      i++;
    }

    if (! strcmp(tag, SCORE)) {

      // return alignment score (cast to float)
      extra += i;
      switch (val) {
        case 'c':
          return (float) (int8_t) loadInt(extra, sizeof(int8_t));
        case 'C':
          return (float) (uint8_t) loadInt(extra, sizeof(uint8_t));
        case 's':
          return (float) (int16_t) loadInt(extra, sizeof(int16_t));
        case 'S':
          return (float) (uint16_t) loadInt(extra, sizeof(uint16_t));
        case 'i':
          return (float) (int32_t) loadInt(extra, sizeof(int32_t));
        case 'I':
          return (float) (uint32_t) loadInt(extra, sizeof(uint32_t));
        default: ;
          char msg[4] = "' '";
          msg[1] = val;
          exit(error(msg, ERRTYPE));
      }

    } else {

      // skip to next auxiliary field
      switch (val) {
        case 'A': i++; break;
        case 'c': i += sizeof(int8_t); break;
        case 'C': i += sizeof(uint8_t); break;
        case 's': i += sizeof(int16_t); break;
        case 'S': i += sizeof(uint16_t); break;
        case 'i': i += sizeof(int32_t); break;
        case 'I': i += sizeof(uint32_t); break;
        case 'f': i += sizeof(float); break;
        case 'Z': for (; extra[i] != '\0'; i++) ; i++; break;
        case 'H': for (; extra[i] != '\0'; i += 2) ; i++; break;
        case 'B': i += arrayLen(extra + i); break;
        default: ;
          char msg[4] = "' '";
          msg[1] = val;
          exit(error(msg, ERRTYPE));
      }
    }

    // check if field has gone past end of block
    if (i > len)
      exit(error("", ERRAUX));
  }

  return NOSCORE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0xc5a1
leaq 0x21(%rsp), %rax
movb $0x0, 0x2(%rax)
leal -0x4(%rsi), %eax
movl %eax, 0x24(%rsp)
xorl %ecx, %ecx
movss 0x3d65(%rip), %xmm0     # 0x1018c
movabsq $0x100000000, %r15      # imm = 0x100000000
movq %rsi, 0x28(%rsp)
cmpl 0x24(%rsp), %ecx
jge 0xc64a
movslq %ecx, %rbp
movq 0x10(%rsp), %rax
addq %rbp, %rax
shlq $0x20, %rbp
leal -0x1(%rcx), %ebx
movq %rcx, 0x18(%rsp)
movl %ecx, %r12d
movq %rax, %r13
xorl %r14d, %r14d
cmpq $0x2, %r14
je 0xc477
cmpq $0x3, %r14
je 0xc48b
movb (%rax,%r14), %cl
movb %cl, 0x21(%rsp,%r14)
jmp 0xc47b
movb (%rax,%r14), %dl
incq %r14
addq %r15, %rbp
incl %ebx
incq %r13
incl %r12d
jmp 0xc460
leaq 0x21(%rsp), %rdi
leaq 0x5630(%rip), %rsi      # 0x11ac7
movb %dl, 0xf(%rsp)
pushq $0x3
popq %rdx
callq 0x2240
movb 0xf(%rsp), %dl
movzbl %dl, %ecx
testl %eax, %eax
je 0xc5ae
leal -0x41(%rcx), %eax
cmpl $0x8, %eax
jbe 0xc506
cmpl $0x53, %ecx
movss 0x3cc7(%rip), %xmm0     # 0x1018c
je 0xc4e4
cmpl $0x5a, %ecx
je 0xc4f6
cmpl $0x63, %ecx
je 0xc51e
cmpl $0x66, %ecx
je 0xc52c
cmpl $0x69, %ecx
je 0xc52c
cmpl $0x73, %ecx
jne 0xc659
movq 0x18(%rsp), %rax
leal (%rax,%r14), %r12d
addl $0x2, %r12d
jmp 0xc579
incl %r12d
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0xc4f6
jmp 0xc579
leaq 0x3dd3(%rip), %rcx      # 0x102e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movss 0x3c70(%rip), %xmm0     # 0x1018c
jmpq *%rax
movq 0x18(%rsp), %rax
leal (%rax,%r14), %r12d
incl %r12d
jmp 0xc579
movq 0x18(%rsp), %rax
leal (%rax,%r14), %r12d
addl $0x4, %r12d
jmp 0xc579
sarq $0x20, %rbp
addq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0xc35d
movb 0xf(%rsp), %dl
movss 0x3c34(%rip), %xmm0     # 0x1018c
movq 0x18(%rsp), %rcx
addl %r14d, %ecx
addl %eax, %ecx
movl %ecx, %r12d
jmp 0xc579
movl %ebx, %r12d
addl $0x2, %r12d
cmpb $0x0, (%r13)
leaq 0x2(%r13), %r13
jne 0xc56a
movl %r12d, %ecx
movq 0x28(%rsp), %rsi
cmpl %esi, %r12d
jle 0xc436
leaq 0x557e(%rip), %rdi      # 0x11b0f
pushq $0x1b
popq %rsi
callq 0x2724
pushq $0x1
popq %rdi
callq 0x22a0
movss 0x3be3(%rip), %xmm0     # 0x1018c
jmp 0xc64a
sarq $0x20, %rbp
addq %rbp, 0x10(%rsp)
cmpb $0x43, %dl
je 0xc636
cmpl $0x49, %ecx
je 0xc5fe
cmpl $0x53, %ecx
je 0xc614
cmpl $0x73, %ecx
je 0xc626
cmpl $0x69, %ecx
je 0xc5eb
cmpl $0x63, %ecx
jne 0xc66e
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
movsbl %al, %eax
jmp 0xc646
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
cvtsi2ss %eax, %xmm0
jmp 0xc64a
pushq $0x4
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
movl %eax, %eax
cvtsi2ss %rax, %xmm0
jmp 0xc64a
pushq $0x2
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
movzwl %ax, %eax
jmp 0xc646
pushq $0x2
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
cwtl
jmp 0xc646
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rdi
callq 0xc3cf
movzbl %al, %eax
cvtsi2ss %eax, %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rsp), %rdi
movl $0x272027, (%rdi)       # imm = 0x272027
movb %dl, 0x1(%rdi)
pushq $0x1a
jmp 0xc593
leaq 0x34(%rsp), %rdi
jmp 0xc65e