// File: /workspace/github_c_makefile_star2_O0/johsteffens[P]beth/lib/bcore/bcore.xo.c
// Function: bcore_huffman_count_map_s_decode
bcore_huffman_count_map_s* bcore_huffman_count_map_s_decode( bcore_huffman_count_map_s* o, bcore_huffman_bit_buffer_iterator_s* in )
{
    // bcore_huffman.x:497:1
    
    x_array_clear(((x_array*)(o)));
    sz_t size = bcore_huffman_bit_buffer_iterator_s_read_packed_u3(in);
    x_array_set_size(((x_array*)(o)),size );
    
    sz_t idx = 0;
    u3_t count = bcore_huffman_bit_buffer_iterator_s_read_packed_u3(in);
    ASSERT( count <= o->size );
    for(sz_t i = 0; i < count; i++ ) o->data[ idx++ ].c = 1;
    
    while( idx < o->size )
    {
        sz_t bits_m1 = bcore_huffman_bit_buffer_iterator_s_read_u3(in,6 );
        u3_t count = bcore_huffman_bit_buffer_iterator_s_read_packed_u3(in);
        ASSERT( idx + count <= o->size );
        for(sz_t i = 0; i < count; i++ ) o->data[ idx + i ].c = bcore_huffman_bit_buffer_iterator_s_read_u3(in,bits_m1 ) + ( 1ull << bits_m1 );
        idx += count;
    }
    
    sz_t max_bits = bcore_huffman_bit_buffer_iterator_s_read_u3(in,6 );
    for(sz_t i = 0; i < o->size; i++ ) o->data[ i ].v = bcore_huffman_bit_buffer_iterator_s_read_u3(in,max_bits );
    
    return  o;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x48450
movq -0x10(%rbp), %rdi
callq 0x4fea0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x48400
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4fea0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x4f32f
leaq 0xe4692(%rip), %rdi     # 0x13399f
leaq 0xf051e(%rip), %rsi     # 0x13f832
leaq 0xf04f0(%rip), %rdx     # 0x13f80b
leaq 0xefcec(%rip), %rcx     # 0x13f00e
movl $0xb77, %r8d            # imm = 0xB77
movb $0x0, %al
callq 0x9cea0
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x4f374
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x1, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4f337
jmp 0x4f376
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x4f451
movq -0x10(%rbp), %rdi
movl $0x6, %esi
callq 0x4fe20
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4fea0
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
addq -0x40(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jbe 0x4f3e2
leaq 0xe45df(%rip), %rdi     # 0x13399f
leaq 0xf0465(%rip), %rsi     # 0x13f82c
leaq 0xf043d(%rip), %rdx     # 0x13f80b
leaq 0xefc39(%rip), %rcx     # 0x13f00e
movl $0xb7e, %r8d            # imm = 0xB7E
movb $0x0, %al
callq 0x9cea0
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x40(%rbp), %rax
jae 0x4f440
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x4fe20
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
movq -0x60(%rbp), %rcx
addq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rdx
addq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x4f3ea
movq -0x40(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x4f376
movq -0x10(%rbp), %rdi
movl $0x6, %esi
callq 0x4fe20
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x4f4ac
movq -0x10(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x4fe20
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x58(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x4f46b
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)