// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/bamlite.c
// Function: swap_endian_data
static void swap_endian_data(const bam1_core_t *c, int data_len, uint8_t *data)
{
    uint8_t *s;
    uint32_t i, *cigar = (uint32_t*)(data + c->l_qname);
    s = data + c->n_cigar*4 + c->l_qname + c->l_qseq + (c->l_qseq + 1)/2;
    for (i = 0; i < c->n_cigar; ++i) bam_swap_endian_4p(&cigar[i]);
    while (s < data + data_len) {
        uint8_t type;
        s += 2; // skip key
        type = toupper(*s); ++s; // skip type
        if (type == 'C' || type == 'A') ++s;
        else if (type == 'S') { bam_swap_endian_2p(s); s += 2; }
        else if (type == 'I' || type == 'F') { bam_swap_endian_4p(s); s += 4; }
        else if (type == 'D') { bam_swap_endian_8p(s); s += 8; }
        else if (type == 'Z' || type == 'H') { while (*s) ++s; ++s; }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x18, %rcx
andq $0xff, %rcx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x8(%rbp), %rcx
movslq 0x10(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movq 0x8(%rcx), %rcx
shrq $0x30, %rcx
cmpl %ecx, %eax
jae 0x3d9f
movq -0x30(%rbp), %rdi
movl -0x24(%rbp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x3940
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3d6e
jmp 0x3da1
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0xc(%rbp), %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x3eb3
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %edi
callq 0x20c0
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x43, %eax
je 0x3df2
movzbl -0x31(%rbp), %eax
cmpl $0x41, %eax
jne 0x3e03
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3eae
movzbl -0x31(%rbp), %eax
cmpl $0x53, %eax
jne 0x3e26
movq -0x20(%rbp), %rdi
callq 0x4430
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x3eac
movzbl -0x31(%rbp), %eax
cmpl $0x49, %eax
je 0x3e38
movzbl -0x31(%rbp), %eax
cmpl $0x46, %eax
jne 0x3e4f
movq -0x20(%rbp), %rdi
callq 0x3940
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
jmp 0x3eaa
movzbl -0x31(%rbp), %eax
cmpl $0x44, %eax
jne 0x3e6f
movq -0x20(%rbp), %rdi
callq 0x4460
movq -0x20(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
jmp 0x3ea8
movzbl -0x31(%rbp), %eax
cmpl $0x5a, %eax
je 0x3e81
movzbl -0x31(%rbp), %eax
cmpl $0x48, %eax
jne 0x3ea6
jmp 0x3e83
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3e9a
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3e83
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x3ea8
jmp 0x3eaa
jmp 0x3eac
jmp 0x3eae
jmp 0x3da1
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)