LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: h264_parser_parse_pred_weight_table_lx(ymn::istream<0>&, ymn::h264::pred_weight_table::lx&, unsigned int, bool)
static void h264_parser_parse_pred_weight_table_lx(
    istream_be& s, h264::pred_weight_table::lx& lx, uint32_t num_ref_idx_lx_active_minus1, bool chroma_components_present)
{
    for (uint32_t i = 0;
        (i <= num_ref_idx_lx_active_minus1) && (s.status() == ISTREAM_STATUS_OK);
       ++i) {
        s.read_bits(1, lx.luma_weight_lx_flag[i]);
        if (lx.luma_weight_lx_flag[i]) {
            s.read_exp_golomb_s(lx.luma_weight_lx[i]);
            s.read_exp_golomb_s(lx.luma_offset_lx[i]);
        }
        if (chroma_components_present) {
            s.read_bits(1, lx.chroma_weight_lx_flag[i]);
            if (lx.chroma_weight_lx_flag[i]) {
                s.read_exp_golomb_s(lx.chroma_weight_lx[i][0]);
                s.read_exp_golomb_s(lx.chroma_offset_lx[i][0]);
                s.read_exp_golomb_s(lx.chroma_weight_lx[i][1]);
                s.read_exp_golomb_s(lx.chroma_offset_lx[i][1]);
            }
        }
    }
}

// Assembly:
subq $0x28, %rsp
movb %cl, %al
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
andb $0x1, %al
movb %al, 0x13(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %ecx
xorl %eax, %eax
cmpl 0x14(%rsp), %ecx
movb %al, 0xb(%rsp)
ja 0x13686
movq 0x20(%rsp), %rdi
callq 0x17150
cmpl $0x0, %eax
sete %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x13693
jmp 0x137eb
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rdx
movl 0xc(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdx
movl $0x1, %esi
callq 0x16f30
movq 0x18(%rsp), %rax
movl 0xc(%rsp), %ecx
cmpl $0x0, (%rax,%rcx,4)
je 0x13703
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x80, %rsi
movl 0xc(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x17690
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x100, %rsi            # imm = 0x100
movl 0xc(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x17690
testb $0x1, 0x13(%rsp)
je 0x137d9
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rdx
addq $0x180, %rdx            # imm = 0x180
movl 0xc(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdx
movl $0x1, %esi
callq 0x16f30
movq 0x18(%rsp), %rax
movl 0xc(%rsp), %ecx
cmpl $0x0, 0x180(%rax,%rcx,4)
je 0x137d7
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x200, %rsi            # imm = 0x200
movl 0xc(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x17690
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x300, %rsi            # imm = 0x300
movl 0xc(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
callq 0x17690
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x200, %rsi            # imm = 0x200
movl 0xc(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
addq $0x4, %rsi
callq 0x17690
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
addq $0x300, %rsi            # imm = 0x300
movl 0xc(%rsp), %eax
shlq $0x3, %rax
addq %rax, %rsi
addq $0x4, %rsi
callq 0x17690
jmp 0x137d9
jmp 0x137db
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x13662
addq $0x28, %rsp
retq
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: ymn::h264_parser::parse_dec_ref_pic_marking_idr(ymn::istream<0>&, ymn::h264::dec_ref_pic_marking_idr&)
bool h264_parser::parse_dec_ref_pic_marking_idr(istream_be& s, h264::dec_ref_pic_marking_idr& drpm)
{
    bool retval = false;

    do {
        s.read_bits(1, drpm.no_output_of_prior_pics_flag);
        s.read_bits(1, drpm.long_term_reference_flag);

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

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

    return retval;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movb $0x0, 0xf(%rsp)
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
addq $0xc, %rdx
movl $0x1, %esi
callq 0x16f30
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
addq $0x10, %rdx
movl $0x1, %esi
callq 0x16f30
movq 0x18(%rsp), %rdi
callq 0x17150
cmpl $0x0, %eax
je 0x13849
jmp 0x1385d
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x17160
movb $0x1, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: ymn::h264_parser::parse_aud(ymn::istream<0>&)
h264_parser_status_e h264_parser::parse_aud(istream_be& s)
{
    h264_parser_status_e retval = h264_parser_status_e::NAL_UNIT_CORRUPTED;

    do {
        h264::aud& aud = m_aud;
        aud.reset();

        if (!CHK_EXPR(s.read_bits(3, aud.primary_pic_type), std::cout) ||
            !CHK_STRUCT_RANGE(aud, primary_pic_type, 0U, 7U, std::cout)) {
            s.mark_corrupted();
            break;
        }

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

        aud.set_valid(true);
        retval = h264_parser_status_e::AUD_PARSED;
    } while (0);

    return retval;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movl $0x2, 0x14(%rsp)
movq (%rsp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
callq 0x17530
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %rdx
addq $0xc, %rdx
movl $0x3, %esi
callq 0x16f30
movzbl %al, %esi
andl $0x1, %esi
leaq 0x117f6(%rip), %rdi     # 0x252a3
movq 0x1a50c(%rip), %rdx     # 0x2dfc0
callq 0x17180
testb $0x1, %al
jne 0x13abf
jmp 0x13ae5
movq 0x8(%rsp), %rax
movl 0xc(%rax), %esi
leaq 0x117fa(%rip), %rdi     # 0x252c8
xorl %edx, %edx
movl $0x7, %ecx
movq 0x1a4e4(%rip), %r8      # 0x2dfc0
callq 0x17330
testb $0x1, %al
jne 0x13af1
movq 0x18(%rsp), %rdi
callq 0x17130
jmp 0x13b19
movq 0x18(%rsp), %rdi
callq 0x17150
cmpl $0x0, %eax
je 0x13b02
jmp 0x13b19
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x17160
movl $0x3, 0x14(%rsp)
movl 0x14(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: ymn::h264_parser::set_slice_data(ymn::istream<0>&)
void h264_parser::set_slice_data(istream_be& s)
{
    do {
        h264::slice_data& slice_data = m_slice_data;
        slice_data.reset();

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

        m_slice_data.data = s.current_data_pointer();
        m_slice_data.size = s.remains();
        m_slice_data.bit_pos = s.tell_bits();

        slice_data.set_valid(true);
    } while (0);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
addq $0x882e0, %rax          # imm = 0x882E0
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdi
callq 0x17530
movq 0x18(%rsp), %rdi
callq 0x17150
cmpl $0x0, %eax
je 0x16963
jmp 0x169bd
movq 0x18(%rsp), %rdi
callq 0x17ce0
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x882f0(%rax)
movq 0x18(%rsp), %rdi
callq 0x17d00
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x882f8(%rax)
movq 0x18(%rsp), %rdi
callq 0x17d20
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, 0x88300(%rax)
movq 0x10(%rsp), %rdi
movl $0x1, %esi
callq 0x17160
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_parser.cpp
// Function: ymn::h264_parser::parse_byte_stream_nal_units()
h264_parser_status_e h264_parser::parse_byte_stream_nal_units()
{
    h264_parser_status_e status = h264_parser_status_e::NEED_BYTES;
    int num_bytes_in_nal_unit;

    if ((num_bytes_in_nal_unit = find_nal_unit()) > 0) {
        int rbsp_size;
        uint8_t* rbsp_buf;
        const uint8_t* p = m_flatbuffer.get_bookmark();

        rbsp_buf = new uint8_t[num_bytes_in_nal_unit];
        rbsp_size = h264_parser_nal_to_rbsp(rbsp_buf, num_bytes_in_nal_unit, p, num_bytes_in_nal_unit);

        if (rbsp_size > 0) {
            istream_be s(rbsp_buf, rbsp_size);

            status = parse_nal_unit(s);
        }
        else
            status = h264_parser_status_e::NAL_UNIT_CORRUPTED;

        delete [] rbsp_buf;
        m_flatbuffer.clear_bookmark();
    }

    return status;
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movl $0x0, 0xac(%rsp)
callq 0x125a0
movl %eax, 0xa8(%rsp)
cmpl $0x0, %eax
jle 0x16cf0
movq 0x20(%rsp), %rdi
addq $0x40, %rdi
callq 0x16ed0
movq %rax, 0x90(%rsp)
movslq 0xa8(%rsp), %rdi
callq 0x2030
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
movslq 0xa8(%rsp), %rsi
movq 0x90(%rsp), %rdx
movslq 0xa8(%rsp), %rcx
callq 0x16d00
movl %eax, 0xa4(%rsp)
cmpl $0x0, 0xa4(%rsp)
jle 0x16cba
movq 0x98(%rsp), %rax
movq %rax, 0x10(%rsp)
movslq 0xa4(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x28(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17bf0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rcx
callq 0x17c30
leaq 0x28(%rsp), %rdi
callq 0x17c90
movq 0x20(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x169d0
movl %eax, 0xac(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x17ca0
jmp 0x16cc5
movl $0x2, 0xac(%rsp)
movq 0x98(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x16ce2
movq 0x8(%rsp), %rdi
callq 0x21f0
movq 0x20(%rsp), %rdi
addq $0x40, %rdi
callq 0x17cc0
movl 0xac(%rsp), %eax
addq $0xb8, %rsp
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/./utilities.hpp
// Function: ymn::chk_expr(char const*, bool, std::ostream&)
inline bool chk_expr(const char* expr, bool status, std::ostream& ostream)
{
    if (!status)
        if (ostream)
            ostream << "error: " << expr << " failed" << std::endl;

    return status;
}

// Assembly:
subq $0x18, %rsp
movb %sil, %al
movq %rdi, 0x10(%rsp)
andb $0x1, %al
movb %al, 0xf(%rsp)
movq %rdx, (%rsp)
testb $0x1, 0xf(%rsp)
jne 0x171f0
movq (%rsp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x21e0
testb $0x1, %al
jne 0x171b3
jmp 0x171ee
movq (%rsp), %rdi
leaq 0xe652(%rip), %rsi      # 0x25810
callq 0x2140
movq %rax, %rdi
movq 0x10(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
leaq 0xe63e(%rip), %rsi      # 0x25818
callq 0x2140
movq %rax, %rdi
movq 0x16dbf(%rip), %rsi     # 0x2dfa8
callq 0x2180
jmp 0x171f0
movb 0xf(%rsp), %al
andb $0x1, %al
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream.hpp
// Function: ymn::istream<0>::read_exp_golomb_u(unsigned int&)
bool read_exp_golomb_u(uint32_t& value)
    {
        bool status;
        uint32_t leading_zero_bits;
        uint32_t v;

        leading_zero_bits = 0;
        while ((status = read_bits(1, v)) && (0 == v))
            leading_zero_bits++;

        if (!status) {
            m_position -= leading_zero_bits;
            return false;
        }

        if (leading_zero_bits) {
            status = read_bits(leading_zero_bits, v);
            if (!status) {
                m_position -= leading_zero_bits + 1;
                return false;
            }
            v += (1U << leading_zero_bits) - 1;
        } else
            v = 0;

        value = v;
        return true;
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x38(%rsp)
movq 0x8(%rsp), %rdi
movl $0x1, %esi
leaq 0x34(%rsp), %rdx
callq 0x16f30
movb %al, %cl
movb %cl, %al
andb $0x1, %al
movb %al, 0x3f(%rsp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7(%rsp)
jne 0x1724b
jmp 0x17258
xorl %eax, %eax
cmpl 0x34(%rsp), %eax
sete %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x17262
jmp 0x1726f
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x17220
testb $0x1, 0x3f(%rsp)
jne 0x1729e
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %eax
movl %eax, %esi
addq $0x10, %rdi
callq 0x181f0
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movb $0x0, 0x57(%rsp)
jmp 0x1731f
cmpl $0x0, 0x38(%rsp)
je 0x17307
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %esi
leaq 0x34(%rsp), %rdx
callq 0x16f30
andb $0x1, %al
movb %al, 0x3f(%rsp)
testb $0x1, 0x3f(%rsp)
jne 0x172ef
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
addq $0x10, %rdi
callq 0x181f0
movq %rax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movb $0x0, 0x57(%rsp)
jmp 0x1731f
movl 0x38(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
addl 0x34(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x1730f
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./utilities.hpp
// Function: bool ymn::chk_range<unsigned int>(char const*, unsigned int, unsigned int, unsigned int, std::ostream&)
inline bool chk_range(const char* item_name, T item_value, T min, T max, std::ostream& ostream)
{
    if ((item_value >= min) && (item_value <= max))
        return true;

    if (ostream) {
        ostream << "error: value of '" << item_name << "' " << HEXDEC(item_value);
        ostream << " shall be in range [" << HEXDEC(min) << ", " << HEXDEC(max) << "]";
        ostream << std::endl;
    }

    return false;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movl %esi, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
movq %r8, (%rsp)
movl 0x14(%rsp), %eax
cmpl 0x10(%rsp), %eax
jb 0x17367
movl 0x14(%rsp), %eax
cmpl 0xc(%rsp), %eax
ja 0x17367
movb $0x1, 0x27(%rsp)
jmp 0x17518
movq (%rsp), %rdi
movq (%rdi), %rax
addq -0x18(%rax), %rdi
callq 0x21e0
testb $0x1, %al
jne 0x17380
jmp 0x17513
movq (%rsp), %rdi
leaq 0xe552(%rip), %rsi      # 0x258dd
callq 0x2140
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x2140
movq %rax, %rdi
leaq 0xe548(%rip), %rsi      # 0x258ef
callq 0x2140
movq %rax, %rdi
leaq 0xbe87(%rip), %rsi      # 0x2323d
callq 0x2140
movq %rax, %rdi
leaq -0x12d95(%rip), %rsi    # 0x4630
callq 0x20a0
movq %rax, %rdi
movl 0x14(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xbe60(%rip), %rsi      # 0x23240
callq 0x2140
movq %rax, %rdi
leaq -0x12d9f(%rip), %rsi    # 0x4650
callq 0x20a0
movq %rax, %rdi
movl 0x14(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xcfb3(%rip), %rsi      # 0x243bd
callq 0x2140
movq (%rsp), %rdi
leaq 0xe4d8(%rip), %rsi      # 0x258f2
callq 0x2140
movq %rax, %rdi
leaq 0xbe14(%rip), %rsi      # 0x2323d
callq 0x2140
movq %rax, %rdi
leaq -0x12e08(%rip), %rsi    # 0x4630
callq 0x20a0
movq %rax, %rdi
movl 0x10(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xbded(%rip), %rsi      # 0x23240
callq 0x2140
movq %rax, %rdi
leaq -0x12e12(%rip), %rsi    # 0x4650
callq 0x20a0
movq %rax, %rdi
movl 0x10(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xcf40(%rip), %rsi      # 0x243bd
callq 0x2140
movq %rax, %rdi
leaq 0xe47b(%rip), %rsi      # 0x25907
callq 0x2140
movq %rax, %rdi
leaq 0xbda2(%rip), %rsi      # 0x2323d
callq 0x2140
movq %rax, %rdi
leaq -0x12e7a(%rip), %rsi    # 0x4630
callq 0x20a0
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xbd7b(%rip), %rsi      # 0x23240
callq 0x2140
movq %rax, %rdi
leaq -0x12e84(%rip), %rsi    # 0x4650
callq 0x20a0
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x2220
movq %rax, %rdi
leaq 0xcece(%rip), %rsi      # 0x243bd
callq 0x2140
movq %rax, %rdi
leaq 0xe3dd(%rip), %rsi      # 0x258db
callq 0x2140
movq (%rsp), %rdi
movq 0x16a9a(%rip), %rsi     # 0x2dfa8
callq 0x2180
movb $0x0, 0x27(%rsp)
movb 0x27(%rsp), %al
andb $0x1, %al
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./scaling_matrices.hpp
// Function: ymn::h264::scaling_matrices::set_defaults()
void set_defaults()
    {
        for (std::size_t i = 0; i < TABLE_ELEMENTS(scaling_matrices_4x4); ++i)
            scaling_matrices_4x4[i].set_defaults();

        for (std::size_t i = 0; i < TABLE_ELEMENTS(scaling_matrices_8x8); ++i)
            scaling_matrices_8x8[i].set_defaults();

        set_valid(true);
    }

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
cmpq $0x6, 0x18(%rsp)
jae 0x1763e
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movq 0x18(%rsp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x17d30
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x1760c
movq $0x0, 0x10(%rsp)
cmpq $0x6, 0x10(%rsp)
jae 0x17679
movq 0x8(%rsp), %rdi
addq $0xd0, %rdi
imulq $0x50, 0x10(%rsp), %rax
addq %rax, %rdi
callq 0x17d70
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x17647
movq 0x8(%rsp), %rdi
movl $0x1, %esi
callq 0x17160
addq $0x28, %rsp
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream.hpp
// Function: ymn::istream<0>::read_exp_golomb_s(int&)
bool read_exp_golomb_s(int32_t& value)
    {
        bool status;
        uint32_t leading_zero_bits;
        uint32_t v;

        leading_zero_bits = 0;
        while ((status = read_bits(1, v)) && (0 == v))
            leading_zero_bits++;

        if (!status) {
            m_position -= leading_zero_bits;
            return false;
        }

        if (leading_zero_bits) {
            status = read_bits(leading_zero_bits, v);
            if (!status) {
                m_position -= leading_zero_bits + 1;
                return false;
            }

            v += (1U << leading_zero_bits) - 1;
            if (v & 0x01)
                v = (v + 1) / 2;
            else
                v = -(v / 2);
        } else
            v = 0;

        value = v;
        return true;
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movl $0x0, 0x38(%rsp)
movq 0x8(%rsp), %rdi
movl $0x1, %esi
leaq 0x34(%rsp), %rdx
callq 0x16f30
movb %al, %cl
movb %cl, %al
andb $0x1, %al
movb %al, 0x3f(%rsp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x7(%rsp)
jne 0x176db
jmp 0x176e8
xorl %eax, %eax
cmpl 0x34(%rsp), %eax
sete %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x176f2
jmp 0x176ff
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x176b0
testb $0x1, 0x3f(%rsp)
jne 0x1772e
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %eax
movl %eax, %esi
addq $0x10, %rdi
callq 0x181f0
movq %rax, 0x20(%rsp)
movq %rdx, 0x28(%rsp)
movb $0x0, 0x57(%rsp)
jmp 0x177dc
cmpl $0x0, 0x38(%rsp)
je 0x177c4
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %esi
leaq 0x34(%rsp), %rdx
callq 0x16f30
andb $0x1, %al
movb %al, 0x3f(%rsp)
testb $0x1, 0x3f(%rsp)
jne 0x17783
movq 0x8(%rsp), %rdi
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
addq $0x10, %rdi
callq 0x181f0
movq %rax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movb $0x0, 0x57(%rsp)
jmp 0x177dc
movl 0x38(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
addl 0x34(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x177b4
movl 0x34(%rsp), %eax
addl $0x1, %eax
shrl %eax
movl %eax, 0x34(%rsp)
jmp 0x177c2
movl 0x34(%rsp), %ecx
shrl %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, 0x34(%rsp)
jmp 0x177cc
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movb $0x1, 0x57(%rsp)
movb 0x57(%rsp), %al
andb $0x1, %al
addq $0x58, %rsp
retq
nopw (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./h264_structure.hpp
// Function: ymn::more_rbsp_data(ymn::istream<0>&)
inline bool more_rbsp_data(istream_be& s)
{
    std::size_t bits;
    uint32_t value;

    if (s.tell() >= s.size())
        return false;

    if (s.tell() < s.size() - 1)
        return true;

    bits = 8 - s.tell_bits();

    if (!s.peek_bits(bits, value))
        return false;

    if (value == (1U << (bits - 1)))
        return false;

    return true;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x17db0
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
callq 0x17be0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jb 0x17a49
movb $0x0, 0x37(%rsp)
jmp 0x17adb
movq 0x28(%rsp), %rdi
callq 0x17db0
movq %rax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
callq 0x17be0
movq %rax, %rcx
movq 0x8(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x17a7a
movb $0x1, 0x37(%rsp)
jmp 0x17adb
movq 0x28(%rsp), %rdi
callq 0x17d20
movq %rax, %rcx
movl $0x8, %eax
subq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rax
movl %eax, %esi
leaq 0x1c(%rsp), %rdx
callq 0x17dc0
testb $0x1, %al
jne 0x17ab5
movb $0x0, 0x37(%rsp)
jmp 0x17adb
movl 0x1c(%rsp), %eax
movq 0x20(%rsp), %rcx
subq $0x1, %rcx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
cmpl %ecx, %eax
jne 0x17ad6
movb $0x0, 0x37(%rsp)
jmp 0x17adb
movb $0x1, 0x37(%rsp)
movb 0x37(%rsp), %al
andb $0x1, %al
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream_position.hpp
// Function: ymn::istream_position::operator-=(unsigned long)
constexpr istream_position operator -= (std::size_t bits)
    {
        std::size_t number_of_bits = to_bits() - bits;

        m_byte_position = number_of_bits / BITS_PER_BYTE;
        m_bit_position = number_of_bits % BITS_PER_BYTE;

        return *this;
    }

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x17fc0
movq %rax, %rcx
movq (%rsp), %rax
movq 0x10(%rsp), %rdx
subq %rdx, %rcx
movq %rcx, 0x8(%rsp)
movq 0x8(%rsp), %rcx
shrq $0x3, %rcx
movq %rcx, (%rax)
movq 0x8(%rsp), %rcx
andl $0x7, %ecx
movq %rcx, 0x8(%rax)
movups (%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rdx
addq $0x38, %rsp
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream.hpp
// Function: bool ymn::istream<0>::read<unsigned char>(unsigned char&)
bool read(T& value)
    {
        if (m_position.m_bit_position) {
            m_status |= ISTREAM_STATUS_IMPROPER_ALLIGMENT;
            if (m_error_function)
                m_error_function(m_position, m_position + sizeof(T) * BITS_PER_BYTE);
            return false;
        }

        const void* p = readbytes(sizeof(T));
        if (p) {
            value = *(reinterpret_cast<const T*>(p));
            return true;
        }
        else {
            m_status |= ISTREAM_STATUS_EOS_REACHED;
            if (m_error_function)
                m_error_function(m_position, m_position + sizeof(T) * BITS_PER_BYTE);
            return false;
        }
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x18(%rax)
je 0x182df
movq 0x20(%rsp), %rdi
movl 0x20(%rdi), %eax
orl $0x2, %eax
movl %eax, 0x20(%rdi)
addq $0x28, %rdi
callq 0x17fe0
testb $0x1, %al
jne 0x1828c
jmp 0x182d5
movq 0x20(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, 0x10(%rsp)
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x18(%rsp)
addq $0x10, %rdi
movl $0x8, %esi
callq 0x18050
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq %rax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x40(%rsp), %rdx
callq 0x18000
movb $0x0, 0x67(%rsp)
jmp 0x18379
movq 0x20(%rsp), %rdi
movl $0x1, %esi
callq 0x18390
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
je 0x18310
movq 0x38(%rsp), %rax
movb (%rax), %cl
movq 0x50(%rsp), %rax
movb %cl, (%rax)
movb $0x1, 0x67(%rsp)
jmp 0x18379
movq 0x20(%rsp), %rdi
movl 0x20(%rdi), %eax
orl $0x1, %eax
movl %eax, 0x20(%rdi)
addq $0x28, %rdi
callq 0x17fe0
testb $0x1, %al
jne 0x1832d
jmp 0x18374
movq 0x20(%rsp), %rdi
movq %rdi, %rax
addq $0x28, %rax
movq %rax, (%rsp)
movq %rdi, %rax
addq $0x10, %rax
movq %rax, 0x8(%rsp)
addq $0x10, %rdi
movl $0x8, %esi
callq 0x18050
movq (%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
leaq 0x28(%rsp), %rdx
callq 0x18000
movb $0x0, 0x67(%rsp)
movb 0x67(%rsp), %al
andb $0x1, %al
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream.hpp
// Function: ymn::istream<0>::readbytes(unsigned long)
const void* readbytes(const std::size_t size)
    {
        const void* p;
        const std::size_t pos = m_position.m_byte_position + size;

        if (pos <= m_size) {
            p = m_buffer + m_position.m_byte_position;
            m_position.m_byte_position = pos;
        }
        else {
            p = nullptr;
        }

        return p;
    }

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rcx
movq %rcx, -0x28(%rsp)
movq 0x10(%rcx), %rax
addq -0x10(%rsp), %rax
movq %rax, -0x20(%rsp)
movq -0x20(%rsp), %rax
cmpq 0x8(%rcx), %rax
ja 0x183d9
movq -0x28(%rsp), %rax
movq (%rax), %rcx
addq 0x10(%rax), %rcx
movq %rcx, -0x18(%rsp)
movq -0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
jmp 0x183e2
movq $0x0, -0x18(%rsp)
movq -0x18(%rsp), %rax
retq
nopl (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_cabac_decoder.cpp
// Function: ymn::h264_cabac_decoder::decode_bypass()
int h264_cabac_decoder::decode_bypass()
{
    uint32_t bits = 0;

    m_codIOffset <<= 1;
    m_stream.read_bits(1, bits);
    m_codIOffset |= bits;

    if (m_codIOffset < m_codIRange)
        return 0;
    else {
        m_codIOffset -= m_codIRange;
        return 1;
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x4c(%rdi), %eax
shll %eax
movl %eax, 0x4c(%rdi)
movl $0x1, %esi
leaq 0x14(%rsp), %rdx
callq 0x16f30
movq 0x8(%rsp), %rcx
movl 0x14(%rsp), %eax
orl 0x4c(%rcx), %eax
movl %eax, 0x4c(%rcx)
movl 0x4c(%rcx), %eax
cmpl 0x48(%rcx), %eax
jae 0x18bf3
movl $0x0, 0x24(%rsp)
jmp 0x18c0b
movq 0x8(%rsp), %rax
movl 0x48(%rax), %edx
movl 0x4c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4c(%rax)
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_cabac_decoder.cpp
// Function: ymn::h264_cabac_decoder::decode_terminate()
int h264_cabac_decoder::decode_terminate()
{
    m_codIRange -= 2;

    if (m_codIOffset < m_codIRange) {

        // renormalization process
        uint8_t shift = renormalization_shift_table[m_codIRange];
        m_codIRange <<= shift;
        m_codIOffset <<= shift;
        if (shift > 0) {
            uint32_t bits = 0;
            m_stream.read_bits(shift, bits);
            m_codIOffset |= bits;
        }

        return 0;
    }
    else
        return 1;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movl 0x48(%rcx), %eax
subl $0x2, %eax
movl %eax, 0x48(%rcx)
movl 0x4c(%rcx), %eax
cmpl 0x48(%rcx), %eax
jae 0x18cb9
movq 0x8(%rsp), %rax
movl 0x48(%rax), %ecx
movl %ecx, %edx
leaq 0xefeb(%rip), %rcx      # 0x27c40
movb (%rcx,%rdx), %cl
movb %cl, 0x17(%rsp)
movzbl 0x17(%rsp), %ecx
movl 0x48(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x48(%rax)
movzbl 0x17(%rsp), %ecx
movl 0x4c(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x4c(%rax)
movzbl 0x17(%rsp), %eax
cmpl $0x0, %eax
jle 0x18caf
movq 0x8(%rsp), %rdi
movl $0x0, 0x10(%rsp)
movzbl 0x17(%rsp), %esi
leaq 0x10(%rsp), %rdx
callq 0x16f30
movq 0x8(%rsp), %rax
movl 0x10(%rsp), %ecx
orl 0x4c(%rax), %ecx
movl %ecx, 0x4c(%rax)
movl $0x0, 0x24(%rsp)
jmp 0x18cc1
movl $0x1, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopw (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_cabac_decoder.cpp
// Function: ymn::h264_cabac_decoder::decode_decision(int)
int h264_cabac_decoder::decode_decision(int ctxIdx)
{
    context_variable& state = m_context_variables[ctxIdx];
    int codIRangeLPS = range_tab_lps[(m_codIRange & 0xC0) + state.pStateIdx];
    int binVal;

    m_codIRange -= codIRangeLPS;

    if (m_codIOffset >= m_codIRange) {
        binVal = 1 - state.valMPS;
        m_codIOffset -= m_codIRange;
        m_codIRange = codIRangeLPS;
        state.pStateIdx = trans_idx_lps[state.pStateIdx];
        if (0 == state.pStateIdx)
            state.valMPS ^= 1;
    }
    else {
        binVal = state.valMPS;
        state.pStateIdx = trans_idx_mps[state.pStateIdx];
    }

    // renormalization process
    uint8_t shift = renormalization_shift_table[m_codIRange];
    m_codIRange <<= shift;
    m_codIOffset <<= shift;
    if (shift > 0) {
        uint32_t bits = 0;
        m_stream.read_bits(shift, bits);
        m_codIOffset |= bits;
    }

    return binVal;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movl %esi, 0x2c(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, 0x8(%rsp)
addq $0x50, %rdi
movslq 0x2c(%rsp), %rsi
callq 0x19150
movq 0x8(%rsp), %rcx
movq %rax, 0x20(%rsp)
movl 0x48(%rcx), %eax
andl $0xc0, %eax
movq 0x20(%rsp), %rdx
addl (%rdx), %eax
movl %eax, %eax
movl %eax, %edx
leaq 0xcda7(%rip), %rax      # 0x25ac0
movzbl (%rax,%rdx), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %edx
movl 0x48(%rcx), %eax
subl %edx, %eax
movl %eax, 0x48(%rcx)
movl 0x4c(%rcx), %eax
cmpl 0x48(%rcx), %eax
jb 0x18d92
movq 0x8(%rsp), %rax
movq 0x20(%rsp), %rdx
movl $0x1, %ecx
subl 0x4(%rdx), %ecx
movl %ecx, 0x18(%rsp)
movl 0x48(%rax), %edx
movl 0x4c(%rax), %ecx
subl %edx, %ecx
movl %ecx, 0x4c(%rax)
movl 0x1c(%rsp), %ecx
movl %ecx, 0x48(%rax)
movq 0x20(%rsp), %rax
movslq (%rax), %rcx
leaq 0xce54(%rip), %rax      # 0x25bc0
movzbl (%rax,%rcx), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
jne 0x18d90
movq 0x20(%rsp), %rax
movl 0x4(%rax), %ecx
xorl $0x1, %ecx
movl %ecx, 0x4(%rax)
jmp 0x18db8
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movslq (%rax), %rcx
leaq 0xce53(%rip), %rax      # 0x25c00
movzbl (%rax,%rcx), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x8(%rsp), %rax
movl 0x48(%rax), %ecx
movl %ecx, %edx
leaq 0xee77(%rip), %rcx      # 0x27c40
movb (%rcx,%rdx), %cl
movb %cl, 0x17(%rsp)
movzbl 0x17(%rsp), %ecx
movl 0x48(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x48(%rax)
movzbl 0x17(%rsp), %ecx
movl 0x4c(%rax), %edx
shll %cl, %edx
movl %edx, %ecx
movl %ecx, 0x4c(%rax)
movzbl 0x17(%rsp), %eax
cmpl $0x0, %eax
jle 0x18e23
movq 0x8(%rsp), %rdi
movl $0x0, 0x10(%rsp)
movzbl 0x17(%rsp), %esi
leaq 0x10(%rsp), %rdx
callq 0x16f30
movq 0x8(%rsp), %rax
movl 0x10(%rsp), %ecx
orl 0x4c(%rax), %ecx
movl %ecx, 0x4c(%rax)
movl 0x18(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_cabac_decoder.cpp
// Function: ymn::h264_cabac_decoder::init_context_variables(ymn::h264::slice_header const&, int)
void h264_cabac_decoder::init_context_variables(const h264::slice_header& slice_header, int32_t slice_qp)
{
    const int8_t (*table)[2];
    h264::slice_type_e slice_type = h264::to_slice_type_e(slice_header.slice_type);

    if ((slice_type == h264::slice_type_e::I) || (slice_type == h264::slice_type_e::SI))
        table = init_tab_context_variables_I;
    else
        table = init_tab_context_variables_PB[slice_header.cabac_init_idc];

    for (size_t ctxIdx = 0; ctxIdx < m_context_variables.size(); ++ctxIdx) {
        int preCtxState = (((table[ctxIdx][0]/*m*/ * slice_qp) >> 4) + table[ctxIdx][1]/*n*/);
        preCtxState = std::clamp(preCtxState, 1, 126);

        if (preCtxState <= 63) {
            m_context_variables[ctxIdx].pStateIdx = 63 - preCtxState; // 0 ... 62
            m_context_variables[ctxIdx].valMPS = 0;
        }
        else {
            m_context_variables[ctxIdx].pStateIdx = preCtxState - 64; // 0 ... 62
            m_context_variables[ctxIdx].valMPS = 1;
        }
    }
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rax
movl 0x18(%rax), %edi
callq 0x18fc0
movl %eax, 0x34(%rsp)
cmpl $0x2, 0x34(%rsp)
je 0x18e6b
cmpl $0x4, 0x34(%rsp)
jne 0x18e79
leaq 0xcdce(%rip), %rax      # 0x25c40
movq %rax, 0x38(%rsp)
jmp 0x18e99
movq 0x48(%rsp), %rax
movl 0x958(%rax), %eax
movl %eax, %ecx
leaq 0xd5b3(%rip), %rax      # 0x26440
shlq $0xb, %rcx
addq %rcx, %rax
movq %rax, 0x38(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x10(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
addq $0x50, %rdi
callq 0x19180
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x18fba
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %rcx
movsbl (%rax,%rcx,2), %eax
imull 0x44(%rsp), %eax
sarl $0x4, %eax
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rdx
movsbl 0x1(%rcx,%rdx,2), %ecx
addl %ecx, %eax
movl %eax, 0x24(%rsp)
movl $0x1, 0x20(%rsp)
movl $0x7e, 0x1c(%rsp)
leaq 0x24(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
callq 0x19190
movl (%rax), %eax
movl %eax, 0x24(%rsp)
cmpl $0x3f, 0x24(%rsp)
jg 0x18f69
movq 0x10(%rsp), %rdi
movl $0x3f, %eax
subl 0x24(%rsp), %eax
movl %eax, 0x4(%rsp)
addq $0x50, %rdi
movq 0x28(%rsp), %rsi
callq 0x19150
movl 0x4(%rsp), %ecx
movq 0x10(%rsp), %rdi
movl %ecx, (%rax)
addq $0x50, %rdi
movq 0x28(%rsp), %rsi
callq 0x19150
movl $0x0, 0x4(%rax)
jmp 0x18fa5
movq 0x10(%rsp), %rdi
movl 0x24(%rsp), %eax
subl $0x40, %eax
movl %eax, (%rsp)
addq $0x50, %rdi
movq 0x28(%rsp), %rsi
callq 0x19150
movl (%rsp), %ecx
movq 0x10(%rsp), %rdi
movl %ecx, (%rax)
addq $0x50, %rdi
movq 0x28(%rsp), %rsi
callq 0x19150
movl $0x1, 0x4(%rax)
jmp 0x18fa7
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x18ea2
addq $0x58, %rsp
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_cabac_decoder.cpp
// Function: ymn::h264_cabac_decoder::init_decoding_engine(ymn::h264::slice_data const&)
void h264_cabac_decoder::init_decoding_engine(const h264::slice_data& slice_data)
{
    if (slice_data.bit_pos > 0)
    {
        /* realign and init stream */
        m_stream = istream(slice_data.data + 1, slice_data.size - 1);
    }
    else
    {
        /* init stream (it's already aligned) */
        m_stream = istream(slice_data.data, slice_data.size);
    }

    m_codIRange = 0x1FE; // 510
    m_stream.read_bits(9, m_codIOffset);
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movq %rdi, 0x100(%rsp)
movq %rsi, 0xf8(%rsp)
movq 0x100(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0xf8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jbe 0x1909f
movq 0xf8(%rsp), %rax
movq 0x10(%rax), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
movq 0xf8(%rsp), %rax
movq 0x18(%rax), %rax
subq $0x1, %rax
movq %rax, 0x18(%rsp)
leaq 0x90(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17bf0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rcx
callq 0x17c30
movq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x19200
leaq 0xb0(%rsp), %rdi
callq 0x17ca0
leaq 0x90(%rsp), %rdi
callq 0x17c90
jmp 0x19109
movq 0xf8(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, (%rsp)
movq 0xf8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x28(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17bf0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rcx
callq 0x17c30
movq 0x20(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x19200
leaq 0x48(%rsp), %rdi
callq 0x17ca0
leaq 0x28(%rsp), %rdi
callq 0x17c90
movq 0x20(%rsp), %rdi
movl $0x1fe, 0x48(%rdi)      # imm = 0x1FE
movq %rdi, %rdx
addq $0x4c, %rdx
movl $0x9, %esi
callq 0x16f30
addq $0x108, %rsp            # imm = 0x108
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/./istream.hpp
// Function: ymn::istream<0>::operator=(ymn::istream<0> const&)
istream& operator = (const istream& other)
    {
        m_buffer         = other.m_buffer;
        m_size           = other.m_size;
        m_position       = other.m_position;
        m_status         = other.m_status;
        m_error_function = other.m_error_function;

        return *this;
    }

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, (%rdi)
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rdi)
movq 0x8(%rsp), %rsi
addq $0x10, %rsi
addq $0x10, %rdi
callq 0x19290
movq (%rsp), %rdi
movq 0x8(%rsp), %rax
movl 0x20(%rax), %eax
movl %eax, 0x20(%rdi)
movq 0x8(%rsp), %rsi
addq $0x28, %rsi
addq $0x28, %rdi
callq 0x192c0
movq (%rsp), %rax
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_decoder.cpp
// Function: ymn::h264_decoder::h264_decoder(ymn::h264_parser_container_e)
h264_decoder::h264_decoder(h264_parser_container_e container) :
    m_parser{H264_PARSER_BUFFER_SIZE, container},
    m_dimensions{},
    m_active_sps{nullptr},
    m_active_pps{nullptr},
    m_picture{nullptr}
{
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
movl 0xc(%rsp), %edx
movl $0x400000, %esi         # imm = 0x400000
callq 0x1af20
movq (%rsp), %rdi
addq $0x88340, %rdi          # imm = 0x88340
callq 0x1b0b0
movq (%rsp), %rax
movq $0x0, 0x88358(%rax)
movq $0x0, 0x88360(%rax)
movq $0x0, 0x88368(%rax)
addq $0x18, %rsp
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_decoder.cpp
// Function: ymn::h264_decoder::feed(unsigned char const*, unsigned long)
void h264_decoder::feed(const uint8_t* data, std::size_t count)
{
    size_t n_written;

    do {
        n_written = m_parser.write(data, count);
        if (0 == n_written) {
            m_parser.reset();
            continue;
        }

        if (n_written > count) {
            std::cerr << "error: parser swallowed more data then requested (this is really bad)" << std::endl;
            m_parser.reset();
            continue;
        }

        parse();

        data += n_written;
        count -= n_written;
    } while (count > 0);
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x10da0
movq %rax, 0x8(%rsp)
xorl %eax, %eax
cmpq 0x8(%rsp), %rax
jne 0x19f98
movq (%rsp), %rdi
callq 0x1b0f0
jmp 0x19ffb
movq 0x8(%rsp), %rax
cmpq 0x10(%rsp), %rax
jbe 0x19fd1
movq 0x14045(%rip), %rdi     # 0x2dff0
leaq 0xb016(%rip), %rsi      # 0x24fc8
callq 0x2140
movq %rax, %rdi
movq 0x13fe7(%rip), %rsi     # 0x2dfa8
callq 0x2180
movq (%rsp), %rdi
callq 0x1b0f0
jmp 0x19ffb
movq (%rsp), %rdi
callq 0x1a010
movq 0x8(%rsp), %rax
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %rax
subq %rcx, %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
ja 0x19f6c
addq $0x28, %rsp
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/h264_decoder.cpp
// Function: ymn::h264_decoder::init_dequantisation_tables()
void h264_decoder::init_dequantisation_tables()
{
    init_dequant4x4_coeff_table();
    if (m_active_pps->transform_8x8_mode_flag)
        init_dequant8x8_coeff_table();

    if (m_active_sps->qpprime_y_zero_transform_bypass_flag) {
        for (int i = 0; i < SL_4x4_NUM; ++i)
            for (int x = 0; x < 16; ++x)
                (*m_dequant4x4_coeff[i])[0][x] = 1 << 6;

        if (m_active_pps->transform_8x8_mode_flag)
            for (int i = 0; i < SL_8x8_NUM; ++i)
                for (int x = 0; x < 64; ++x)
                    (*m_dequant8x8_coeff[i])[0][x] = 1 << 6;
    }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1a630
movq 0x8(%rsp), %rax
movq 0x88360(%rax), %rax
cmpl $0x0, 0x450(%rax)
je 0x1aaf7
movq 0x8(%rsp), %rdi
callq 0x1a870
movq 0x8(%rsp), %rax
movq 0x88358(%rax), %rax
cmpl $0x0, 0x20(%rax)
je 0x1abd6
movl $0x0, 0x1c(%rsp)
cmpl $0x6, 0x1c(%rsp)
jge 0x1ab65
movl $0x0, 0x18(%rsp)
cmpl $0x10, 0x18(%rsp)
jge 0x1ab56
movq 0x8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movq 0xa6370(%rax,%rcx,8), %rax
movslq 0x18(%rsp), %rcx
movl $0x40, (%rax,%rcx,4)
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x1ab24
jmp 0x1ab58
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x1ab15
movq 0x8(%rsp), %rax
movq 0x88360(%rax), %rax
cmpl $0x0, 0x450(%rax)
je 0x1abd4
movl $0x0, 0x14(%rsp)
cmpl $0x6, 0x14(%rsp)
jge 0x1abd2
movl $0x0, 0x10(%rsp)
cmpl $0x40, 0x10(%rsp)
jge 0x1abc3
movq 0x8(%rsp), %rax
movslq 0x14(%rsp), %rcx
movq 0xa63a0(%rax,%rcx,8), %rax
movslq 0x10(%rsp), %rcx
movl $0x40, (%rax,%rcx,4)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x1ab91
jmp 0x1abc5
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x1ab82
jmp 0x1abd4
jmp 0x1abd6
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./h264_parser.hpp
// Function: ymn::to_string(ymn::h264_parser_status_e)
constexpr static inline const char* to_string(h264_parser_status_e e)
{
    const char *str = "invalid 'parser_status_e' value";

    switch (e) {
#define H264_PARSER_STATUS(id) case h264_parser_status_e::id: str = #id; break;
            H264_PARSER_STATUSES
#undef H264_PARSER_STATUS
    }

    return str;
}

// Assembly:
movl %edi, -0x4(%rsp)
leaq 0xd35e(%rip), %rax      # 0x281b9
movq %rax, -0x10(%rsp)
movl -0x4(%rsp), %eax
movq %rax, -0x18(%rsp)
subq $0x7, %rax
ja 0x1aef6
movq -0x18(%rsp), %rax
leaq 0xd171(%rip), %rcx      # 0x27ff0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xa1a7(%rip), %rax      # 0x25036
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd33c(%rip), %rax      # 0x281d9
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd33f(%rip), %rax      # 0x281ea
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd344(%rip), %rax      # 0x281fd
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd341(%rip), %rax      # 0x28208
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd33e(%rip), %rax      # 0x28213
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd33b(%rip), %rax      # 0x2821e
movq %rax, -0x10(%rsp)
jmp 0x1aef6
leaq 0xd338(%rip), %rax      # 0x28229
movq %rax, -0x10(%rsp)
movq -0x10(%rsp), %rax
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./h264_parser.hpp
// Function: ymn::h264_parser::h264_parser(unsigned long, ymn::h264_parser_container_e)
explicit h264_parser(std::size_t capacity, h264_parser_container_e container) :
        base_parser<uint8_t>(capacity),
        m_parse_function(nullptr),
        m_aud(),
        m_sps_table(),
        m_recent_sps(-1),
        m_pps_table(),
        m_recent_pps(-1),
        m_sei(),
        m_slice_header(),
        m_slice_data()
    {
        switch (container) {
            case h264_parser_container_e::NONE:
                m_parse_function = &h264_parser::parse_nal_units;
                break;

            case h264_parser_container_e::ANNEX_B:
                m_parse_function = &h264_parser::parse_byte_stream_nal_units;
                break;

            default:
                /* do nothing */
                break;
        }

#if defined(DEBUG)
        std::cout << __PRETTY_FUNCTION__ << std::endl;
        std::cout << to_string() << std::endl;
#endif
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movl %edx, 0x44(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq 0x48(%rsp), %rsi
callq 0x10b40
movq 0x28(%rsp), %rdi
leaq 0x12d6e(%rip), %rax     # 0x2dcc0
movq %rax, (%rdi)
movq $0x0, 0x110(%rdi)
movq $0x0, 0x108(%rdi)
addq $0x118, %rdi            # imm = 0x118
callq 0x1b710
movq 0x28(%rsp), %rax
addq $0x128, %rax            # imm = 0x128
movq %rax, %rcx
addq $0x16000, %rcx          # imm = 0x16000
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1b740
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
addq $0xb00, %rax            # imm = 0xB00
cmpq %rcx, %rax
movq %rax, 0x38(%rsp)
jne 0x1af96
movq 0x28(%rsp), %rax
movl $0xffffffff, 0x16128(%rax) # imm = 0xFFFFFFFF
addq $0x16130, %rax          # imm = 0x16130
movq %rax, %rcx
addq $0x71800, %rcx          # imm = 0x71800
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1b790
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
addq $0x718, %rax            # imm = 0x718
cmpq %rcx, %rax
movq %rax, 0x18(%rsp)
jne 0x1afe8
movq 0x28(%rsp), %rdi
movl $0xffffffff, 0x87930(%rdi) # imm = 0xFFFFFFFF
addq $0x87938, %rdi          # imm = 0x87938
callq 0x1b7d0
movq 0x28(%rsp), %rdi
addq $0x87960, %rdi          # imm = 0x87960
callq 0x1b800
movq 0x28(%rsp), %rdi
addq $0x882e0, %rdi          # imm = 0x882E0
callq 0x1b880
movl 0x44(%rsp), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x1b067
jmp 0x1b05c
movl 0x4(%rsp), %eax
subl $0x1, %eax
je 0x1b087
jmp 0x1b0a7
movq 0x28(%rsp), %rax
leaq -0x44e3(%rip), %rcx     # 0x16b90
movq %rcx, 0x108(%rax)
movq $0x0, 0x110(%rax)
jmp 0x1b0a9
movq 0x28(%rsp), %rax
leaq -0x44e3(%rip), %rcx     # 0x16bb0
movq %rcx, 0x108(%rax)
movq $0x0, 0x110(%rax)
jmp 0x1b0a9
jmp 0x1b0a9
addq $0x58, %rsp
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/./h264_dimensions.hpp
// Function: ymn::h264_dimensions::h264_dimensions()
h264_dimensions() :
        mb_width{0},
        mb_height{0},
        mb_num{0},
        width{0},
        height{0}
    {
    }

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movl $0x0, (%rax)
movl $0x0, 0x4(%rax)
movl $0x0, 0x8(%rax)
movl $0x0, 0xc(%rax)
movl $0x0, 0x10(%rax)
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/./h264_dimensions.hpp
// Function: ymn::h264_dimensions::reset(ymn::h264::sps const&)
void reset(const h264::sps& sps)
    {
        mb_width  = (sps.pic_width_in_mbs_minus1 + 1);
        mb_height = (sps.pic_height_in_map_units_minus1 + 1) * (2 - sps.frame_mbs_only_flag);
        mb_num    = mb_width * mb_height;

        width = 16 * mb_width;
        height = 16 * mb_height;
    }

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movq -0x10(%rsp), %rcx
movl 0x6f4(%rcx), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movq -0x10(%rsp), %rcx
movl 0x6f8(%rcx), %ecx
addl $0x1, %ecx
movq -0x10(%rsp), %rsi
movl $0x2, %edx
subl 0x6fc(%rsi), %edx
imull %edx, %ecx
movl %ecx, 0x4(%rax)
movl (%rax), %ecx
imull 0x4(%rax), %ecx
movl %ecx, 0x8(%rax)
movl (%rax), %ecx
shll $0x4, %ecx
movl %ecx, 0xc(%rax)
movl 0x4(%rax), %ecx
shll $0x4, %ecx
movl %ecx, 0x10(%rax)
retq
nop
// File: lukasz-wiecaszek[P]h264iframedecoder/picture.cpp
// Function: ymn::h264::picture::picture(ymn::h264_decoder const&, ymn::h264::slice_header const&)
picture::picture(const h264_decoder& decoder, const h264::slice_header& sh) :
    m_decoder{decoder},
    m_picture_structure{},
    m_context_variables{},
    m_mbs{nullptr}
{
    init_coxtext_variables(sh);
    m_mbs = new h264::mb[m_decoder.m_dimensions.mb_num];
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x30(%rsp), %rdi
movq %rdi, (%rsp)
leaq 0x11205(%rip), %rax     # 0x2dd18
addq $0x10, %rax
movq %rax, (%rdi)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rdi)
movl $0x0, 0x10(%rdi)
addq $0x18, %rdi
movq %rdi, 0x8(%rsp)
xorl %esi, %esi
movl $0xda0, %edx            # imm = 0xDA0
callq 0x20d0
movq 0x8(%rsp), %rax
addq $0x68, %rax
movq %rax, %rcx
addq $0x78, %rcx
movq %rcx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
addq $0x28, %rax
cmpq %rcx, %rax
movq %rax, 0x18(%rsp)
jne 0x1cb59
movq (%rsp), %rdi
movq $0x0, 0xdb8(%rdi)
movq 0x20(%rsp), %rsi
callq 0x1cbd0
movq (%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x88348(%rax), %rax
movl $0xb0, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x2030
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0xdb8(%rax)
addq $0x38, %rsp
retq
nopl (%rax)
// File: lukasz-wiecaszek[P]h264iframedecoder/picture.cpp
// Function: ymn::h264::picture::update_mb_pos()
void picture::update_mb_pos()
{
    m_context_variables.mb_pos =
        m_context_variables.mb_x +
        m_context_variables.mb_y * m_decoder.m_dimensions.mb_width;

    if (m_context_variables.mb_pos < m_decoder.m_dimensions.mb_num)
        m_context_variables.curr_mb = &m_mbs[m_context_variables.mb_pos];
    else
        m_context_variables.curr_mb = nullptr;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rcx
movq %rcx, -0x10(%rsp)
movl 0x1c(%rcx), %eax
movl 0x20(%rcx), %edx
movq 0x8(%rcx), %rsi
imull 0x88340(%rsi), %edx
addl %edx, %eax
movl %eax, 0x24(%rcx)
movl 0x24(%rcx), %eax
movq 0x8(%rcx), %rcx
cmpl 0x88348(%rcx), %eax
jge 0x1ce44
movq -0x10(%rsp), %rax
movq 0xdb8(%rax), %rcx
movslq 0x24(%rax), %rdx
imulq $0xb0, %rdx, %rdx
addq %rdx, %rcx
movq %rcx, 0x28(%rax)
jmp 0x1ce51
movq -0x10(%rsp), %rax
movq $0x0, 0x28(%rax)
retq
nopw %cs:(%rax,%rax)