// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/../core/bs.h
// Function: bs_read(bs_s*, int, char const*)
static inline uint32_t
bs_read(bs_t *s, int i_count, const char str[]) {
    static uint32_t i_mask[33] = {0x00,
                                  0x01, 0x03, 0x07, 0x0f,
                                  0x1f, 0x3f, 0x7f, 0xff,
                                  0x1ff, 0x3ff, 0x7ff, 0xfff,
                                  0x1fff, 0x3fff, 0x7fff, 0xffff,
                                  0x1ffff, 0x3ffff, 0x7ffff, 0xfffff,
                                  0x1fffff, 0x3fffff, 0x7fffff, 0xffffff,
                                  0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff,
                                  0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff};
    int i_shr;
    uint32_t i_result = 0;

    while (i_count > 0)
    {
        if (s->p >= s->p_end)
        {
            break;
        }

        if ((i_shr = s->i_left - i_count) >= 0)
        {
            /* more in the buffer than requested */
            i_result |= (*s->p >> i_shr) & i_mask[i_count];
            s->i_left -= i_count;
            if (s->i_left == 0)
            {
                s->p++;
                s->i_left = 8;
            }
             myPrintf("bs_read %d, %u, %s \n", i_count, i_result, str);
            return ( i_result);
        }
        else
        {
            /* less in the buffer than requested */
            i_result |= (*s->p & i_mask[s->i_left]) << -i_shr;
            i_count -= s->i_left;
            s->p++;
            s->i_left = 8;
        }
    }
    myPrintf("bs_read %d, %u, %s\n", i_count, i_result, str);
    return ( i_result);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jle 0x10c0e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x10b2b
jmp 0x10c0e
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
subl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, %eax
jl 0x10bb5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movl -0x24(%rbp), %ecx
sarl %cl, %eax
movslq -0x14(%rbp), %rdx
leaq 0x25ce8(%rip), %rcx     # 0x36840
andl (%rcx,%rdx,4), %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x14(%rbp), %edx
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x10b95
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x8, 0x18(%rax)
movl -0x14(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x20(%rbp), %rcx
leaq 0x1aa2d(%rip), %rdi     # 0x2b5d3
movb $0x0, %al
callq 0x4d20
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x10c2c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzbl (%rax), %eax
movq -0x10(%rbp), %rcx
movslq 0x18(%rcx), %rdx
leaq 0x25c71(%rip), %rcx     # 0x36840
andl (%rcx,%rdx,4), %eax
xorl %ecx, %ecx
subl -0x24(%rbp), %ecx
shll %cl, %eax
orl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x8, 0x18(%rax)
jmp 0x10b0a
movl -0x14(%rbp), %esi
movl -0x28(%rbp), %edx
movq -0x20(%rbp), %rcx
leaq 0x1a9c9(%rip), %rdi     # 0x2b5e8
movb $0x0, %al
callq 0x4d20
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)