// File: /workspace/github_c_makefile_star2_O1/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 0x138ce6(%rip), %rbx    # 0x1a8e20
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 0x70193
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r15, %rdx
je 0x70193
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r15, %rdx
je 0x70193
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r15, %rdx
jne 0x7045a
movq (%rax,%rcx), %r12
testq %r12, %r12
jne 0x701c3
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r15, %rsi
callq 0xf3f85
movq %rax, %r12
leaq 0x138c68(%rip), %rdi    # 0x1a8e20
movq %r15, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r12, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xf6359
movq %r14, %rdi
callq 0x7198e
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 0x70238
movq 0x10(%rax), %rdx
movl $0x18, %ecx
cmpq %r12, %rdx
je 0x70238
movq 0x20(%rax), %rdx
movl $0x28, %ecx
cmpq %r12, %rdx
je 0x70238
movq 0x30(%rax), %rdx
movl $0x38, %ecx
cmpq %r12, %rdx
jne 0x70462
movq (%rax,%rcx), %r13
testq %r13, %r13
jne 0x70268
movabsq $-0x5073d588c3beb52e, %rdi # imm = 0xAF8C2A773C414AD2
movq %r12, %rsi
callq 0xf3f85
movq %rax, %r13
leaq 0x138bc3(%rip), %rdi    # 0x1a8e20
movq %r12, %rsi
movq %rax, %rdx
callq 0x12128c
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf69d8
movq %r14, %rdi
callq 0x7198e
movq %rax, %rbx
cmpq 0x10(%rbp), %rax
jbe 0x702b0
leaq 0xc83b9(%rip), %rdi     # 0x138647
leaq 0xd2a45(%rip), %rsi     # 0x142cda
leaq 0xd2a17(%rip), %rdx     # 0x142cb3
leaq 0xd2213(%rip), %rcx     # 0x1424b6
movl $0xbc6, %r8d            # imm = 0xBC6
xorl %eax, %eax
callq 0xc8053
testq %rbx, %rbx
je 0x702d1
xorl %eax, %eax
movq %rbx, %rcx
movq 0x8(%rbp), %rdx
movq $0x1, (%rdx,%rax)
addq $0x10, %rax
decq %rcx
jne 0x702ba
jmp 0x702d3
xorl %ebx, %ebx
cmpq 0x10(%rbp), %rbx
jae 0x703d6
movq %rbp, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x6fd2c
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %r13
incq %r15
cmpq $0x6, %r15
jne 0x702ed
movq %r14, %rdi
callq 0x7198e
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x18(%rsp)
addq %rcx, %rax
movq %rax, 0x20(%rsp)
cmpq 0x10(%rbp), %rax
jbe 0x70356
leaq 0xc8313(%rip), %rdi     # 0x138647
leaq 0xd2999(%rip), %rsi     # 0x142cd4
leaq 0xd2971(%rip), %rdx     # 0x142cb3
leaq 0xd216d(%rip), %rcx     # 0x1424b6
movl $0xbcd, %r8d            # imm = 0xBCD
xorl %eax, %eax
callq 0xc8053
cmpq $0x0, 0x18(%rsp)
je 0x703c2
movl $0x1, %r15d
movl %r13d, %ecx
shlq %cl, %r15
shlq $0x4, 0x8(%rsp)
xorl %ebx, %ebx
testq %r13, %r13
jle 0x7039a
xorl %r12d, %r12d
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x6fd2c
movzbl %al, %eax
movl %r12d, %ecx
shlq %cl, %rax
orq %rax, %rbp
incq %r12
cmpq %r12, %r13
jne 0x7037c
jmp 0x7039c
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 0x70372
movq 0x10(%rsp), %rbp
movq 0x20(%rsp), %rbx
cmpq 0x10(%rbp), %rbx
jb 0x702e2
xorl %r15d, %r15d
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x6fd2c
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %rbx
incq %r15
cmpq $0x6, %r15
jne 0x703db
cmpq $0x0, 0x10(%rbp)
je 0x70448
xorl %r12d, %r12d
movl $0x0, %r13d
testq %rbx, %rbx
jle 0x7042f
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x6fd2c
movzbl %al, %eax
movl %r15d, %ecx
shlq %cl, %rax
orq %rax, %r13
incq %r15
cmpq %r15, %rbx
jne 0x70413
movq 0x8(%rbp), %rax
movq %r12, %rcx
shlq $0x4, %rcx
movl %r13d, 0x8(%rax,%rcx)
incq %r12
cmpq 0x10(%rbp), %r12
jb 0x70402
movq %rbp, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x70197
xorl %r13d, %r13d
jmp 0x7023c