// File: /workspace/github_cpp_makefile_star2_O3/lukasz-wiecaszek[P]h264iframedecoder/h264_decoder.cpp
// Function: ymn::h264_decoder::parse()
void h264_decoder::parse()
{
    h264_parser_status_e status;

    do {
        status = m_parser.parse();

        switch (status) {
            case h264_parser_status_e::NAL_UNIT_SKIPPED:
                break;

            case h264_parser_status_e::NAL_UNIT_CORRUPTED:
                break;

            case h264_parser_status_e::AUD_PARSED:
            {
                const h264_structure* aud;

                aud = m_parser.get_structure(
                    h264_parser_structure_e::AUD,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (aud)
                    std::cout << aud->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;
                break;
            }

            case h264_parser_status_e::SPS_PARSED:
            {
                const h264_structure* sps;

                sps = m_parser.get_structure(
                    h264_parser_structure_e::SPS,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (sps)
                    std::cout << sps->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;
                break;
            }

            case h264_parser_status_e::PPS_PARSED:
            {
                const h264_structure* pps;

                pps = m_parser.get_structure(
                    h264_parser_structure_e::PPS,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (pps)
                    std::cout << pps->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;
                break;
            }

            case h264_parser_status_e::SEI_PARSED:
            {
                const h264_structure* sei;

                sei = m_parser.get_structure(
                    h264_parser_structure_e::SEI,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (sei)
                    std::cout << sei->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;
                break;
            }

            case h264_parser_status_e::SLICE_PARSED:
            {
                const h264_structure* slice_header;

                slice_header = m_parser.get_structure(
                    h264_parser_structure_e::SLICE_HEADER,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (slice_header)
                    std::cout << slice_header->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;

                const h264_structure* slice_data;

                slice_data = m_parser.get_structure(
                    h264_parser_structure_e::SLICE_DATA,
                    H264_PARSER_STRUCTURE_ID_RECENT);

                if (slice_data)
                    std::cout << slice_data->to_string();
                else
                    std::cout << "Parser returned '" << ymn::to_string(status) <<
                        "' but associated structure cannot be retrived" << std::endl;

                if (slice_header && slice_data)
                    decode_slice(
                        *reinterpret_cast<const h264::slice_header*>(slice_header),
                        *reinterpret_cast<const h264::slice_data*>(slice_data));
                break;
            }

            default:
                break;
       }
    } while (status != h264_parser_status_e::NEED_BYTES);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x134ac(%rip), %r13     # 0x1b340
movq 0x19125(%rip), %r14     # 0x20fc0
leaq 0x8(%rsp), %rbp
jmp 0x8177
movq %rbx, %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
testq %rax, %rax
jne 0x7f82
movl $0x11, %edx
movq %r14, %rdi
leaq 0x147ac(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xa, %edx
movq %r14, %rdi
leaq 0x14dee(%rip), %rsi     # 0x1ccce
jmp 0x8137
movq %rbx, %rdi
movl $0x3, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
testq %rax, %rax
jne 0x7f82
movl $0x11, %edx
movq %r14, %rdi
leaq 0x14769(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xa, %edx
movq %r14, %rdi
leaq 0x14dcc(%rip), %rsi     # 0x1ccef
jmp 0x8137
movq %rbx, %rdi
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
testq %rax, %rax
jne 0x7f82
movl $0x11, %edx
movq %r14, %rdi
leaq 0x1472a(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xa, %edx
movq %r14, %rdi
leaq 0x14d82(%rip), %rsi     # 0x1cce4
jmp 0x8137
movq %rbx, %rdi
movl $0x1, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
testq %rax, %rax
je 0x8021
movq (%rax), %rcx
movq %rbp, %rdi
movq %rax, %rsi
callq *(%rcx)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x21d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8177
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x8177
movq %rbx, %rdi
movl $0x4, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
movq %rax, %r12
testq %rax, %rax
je 0x8049
movq (%r12), %rax
movq %rbp, %rdi
movq %r12, %rsi
callq *(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x21d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x80ac
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x80ac
movl $0x11, %edx
movq %r14, %rdi
leaq 0x14648(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xa, %edx
movq %r14, %rdi
leaq 0x14c95(%rip), %rsi     # 0x1ccd9
jmp 0x8137
movl $0x11, %edx
movq %r14, %rdi
leaq 0x14620(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xc, %edx
movq %r14, %rdi
leaq 0x14c8e(%rip), %rsi     # 0x1ccfa
callq 0x21d0
movl $0x2d, %edx
movq %r14, %rdi
leaq 0x1460a(%rip), %rsi     # 0x1c68a
callq 0x21d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
movq %rbx, %rdi
movl $0x5, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x3a3c
testq %rax, %rax
je 0x8114
movq %rax, %r15
movq (%rax), %rax
movq %rbp, %rdi
movq %r15, %rsi
callq *(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x21d0
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x80ff
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
testq %r12, %r12
je 0x8177
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x863a
jmp 0x8177
movl $0x11, %edx
movq %r14, %rdi
leaq 0x14555(%rip), %rsi     # 0x1c678
callq 0x21d0
movl $0xc, %edx
movq %r14, %rdi
leaq 0x14bc3(%rip), %rsi     # 0x1ccfa
callq 0x21d0
movl $0x2d, %edx
movq %r14, %rdi
leaq 0x1453f(%rip), %rsi     # 0x1c68a
callq 0x21d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2150
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2110
movq 0x108(%rbx), %rax
movq 0x110(%rbx), %rdi
addq %rbx, %rdi
testb $0x1, %al
je 0x8194
movq (%rdi), %rcx
movq -0x1(%rcx,%rax), %rax
callq *%rax
cmpl $0x7, %eax
ja 0x8177
movl %eax, %eax
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq