// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/vlc.c
// Function: vlc_table_create_part(x264_vlc_table_t*, vlc_t const*, int, int, int, int)
static int vlc_table_create_part( x264_vlc_table_t *table, const vlc_t *vlc, int i_lookup_bits, int i_nb_vlc, int i_prefix_code, int i_prefix_length )
{
    int i;
    int i_nb_lookup;
    vlc_lookup_t *lookup;
    int i_table_index;

    i_nb_lookup = 1 << i_lookup_bits;

    i_table_index = vlc_table_realloc( table, i_nb_lookup );
    lookup = &table->lookup[i_table_index];

    for( i = 0; i < i_nb_lookup; i++ )
    {
        lookup[i].i_value  = -1;
        lookup[i].i_size = 0;
    }
            
    for( i = 0; i < i_nb_vlc; i++ )
    {
        int i_bits;
        if( vlc[i].i_size <= 0 )
        {
            continue;
        }

        i_bits = vlc[i].i_size - i_prefix_length;
        if( i_bits > 0 && ( vlc[i].i_bits >> i_bits ) == i_prefix_code )
        {
            if( i_bits <= i_lookup_bits )
            {
                int i_lookup_index;
                int nb;

                i_lookup_index = ( vlc[i].i_bits << ( i_lookup_bits - i_bits ) )%i_nb_lookup;
                nb = 1 << ( i_lookup_bits - i_bits );
                for( nb = 0; nb < (1 << ( i_lookup_bits - i_bits)); nb++ )
                {
                    lookup[i_lookup_index ].i_value = i; /* vlc[i].i_value; */
                    lookup[i_lookup_index ].i_size = i_bits;
                    
                    //printf("1i %d,  size %d , code %d \n", i_lookup_index + extIndex,  lookup[i_lookup_index + extIndex ].i_size, lookup[i_lookup_index + extIndex ].i_value);
                    
                    i_lookup_index++;
                }
            }
            else
            {
                int i_bits_max;
                int i_lookup_index;
                /* need another table */
                i_lookup_index = ( vlc[i].i_bits >> (i_bits - i_lookup_bits ) )%i_nb_lookup;

                i_bits_max =  -lookup[i_lookup_index].i_size;
                if( i_bits_max < i_bits - i_lookup_bits )
                {
                    i_bits_max = i_bits - i_lookup_bits;
                }
                lookup[i_lookup_index].i_size = -i_bits_max;
                
                //myPrintf("2i %d,  size %d , code %d \n", i_lookup_index + extIndex,  lookup[i_lookup_index + extIndex ].i_size, lookup[i_lookup_index + extIndex ].i_value);
                
            }
        }
    }

    /* create other level table */
   
    /* create other level table */  
     //return( i_table_index );
    
    for( i = 0; i < i_nb_lookup; i++ )  
    {  
        if( lookup[i].i_size < 0 )  
        {  
            //myPrintf("3i %d,  size %d , code %d \n", i,  lookup[i].i_size, lookup[i].i_value);
            int i_bits;  
            int i_index;  
            i_bits = -lookup[i].i_size;  
            if( i_bits > i_lookup_bits )  
            {  
                lookup[i].i_size = -i_lookup_bits;  
                i_bits = i_lookup_bits;  
            }  
  
            i_index = vlc_table_create_part( table, vlc, i_bits, i_nb_vlc,  
                                             (i_prefix_code << i_lookup_bits)|i,  
                                              i_lookup_bits+i_prefix_length );  
            lookup = &table->lookup[i_table_index]; // reallocated  
            lookup[i].i_value = i_index;  
        }  
    }  

    return( i_table_index );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movl -0x14(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x153d0
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x1518a
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl $0x0, 0x4(%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x15158
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x152cc
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, 0x4(%rax,%rcx,8)
jg 0x151b1
jmp 0x152be
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl 0x4(%rax,%rcx,8), %eax
subl -0x20(%rbp), %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jle 0x152bc
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl -0x38(%rbp), %ecx
sarl %cl, %eax
cmpl -0x1c(%rbp), %eax
jne 0x152bc
movl -0x38(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x15268
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl -0x14(%rbp), %ecx
subl -0x38(%rbp), %ecx
shll %cl, %eax
cltd
idivl -0x28(%rbp)
movl %edx, -0x3c(%rbp)
movl -0x14(%rbp), %ecx
subl -0x38(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0x38(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jge 0x15266
movl -0x24(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
movl -0x38(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x3c(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1521f
jmp 0x152ba
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,8), %eax
movl -0x38(%rbp), %ecx
subl -0x14(%rbp), %ecx
sarl %cl, %eax
cltd
idivl -0x28(%rbp)
movl %edx, -0x48(%rbp)
movq -0x30(%rbp), %rcx
movslq -0x48(%rbp), %rdx
xorl %eax, %eax
subl 0x4(%rcx,%rdx,8), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl -0x38(%rbp), %ecx
subl -0x14(%rbp), %ecx
cmpl %ecx, %eax
jge 0x152a9
movl -0x38(%rbp), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x44(%rbp)
xorl %edx, %edx
subl -0x44(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
jmp 0x152bc
jmp 0x152be
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x15191
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x15389
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpl $0x0, 0x4(%rax,%rcx,8)
jge 0x15379
movq -0x30(%rbp), %rcx
movslq -0x24(%rbp), %rdx
xorl %eax, %eax
subl 0x4(%rcx,%rdx,8), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x15322
xorl %edx, %edx
subl -0x14(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x4c(%rbp), %edx
movl -0x18(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x1c(%rbp), %r8d
movl -0x14(%rbp), %ecx
shll %cl, %r8d
movl -0x54(%rbp), %ecx
orl -0x24(%rbp), %r8d
movl -0x14(%rbp), %r9d
addl -0x20(%rbp), %r9d
callq 0x15100
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x34(%rbp), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x50(%rbp), %edx
movq -0x30(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
jmp 0x1537b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x152d3
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)