// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbp
movq (%rdi), %r15
leaq 0x132212(%rip), %rbx    # 0x19be20
movl (%rbx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rbx,%rax,8), %rcx
movq 0x18(%rbx,%rax,8), %rdx
andq %r15, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r15, %rdx
je 0x69c63
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0x69c63
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0x69c63
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0x69c6c
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x69c93
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r15, %rsi
callq 0xe9bc5
movq %rax, %r12
leaq 0x132198(%rip), %rdi    # 0x19be20
movq %r15, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xebeb6
movq %r14, %rdi
callq 0x6b3d7
movq %rax, %r15
movq (%rbp), %r12
movl (%rbx), %eax
cltq
leaq (%rax,%rax,2), %rax
movq 0x20(%rbx,%rax,8), %rcx
movq 0x18(%rbx,%rax,8), %rdx
andq %r12, %rdx
shlq $0x4, %rdx
leaq (%rcx,%rdx), %rax
movq (%rcx,%rdx), %rdx
movl $0x8, %ecx
cmpq %r12, %rdx
je 0x69d04
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0x69d04
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0x69d04
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0x69d0d
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0x69d34
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r12, %rsi
callq 0xe9bc5
movq %rax, %r13
leaq 0x1320f7(%rip), %rdi    # 0x19be20
movq %r12, %rsi
movq %rax, %rdx
callq 0x115fac
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xec548
movq %r14, %rdi
callq 0x6b3d7
movq %rax, %rbx
cmpq 0x10(%rbp), %rax
jbe 0x69d7e
leaq 0xc38ed(%rip), %rdi     # 0x12d647
leaq 0xcddf1(%rip), %rsi     # 0x137b52
leaq 0xcddc3(%rip), %rdx     # 0x137b2b
leaq 0xcd5bf(%rip), %rcx     # 0x13732e
movl $0xbc6, %r8d            # imm = 0xBC6
xorl %eax, %eax
callq 0xbe4ef
jmp 0x69d83
testq %rbx, %rbx
je 0x69d9d
xorl %eax, %eax
movq %rbx, %rcx
movq 0x8(%rbp), %rdx
movq $0x1, (%rdx,%rax)
addq $0x10, %rax
decq %rcx
jne 0x69d88
cmpq 0x10(%rbp), %rbx
jae 0x69ea0
movq %rbp, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x69800
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %r13
incq %r15
cmpq $0x6, %r15
jne 0x69db7
movq %r14, %rdi
callq 0x6b3d7
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rsp)
addq %rcx, %rax
movq %rax, 0x20(%rsp)
cmpq 0x10(%rbp), %rax
jbe 0x69e20
leaq 0xc3849(%rip), %rdi     # 0x12d647
leaq 0xcdd47(%rip), %rsi     # 0x137b4c
leaq 0xcdd1f(%rip), %rdx     # 0x137b2b
leaq 0xcd51b(%rip), %rcx     # 0x13732e
movl $0xbcd, %r8d            # imm = 0xBCD
xorl %eax, %eax
callq 0xbe4ef
cmpq $0x0, 0x18(%rsp)
je 0x69e8c
movl $0x1, %r15d
movl %r13d, %ecx
shlq %cl, %r15
shlq $0x4, 0x8(%rsp)
xorl %ebx, %ebx
testq %r13, %r13
jle 0x69e64
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x69800
movzbl %al, %eax
movl %r12d, %ecx
shlq %cl, %rax
orq %rax, %rbp
incq %r12
cmpq %r12, %r13
jne 0x69e46
jmp 0x69e66
xorl %ebp, %ebp
addq %r15, %rbp
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
addq 0x8(%rsp), %rax
movq %rbx, %rcx
shlq $0x4, %rcx
movq %rbp, (%rcx,%rax)
incq %rbx
cmpq 0x18(%rsp), %rbx
jne 0x69e3c
movq 0x10(%rsp), %rbp
movq 0x20(%rsp), %rbx
cmpq 0x10(%rbp), %rbx
jb 0x69dac
xorl %r15d, %r15d
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x69800
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %rbx
incq %r15
cmpq $0x6, %r15
jne 0x69ea5
cmpq $0x0, 0x10(%rbp)
je 0x69f12
xorl %r12d, %r12d
movl $0x0, %r13d
testq %rbx, %rbx
jle 0x69ef9
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x69800
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %r13
incq %r15
cmpq %r15, %rbx
jne 0x69edd
movq 0x8(%rbp), %rax
movq %r12, %rcx
shlq $0x4, %rcx
movl %r13d, 0x8(%rax,%rcx)
incq %r12
cmpq 0x10(%rbp), %r12
jb 0x69ecc
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq