// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/cram/cram_encode.c
// Function: bam_aux2i_end
static inline int bam_aux2i_end(const uint8_t *aux, const uint8_t *aux_end) {
    int type = *aux++;
    switch (type) {
        case 'c':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *(int8_t *)aux;
        case 'C':
            if (aux_end - aux < 1) {
                errno = EINVAL;
                return 0;
            }
            return *aux;
        case 's':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i16(aux);
        case 'S':
            if (aux_end - aux < 2) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u16(aux);
        case 'i':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_i32(aux);
        case 'I':
            if (aux_end - aux < 4) {
                errno = EINVAL;
                return 0;
            }
            return le_to_u32(aux);
        default:
            errno = EINVAL;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x10(%rbp)
movzbl (%rax), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x43, %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x30, %eax
ja 0x63d54
movq -0x28(%rbp), %rax
leaq 0x8ffc0(%rip), %rcx     # 0xf3bc4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jge 0x63c35
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x63d66
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jge 0x63c6c
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x63d66
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jge 0x63ca3
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rdi
callq 0x63d90
cwtl
movl %eax, -0x4(%rbp)
jmp 0x63d66
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jge 0x63cdd
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rdi
callq 0x63de0
movzwl %ax, %eax
movl %eax, -0x4(%rbp)
jmp 0x63d66
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x4, %rax
jge 0x63d13
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rdi
callq 0x63e00
movl %eax, -0x4(%rbp)
jmp 0x63d66
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
cmpq $0x4, %rax
jge 0x63d46
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x63d66
movq -0x10(%rbp), %rdi
callq 0x63e50
movl %eax, -0x4(%rbp)
jmp 0x63d66
callq 0x4050
movl $0x16, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop