// File: /workspace/github_cpp_makefile_star2_O2/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 0x1059c(%rip), %rbp     # 0x173d0
movq 0x17185(%rip), %r14     # 0x1dfc0
leaq 0x8(%rsp), %r12
jmp 0x7018
movq %rbx, %rdi
xorl %esi, %esi
pushq $-0x1
popq %rdx
callq 0x35b2
testq %rax, %rax
jne 0x6eee
movq %r14, %rdi
leaq 0x118b7(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11ede(%rip), %rsi     # 0x18d52
jmp 0x6ffc
movq %rbx, %rdi
pushq $0x3
popq %rsi
pushq $-0x1
popq %rdx
callq 0x35b2
testq %rax, %rax
jne 0x6eee
movq %r14, %rdi
leaq 0x11886(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11ece(%rip), %rsi     # 0x18d73
jmp 0x6ffc
movq %rbx, %rdi
pushq $0x2
popq %rsi
pushq $-0x1
popq %rdx
callq 0x35b2
testq %rax, %rax
jne 0x6eee
movq %r14, %rdi
leaq 0x11855(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11e92(%rip), %rsi     # 0x18d68
jmp 0x6ffc
movq %rbx, %rdi
pushq $0x1
popq %rsi
pushq $-0x1
popq %rdx
callq 0x35b2
testq %rax, %rax
je 0x6f47
movq (%rax), %rcx
movq %r12, %rdi
movq %rax, %rsi
callq *(%rcx)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2110
movq %r12, %rdi
callq 0x21a0
jmp 0x7018
movq %rbx, %rdi
pushq $0x4
popq %rsi
pushq $-0x1
popq %rdx
callq 0x35b2
movq %rax, %r15
testq %rax, %rax
je 0x6f65
movq (%r15), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *(%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2110
movq %r12, %rdi
callq 0x21a0
jmp 0x6f9a
movq %r14, %rdi
leaq 0x117cb(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11dfd(%rip), %rsi     # 0x18d5d
jmp 0x6ffc
movq %r14, %rdi
leaq 0x117ad(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11e00(%rip), %rsi     # 0x18d7e
callq 0x2120
movq %rax, %rdi
leaq 0x117a1(%rip), %rsi     # 0x1872e
callq 0x2120
movq %rax, %rdi
callq 0x20b0
movq %rbx, %rdi
pushq $0x5
popq %rsi
pushq $-0x1
popq %rdx
callq 0x35b2
testq %rax, %rax
je 0x6fe3
movq %rax, %r13
movq (%rax), %rax
movq %r12, %rdi
movq %r13, %rsi
callq *(%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2110
movq %r12, %rdi
callq 0x21a0
testq %r15, %r15
je 0x7018
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x7462
jmp 0x7018
movq %r14, %rdi
leaq 0x1172f(%rip), %rsi     # 0x1871c
callq 0x2120
movq %rax, %rdi
leaq 0x11d82(%rip), %rsi     # 0x18d7e
callq 0x2120
movq %rax, %rdi
leaq 0x11723(%rip), %rsi     # 0x1872e
callq 0x2120
movq %rax, %rdi
callq 0x20b0
movq %rbx, %rdi
callq 0x11038
cmpl $0x7, %eax
ja 0x7018
movl %eax, %eax
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq