// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/cram/cram_decode.c
// Function: cram_decode_aux_1_0
static int cram_decode_aux_1_0(cram_container *c, cram_slice *s,
			       cram_block *blk, cram_record *cr) {
    int i, r = 0, out_sz = 1;
    unsigned char ntags;
	    
    if (!c->comp_hdr->codecs[DS_TC]) return -1;
    r |= c->comp_hdr->codecs[DS_TC]->decode(s, c->comp_hdr->codecs[DS_TC], blk,
					    (char *)&ntags, &out_sz);
    cr->ntags = ntags;

    //printf("TC=%d\n", cr->ntags);
    cr->aux_size = 0;
    cr->aux = BLOCK_SIZE(s->aux_blk);

    for (i = 0; i < cr->ntags; i++) {
	int32_t id, out_sz = 1;
	unsigned char tag_data[3];
	cram_map *m;

	//printf("Tag %d/%d\n", i+1, cr->ntags);
	if (!c->comp_hdr->codecs[DS_TN]) return -1;
	r |= c->comp_hdr->codecs[DS_TN]->decode(s, c->comp_hdr->codecs[DS_TN],
						blk, (char *)&id, &out_sz);
	if (out_sz == 3) {
	    tag_data[0] = ((char *)&id)[0];
	    tag_data[1] = ((char *)&id)[1];
	    tag_data[2] = ((char *)&id)[2];
	} else {
	    tag_data[0] = (id>>16) & 0xff;
	    tag_data[1] = (id>>8)  & 0xff;
	    tag_data[2] = id       & 0xff;
	} 

	m = map_find(c->comp_hdr->tag_encoding_map, tag_data, id);
	if (!m)
	    return -1;
	BLOCK_APPEND(s->aux_blk, (char *)tag_data, 3);

	if (!m->codec) return -1;
	r |= m->codec->decode(s, m->codec, blk, (char *)s->aux_blk, &out_sz);

	cr->aux_size += out_sz + 3;
    }
    
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r15
movl $0x1, 0x24(%rsp)
movq %rdi, 0x28(%rsp)
movq 0x40(%rdi), %rax
movq 0x3e0(%rax), %rsi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x791bf
movq %rcx, %r14
movq %rdx, %rbx
leaq 0x1b(%rsp), %r13
leaq 0x24(%rsp), %r8
movq %r15, %rdi
movq %r13, %rcx
callq *0x18(%rsi)
movl %eax, %ebp
movzbl (%r13), %eax
movl %eax, 0x38(%r14)
movl $0x0, 0x40(%r14)
movq 0x88(%r15), %rcx
movl 0x30(%rcx), %ecx
movl %ecx, 0x3c(%r14)
testl %eax, %eax
je 0x791bf
xorl %eax, %eax
movq %r14, 0x30(%rsp)
movl %eax, 0x20(%rsp)
movl $0x1, 0x14(%rsp)
movq 0x28(%rsp), %rax
movq 0x40(%rax), %rax
movq 0x3b8(%rax), %rsi
testq %rsi, %rsi
je 0x791ba
movq %r15, %rdi
movq %rbx, %rdx
leaq 0x10(%rsp), %rcx
leaq 0x14(%rsp), %r8
callq *0x18(%rsi)
movl %eax, 0x1c(%rsp)
cmpl $0x3, 0x14(%rsp)
jne 0x79021
movb 0x10(%rsp), %r13b
movb 0x11(%rsp), %r14b
movb 0x12(%rsp), %dil
movl 0x10(%rsp), %eax
jmp 0x79035
movl 0x10(%rsp), %eax
movl %eax, %r13d
shrl $0x10, %r13d
movl %eax, %r14d
shrl $0x8, %r14d
movl %eax, %edi
movq 0x28(%rsp), %rcx
movq 0x40(%rcx), %rcx
movzbl %r13b, %edx
leal (%rdx,%rdx,2), %edx
movzbl %r14b, %esi
addl %edx, %esi
andl $0x1f, %esi
movq 0x180(%rcx,%rsi,8), %r12
testq %r12, %r12
movq 0x12faf(%rip), %xmm1    # 0x8c010
movapd 0x12fb7(%rip), %xmm2    # 0x8c020
movsd 0x17877(%rip), %xmm3    # 0x908e8
movsd 0x1f157(%rip), %xmm4    # 0x981d0
movl $0x400, %r9d            # imm = 0x400
je 0x791ba
cmpl %eax, (%r12)
je 0x7909a
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0x79085
jmp 0x791ba
movb %dil, 0xf(%rsp)
movq 0x88(%r15), %rcx
movq 0x20(%rcx), %rax
movq 0x28(%rcx), %rdx
movq 0x30(%rcx), %rsi
leaq 0x3(%rsi), %rdi
cmpq %rdi, %rdx
ja 0x79157
addq $0x28, %rcx
movq %rdx, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
cvttsd2si %xmm1, %rdi
movq %rdi, %r8
sarq $0x3f, %r8
subsd %xmm4, %xmm1
cvttsd2si %xmm1, %rsi
andq %r8, %rsi
orq %rdi, %rsi
testq %rdx, %rdx
cmoveq %r9, %rsi
movq %rsi, (%rcx)
movq %rax, %rdi
callq 0x6c80
movl $0x400, %r9d            # imm = 0x400
movsd 0x1f0b5(%rip), %xmm4    # 0x981d0
movsd 0x177c5(%rip), %xmm3    # 0x908e8
movapd 0x12ef5(%rip), %xmm2    # 0x8c020
movq 0x12edd(%rip), %xmm1    # 0x8c010
movq 0x88(%r15), %rsi
movq %rax, 0x20(%rsi)
leaq 0x28(%rsi), %rcx
movq 0x28(%rsi), %rdx
movq 0x30(%rsi), %rsi
leaq 0x3(%rsi), %rdi
cmpq %rdi, %rdx
jbe 0x790c3
movb %r13b, (%rax,%rsi)
movb %r14b, 0x1(%rax,%rsi)
movb 0xf(%rsp), %cl
movb %cl, 0x2(%rax,%rsi)
movq 0x88(%r15), %rcx
addq $0x3, 0x30(%rcx)
movq 0x10(%r12), %rsi
testq %rsi, %rsi
je 0x791ba
movq %r15, %rdi
movq %rbx, %rdx
leaq 0x14(%rsp), %r8
callq *0x18(%rsi)
orl 0x1c(%rsp), %ebp
orl %eax, %ebp
movl 0x14(%rsp), %eax
movq 0x30(%rsp), %r14
movl 0x40(%r14), %ecx
addl %ecx, %eax
addl $0x3, %eax
movl %eax, 0x40(%r14)
movl 0x20(%rsp), %eax
incl %eax
cmpl 0x38(%r14), %eax
jl 0x78fc9
jmp 0x791bf
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq