// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
testq %rdi, %rdi
je 0xdd2b
movl %esi, %r10d
movq %rdi, %rbx
movb $0x0, 0x3(%rsp)
leal -0x4(%r10), %r9d
xorl %r12d, %r12d
movss 0x4594(%rip), %xmm0     # 0x12178
movabsq $0x100000000, %r15      # imm = 0x100000000
leaq 0x479b(%rip), %r14      # 0x12390
movq %r10, 0x8(%rsp)
movl %r9d, 0x4(%rsp)
cmpl %r9d, %r12d
jge 0xde1e
movslq %r12d, %rdi
leaq (%rbx,%rdi), %rdx
shlq $0x20, %rdi
leal 0x1(%r12), %esi
movl %r12d, %r8d
xorl %ebp, %ebp
movl %r8d, %eax
movl %esi, %ecx
movb (%rdx,%rbp), %sil
cmpq $0x2, %rbp
jne 0xdc31
movl %esi, %r13d
jmp 0xdc36
movb %sil, 0x1(%rsp,%rbp)
incq %rbp
addq %r15, %rdi
leal 0x1(%rax), %r8d
leal 0x1(%rcx), %esi
cmpq $0x3, %rbp
jne 0xdc1d
movzwl 0x1(%rsp), %edx
xorl $0x5341, %edx           # imm = 0x5341
movzbl 0x3(%rsp), %esi
orw %dx, %si
movzbl %r13b, %esi
je 0xdd38
cmpl $0x52, %esi
jle 0xdc88
cmpl $0x65, %esi
jg 0xdca5
cmpl $0x53, %esi
je 0xdcb8
cmpl $0x5a, %esi
je 0xdd07
cmpl $0x63, %esi
je 0xdc9d
jmp 0xde2d
leal -0x41(%rsi), %edx
cmpl $0x8, %edx
ja 0xde2d
movslq (%r14,%rdx,4), %rdx
addq %r14, %rdx
jmpq *%rdx
leal (%r12,%rbp), %eax
incl %eax
jmp 0xdd1a
cmpl $0x66, %esi
je 0xdcc1
cmpl $0x69, %esi
je 0xdcc1
cmpl $0x73, %esi
jne 0xde2d
leal (%r12,%rbp), %eax
addl $0x2, %eax
jmp 0xdd1a
leal (%r12,%rbp), %eax
addl $0x4, %eax
jmp 0xdd1a
movslq %ecx, %rcx
addq %rbx, %rcx
addl $0x2, %eax
cmpb $0x0, (%rcx)
leaq 0x2(%rcx), %rcx
jne 0xdcd0
jmp 0xdd1a
sarq $0x20, %rdi
addq %rbx, %rdi
callq 0xdb1c
movq 0x8(%rsp), %r10
movl 0x4(%rsp), %r9d
movss 0x447c(%rip), %xmm0     # 0x12178
addl %ebp, %r12d
addl %eax, %r12d
movl %r12d, %eax
jmp 0xdd1a
movslq %ecx, %rdx
addq %rbx, %rdx
movl %ecx, %eax
incl %eax
cmpb $0x0, (%rdx)
leaq 0x1(%rdx), %rdx
jne 0xdd0f
movl %eax, %r12d
cmpl %r10d, %eax
jle 0xdbff
callq 0x306d
movss 0x4445(%rip), %xmm0     # 0x12178
jmp 0xde1e
sarq $0x20, %rdi
movl %r12d, %eax
addq %rbp, %rax
cmpl $0x62, %esi
jg 0xdd84
cmpl $0x43, %esi
je 0xde0d
cmpl $0x49, %esi
je 0xddbc
cmpl $0x53, %esi
jne 0xde37
cltq
addq %rax, %rbx
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rbx), %edx
shll %cl, %edx
orq %rdx, %rax
addq $0x8, %rcx
incq %rbx
cmpq $0x10, %rcx
jne 0xdd67
movzwl %ax, %eax
jmp 0xde17
cmpl $0x63, %esi
je 0xde13
cmpl $0x69, %esi
je 0xdde6
cmpl $0x73, %esi
jne 0xde37
cltq
addq %rax, %rbx
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rbx), %edx
shll %cl, %edx
orq %rdx, %rax
addq $0x8, %rcx
incq %rbx
cmpq $0x10, %rcx
jne 0xdda4
cwtl
jmp 0xde17
cltq
addq %rax, %rbx
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rbx), %edx
shll %cl, %edx
orq %rdx, %rax
addq $0x8, %rcx
incq %rbx
cmpq $0x20, %rcx
jne 0xddc5
movl %eax, %eax
xorps %xmm0, %xmm0
cvtsi2ss %rax, %xmm0
jmp 0xde1e
cltq
addq %rax, %rbx
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rbx), %edx
shll %cl, %edx
orq %rdx, %rax
addq $0x8, %rcx
incq %rbx
cmpq $0x20, %rcx
jne 0xddef
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
jmp 0xde1e
movzbl (%rbx,%rdi), %eax
jmp 0xde17
movsbl (%rbx,%rdi), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x3085
leaq 0x14(%rsp), %rdi
callq 0x30a0