// File: /workspace/github_cpp_makefile_star2_O1/lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: ymn::h264_parser::parse_hrd_parameters(ymn::istream<0>&, ymn::h264::hrd_parameters&)
bool h264_parser::parse_hrd_parameters(istream_be& s, h264::hrd_parameters& hrd)
{
    bool retval = false;

    do {
        if (!CHK_EXPR(s.read_exp_golomb_u(hrd.cpb_cnt_minus1), std::cout) ||
            !CHK_STRUCT_RANGE(hrd, cpb_cnt_minus1, 0U, 31U, std::cout)) {
            s.mark_corrupted();
            break;
        }

        s.read_bits(4, hrd.bit_rate_scale);
        s.read_bits(4, hrd.cpb_size_scale);

        for (uint32_t schedSelIdx = 0;
            (schedSelIdx <= hrd.cpb_cnt_minus1) && (s.status() == ISTREAM_STATUS_OK);
           ++schedSelIdx) {
            s.read_exp_golomb_u(hrd.bit_rate_value_minus1[schedSelIdx]);
            s.read_exp_golomb_u(hrd.cpb_size_value_minus1[schedSelIdx]);
            s.read_bits(1, hrd.cbr_flag[schedSelIdx]);
        }

        s.read_bits(5, hrd.initial_cpb_removal_delay_length_minus1);
        s.read_bits(5, hrd.cpb_removal_delay_length_minus1);
        s.read_bits(5, hrd.dpb_output_delay_length_minus1);
        s.read_bits(5, hrd.time_offset_length);

        if (s.status() != ISTREAM_STATUS_OK)
            break;

        hrd.set_valid(true);
        retval = true;
    } while (0);

    return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
leaq 0xc(%rdx), %rsi
movq %r14, %rdi
movq %rsi, 0x10(%rsp)
callq 0x727a
testb %al, %al
jne 0x41b3
movl %eax, %ebp
movq 0x1de8a(%rip), %r12     # 0x21fc0
movq (%r12), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%r12,%rax)
jne 0x41aa
leaq 0x15c14(%rip), %rsi     # 0x19d61
movl $0x7, %edx
movq %r12, %rdi
callq 0x21d0
leaq 0x154b4(%rip), %rsi     # 0x19615
movl $0x27, %edx
movq %r12, %rdi
callq 0x21d0
leaq 0x15bf4(%rip), %rsi     # 0x19d69
movl $0x7, %edx
movq %r12, %rdi
callq 0x21d0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
testb %bpl, %bpl
je 0x42d7
movq 0x10(%rsp), %rax
movl (%rax), %esi
leaq 0x1547c(%rip), %rdi     # 0x1963d
movq 0x1ddf8(%rip), %r8      # 0x21fc0
xorl %edx, %edx
movl $0x1f, %ecx
callq 0x735c
testb %al, %al
je 0x42d7
leaq 0x10(%rbx), %rdx
movq %r14, %rdi
movl $0x4, %esi
callq 0x70a0
movq %rbx, 0x8(%rsp)
leaq 0x14(%rbx), %rdx
movq %r14, %rdi
movl $0x4, %esi
callq 0x70a0
cmpl $0x0, 0x20(%r14)
jne 0x4273
movq 0x8(%rsp), %rax
leaq 0x18(%rax), %r12
leaq 0x98(%rax), %r13
leaq 0x118(%rax), %rbp
movl $0x1, %ebx
leal -0x1(%rbx), %r15d
leaq (%r12,%r15,4), %rsi
movq %r14, %rdi
callq 0x727a
leaq (,%r15,4), %rsi
addq %r13, %rsi
movq %r14, %rdi
callq 0x727a
leaq (,%r15,4), %rdx
addq %rbp, %rdx
movq %r14, %rdi
movl $0x1, %esi
callq 0x70a0
movq 0x10(%rsp), %rax
cmpl (%rax), %ebx
ja 0x4273
incl %ebx
cmpl $0x0, 0x20(%r14)
je 0x4226
movq 0x8(%rsp), %rbx
leaq 0x198(%rbx), %rdx
movq %r14, %rdi
movl $0x5, %esi
callq 0x70a0
leaq 0x19c(%rbx), %rdx
movq %r14, %rdi
movl $0x5, %esi
callq 0x70a0
leaq 0x1a0(%rbx), %rdx
movq %r14, %rdi
movl $0x5, %esi
callq 0x70a0
leaq 0x1a4(%rbx), %rdx
movq %r14, %rdi
movl $0x5, %esi
callq 0x70a0
cmpl $0x0, 0x20(%r14)
jne 0x42dc
movb $0x1, 0x8(%rbx)
movb $0x1, %al
jmp 0x42de
orb $0x4, 0x20(%r14)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop