LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode(ymn::h264::slice_header const&, ymn::h264::slice_data const&)
void picture_cabac::decode(const h264::slice_header& sh, const h264::slice_data& sd)
{
    mb* curr_mb;

    int slice_qp = std::clamp(
        m_context_variables.QPy - 6 * static_cast<int>(m_decoder.m_active_sps->bit_depth_luma_minus8), 0, 51);

    m_cabac_decoder.init_context_variables(sh, slice_qp);
    m_cabac_decoder.init_decoding_engine(sd);

    for (curr_mb = m_context_variables.curr_mb; curr_mb != nullptr; curr_mb = advance_mb_pos()) {

        curr_mb->x = m_context_variables.mb_x;
        curr_mb->y = m_context_variables.mb_y;
        curr_mb->pos = m_context_variables.mb_pos;
        curr_mb->slice_num = 0;

        calculate_neighbours_part1();

        if ((sh.slice_type != h264::slice_type_e::I) && (sh.slice_type != h264::slice_type_e::SI)) {
            bool is_skipped = true; /* TODO: check for skipped macroblocks */
            if (is_skipped)
                continue;
        }

        if ((m_context_variables.mb_aff_frame) && ((m_context_variables.mb_y & 1) == 0))
            m_context_variables.mb_field_decoding_flag = decode_mb_field_decoding_flag();

        calculate_neighbours_part2();

        decode_mb(sh); /* macroblock_layer */

        //std::cout << mb->to_string();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq 0x88358(%rax), %rax
imull $-0x6, 0x18(%rax), %eax
movq %rsi, %r14
addl 0x34(%rdi), %eax
cmpl $0x33, %eax
pushq $0x33
popq %rdx
cmovll %eax, %edx
xorl %eax, %eax
testl %edx, %edx
cmovlel %eax, %edx
leaq 0xdc0(%rdi), %r12
movq %r12, %rdi
callq 0x6b76
movq %r12, %rdi
movq %r15, %rsi
callq 0x6c1c
movq 0x28(%rbx), %rax
pushq $0x5
popq %rbp
testq %rax, %rax
je 0x11cc9
movq 0x1c(%rbx), %rcx
movq %rcx, (%rax)
movl 0x24(%rbx), %ecx
movl %ecx, 0x8(%rax)
andl $0x0, 0xc(%rax)
movq %rbx, %rdi
callq 0x117a4
movl 0x18(%r14), %eax
xorl %edx, %edx
divl %ebp
cmpl $0x4, %edx
je 0x11c92
cmpl $0x2, %edx
jne 0x11cbf
cmpb $0x1, 0x18(%rbx)
jne 0x11cac
testb $0x1, 0x20(%rbx)
jne 0x11cac
movq %rbx, %rdi
callq 0x11cd2
testl %eax, %eax
setne 0x19(%rbx)
movq %rbx, %rdi
callq 0x11974
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11d14
movq %rbx, %rdi
callq 0x11730
jmp 0x11c62
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_mb_field_decoding_flag()
int picture_cabac::decode_mb_field_decoding_flag()
{
    const int ctxIdxOffset = 70;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    ctxIdxInc += (curr_mb->A != nullptr) && (curr_mb->A->type & MB_TYPE_INTERLACED);
    ctxIdxInc += (curr_mb->B != nullptr) && (curr_mb->B->type & MB_TYPE_INTERLACED);

    return m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
}

// Assembly:
movq 0x28(%rdi), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x11ced
movl 0x10(%rcx), %esi
shrl $0x8, %esi
andl $0x1, %esi
orl $0x46, %esi
jmp 0x11cf0
pushq $0x46
popq %rsi
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x11d04
movl 0x10(%rax), %eax
shrl $0x8, %eax
andl $0x1, %eax
jmp 0x11d06
xorl %eax, %eax
addl %eax, %esi
addq $0xdc0, %rdi            # imm = 0xDC0
jmp 0x6abc
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_rem_intra4x4_pred_mode()
int picture_cabac::decode_rem_intra4x4_pred_mode()
{
    const int ctxIdxOffset = 69;
    int mode = 0;
    int ctxIdxInc = 0;

    mode += 1 * m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
    mode += 2 * m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
    mode += 4 * m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);

    return mode;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
addq $0xdc0, %rbx            # imm = 0xDC0
pushq $0x45
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6abc
movl %eax, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6abc
leal (%r14,%rax,2), %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6abc
leal (%r14,%rax,4), %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::non_zero_count_save()
void picture_cabac::non_zero_count_save()
{
    mb* curr_mb = m_context_variables.curr_mb;
    uint8_t* nzc = curr_mb->non_zero_count;

    const mb_cache& nzc_cache_y  = m_context_variables.non_zero_count_cache[CC_Y];
    const mb_cache& nzc_cache_cb = m_context_variables.non_zero_count_cache[CC_Cb];
    const mb_cache& nzc_cache_cr = m_context_variables.non_zero_count_cache[CC_Cr];

    nzc[MB_NZC_DC_BLOCK_IDX(CC_Y)] = nzc_cache_y[0];

    std::memcpy(&nzc[0 * 4], &nzc_cache_y[1 * 8 + 4], 4);
    std::memcpy(&nzc[1 * 4], &nzc_cache_y[2 * 8 + 4], 4);
    std::memcpy(&nzc[2 * 4], &nzc_cache_y[3 * 8 + 4], 4);
    std::memcpy(&nzc[3 * 4], &nzc_cache_y[4 * 8 + 4], 4);

    if (m_context_variables.chroma_array_type == 0)
        return;

    nzc[MB_NZC_DC_BLOCK_IDX(CC_Cb)] = nzc_cache_cb[0];
    nzc[MB_NZC_DC_BLOCK_IDX(CC_Cr)] = nzc_cache_cr[0];

    std::memcpy(&nzc[4 * 4], &nzc_cache_cb[1 * 8 + 4], 4);
    std::memcpy(&nzc[5 * 4], &nzc_cache_cb[2 * 8 + 4], 4);
    std::memcpy(&nzc[8 * 4], &nzc_cache_cr[1 * 8 + 4], 4);
    std::memcpy(&nzc[9 * 4], &nzc_cache_cr[2 * 8 + 4], 4);

    if (m_context_variables.chroma_array_type < 3)
        return;

    std::memcpy(&nzc[ 6 * 4], &nzc_cache_cb[3 * 8 + 4], 4);
    std::memcpy(&nzc[ 7 * 4], &nzc_cache_cb[4 * 8 + 4], 4);
    std::memcpy(&nzc[10 * 4], &nzc_cache_cr[3 * 8 + 4], 4);
    std::memcpy(&nzc[11 * 4], &nzc_cache_cr[4 * 8 + 4], 4);
}

// Assembly:
movq 0x28(%rdi), %rax
movb 0x80(%rdi), %cl
movb %cl, 0xa8(%rax)
movl 0x8c(%rdi), %ecx
movl %ecx, 0x78(%rax)
movl 0x94(%rdi), %ecx
movl %ecx, 0x7c(%rax)
movl 0x9c(%rdi), %ecx
movl %ecx, 0x80(%rax)
movl 0xa4(%rdi), %ecx
movl %ecx, 0x84(%rax)
cmpl $0x0, 0x40(%rdi)
je 0x125b6
movb 0xa8(%rdi), %cl
movb %cl, 0xa9(%rax)
movb 0xd0(%rdi), %cl
movb %cl, 0xaa(%rax)
movl 0xb4(%rdi), %ecx
movl %ecx, 0x88(%rax)
movl 0xbc(%rdi), %ecx
movl %ecx, 0x8c(%rax)
movl 0xdc(%rdi), %ecx
movl %ecx, 0x98(%rax)
movl 0xe4(%rdi), %ecx
movl %ecx, 0x9c(%rax)
cmpl $0x3, 0x40(%rdi)
jl 0x125b6
movl 0xc4(%rdi), %ecx
movl %ecx, 0x90(%rax)
movl 0xcc(%rdi), %ecx
movl %ecx, 0x94(%rax)
movl 0xec(%rdi), %ecx
movl %ecx, 0xa0(%rax)
movl 0xf4(%rdi), %ecx
movl %ecx, 0xa4(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_mb_type_si_slice()
int picture_cabac::decode_mb_type_si_slice()
{
    const int ctxIdxOffset = 0;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    ctxIdxInc += ((curr_mb->left != nullptr) && ((curr_mb->left->type & MB_TYPE_SWITCHING) == 0));
    ctxIdxInc += ((curr_mb->top != nullptr) && ((curr_mb->top->type & MB_TYPE_SWITCHING) == 0));

    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 0; /* SI 4x4 */

    return 1 + decode_mb_type_i_slice();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rcx
movq 0x38(%rcx), %rdx
xorl %esi, %esi
movl $0x0, %eax
testq %rdx, %rdx
je 0x125d9
xorl %eax, %eax
testb $0x10, 0x12(%rdx)
sete %al
movq 0x50(%rcx), %rcx
testq %rcx, %rcx
je 0x125ec
xorl %esi, %esi
testb $0x10, 0x12(%rcx)
sete %sil
addl %eax, %esi
leaq 0xdc0(%rbx), %rdi
callq 0x6abc
testl %eax, %eax
je 0x1260a
movq %rbx, %rdi
callq 0x1260e
incl %eax
jmp 0x1260c
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_mb_type_i_slice()
int picture_cabac::decode_mb_type_i_slice()
{
    const int ctxIdxOffset = 3;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    ctxIdxInc += ((curr_mb->left != nullptr) && ((curr_mb->left->type & MB_TYPE_INTRA_NxN) == 0));
    ctxIdxInc += ((curr_mb->top != nullptr) && ((curr_mb->top->type & MB_TYPE_INTRA_NxN) == 0));

    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 0; /* I 4x4 */

    if (m_cabac_decoder.decode_terminate() == 1)
        return 25; /* PCM */

    int mb_type = 1; /* I16x16 */

    mb_type += 12 * m_cabac_decoder.decode_decision(ctxIdxOffset + 3); /* cbp_luma */
    if (m_cabac_decoder.decode_decision(ctxIdxOffset + 4)) /* cbp_chroma */
        mb_type += 4 + 4 * m_cabac_decoder.decode_decision(ctxIdxOffset + 5);

    mb_type += 2 * m_cabac_decoder.decode_decision(ctxIdxOffset + 6);
    mb_type += 1 * m_cabac_decoder.decode_decision(ctxIdxOffset + 7);

    return mb_type;

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x38(%rax), %rcx
testq %rcx, %rcx
je 0x12632
movb 0x10(%rcx), %cl
andb $0x3, %cl
xorl %esi, %esi
cmpb $0x1, %cl
adcl $0x3, %esi
jmp 0x12635
pushq $0x3
popq %rsi
movq 0x50(%rax), %rcx
xorl %ebp, %ebp
movl $0x0, %eax
testq %rcx, %rcx
je 0x1264e
xorl %eax, %eax
testb $0x3, 0x10(%rcx)
sete %al
addl %eax, %esi
addq $0xdc0, %rbx            # imm = 0xDC0
movq %rbx, %rdi
callq 0x6abc
testl %eax, %eax
je 0x126ca
movq %rbx, %rdi
callq 0x6a58
cmpl $0x1, %eax
jne 0x12675
pushq $0x19
popq %rbp
jmp 0x126ca
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x6abc
imull $0xc, %eax, %r14d
pushq $0x7
popq %rsi
movq %rbx, %rdi
callq 0x6abc
testl %eax, %eax
je 0x126a8
pushq $0x8
popq %rsi
movq %rbx, %rdi
callq 0x6abc
leal (%r14,%rax,4), %r14d
addl $0x5, %r14d
jmp 0x126ab
incl %r14d
pushq $0x9
popq %rsi
movq %rbx, %rdi
callq 0x6abc
leal (%r14,%rax,2), %r14d
pushq $0xa
popq %rsi
movq %rbx, %rdi
callq 0x6abc
movl %eax, %ebp
addl %r14d, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_transform_size_8x8_flag()
int picture_cabac::decode_transform_size_8x8_flag()
{
    const int ctxIdxOffset = 399;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    ctxIdxInc += (curr_mb->A != nullptr) && (MB_IS_INTRA_8x8(curr_mb->A->type));
    ctxIdxInc += (curr_mb->B != nullptr) && (MB_IS_INTRA_8x8(curr_mb->B->type));

    return m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
}

// Assembly:
movq 0x28(%rdi), %rax
movq 0x18(%rax), %rcx
testq %rcx, %rcx
je 0x126f6
movl 0x10(%rcx), %ecx
andl $0x3, %ecx
xorl %esi, %esi
cmpl $0x2, %ecx
sete %sil
addl $0x18f, %esi            # imm = 0x18F
jmp 0x126fb
movl $0x18f, %esi            # imm = 0x18F
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x12714
movl 0x10(%rax), %ecx
andl $0x3, %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
sete %al
jmp 0x12716
xorl %eax, %eax
addl %eax, %esi
addq $0xdc0, %rdi            # imm = 0xDC0
jmp 0x6abc
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_cbp_luma()
int picture_cabac::decode_cbp_luma()
{
    const int ctxIdxOffset = 73;
    int cbp_a, cbp_b, cbp = 0;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    if (curr_mb->left)
        cbp_a = (((curr_mb->left_pair[0]->cbp_luma >> (m_context_variables.left_blocks[0] & (~1))) & 2) << 0) |
                (((curr_mb->left_pair[1]->cbp_luma >> (m_context_variables.left_blocks[2] & (~1))) & 2) << 2);
    else
        cbp_a = 0x0F;

    if (curr_mb->top)
        cbp_b = curr_mb->top->cbp_luma;
    else
        cbp_b = 0x0F;

    ctxIdxInc = !(cbp_a & 0x02) + 2 * !(cbp_b & 0x04);
    cbp += m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
    ctxIdxInc = !(cbp   & 0x01) + 2 * !(cbp_b & 0x08);
    cbp += m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) << 1;
    ctxIdxInc = !(cbp_a & 0x08) + 2 * !(cbp   & 0x01);
    cbp += m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) << 2;
    ctxIdxInc = !(cbp   & 0x04) + 2 * !(cbp   & 0x02);
    cbp += m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) << 3;

    return cbp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %rax
pushq $0xf
popq %r15
cmpq $0x0, 0x38(%rax)
movl %r15d, %r12d
je 0x1276f
movq 0x40(%rax), %rcx
movl 0x6c(%rcx), %edx
movq 0x48(%rbx), %rsi
movb (%rsi), %cl
andb $-0x2, %cl
sarl %cl, %edx
movq 0x48(%rax), %rdi
movb 0x8(%rsi), %cl
movl 0x6c(%rdi), %esi
andb $-0x2, %cl
sarl %cl, %esi
andl $0x2, %edx
andl $0x2, %esi
leal (%rdx,%rsi,4), %r12d
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x1277c
movl 0x6c(%rax), %r15d
movl %r12d, %esi
shll $0x1e, %esi
sarl $0x1f, %esi
movl %r15d, %eax
shrl %eax
andl $0x2, %eax
subl %eax, %esi
addq $0xdc0, %rbx            # imm = 0xDC0
pushq $0x4c
popq %rbp
addl %ebp, %esi
movq %rbx, %rdi
callq 0x6abc
movl %eax, %r14d
movl %eax, %r13d
andl $0x1, %r13d
shrl $0x2, %r15d
andl $0x2, %r15d
orl %r13d, %r15d
movl %ebp, %esi
subl %r15d, %esi
movq %rbx, %rdi
callq 0x6abc
leal (%r14,%rax,2), %r14d
shrl $0x3, %r12d
leal (%r12,%r13,2), %eax
subl %eax, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x6abc
leal (%r14,%rax,4), %r15d
movl %r15d, %esi
shll $0x1d, %esi
sarl $0x1f, %esi
andl $0x2, %r14d
subl %r14d, %esi
addl $0x4c, %esi
movq %rbx, %rdi
callq 0x6abc
leal (%r15,%rax,8), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_cbp_chroma()
int picture_cabac::decode_cbp_chroma()
{
    const int ctxIdxOffset = 77;
    int cbp_a, cbp_b;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    if (curr_mb->left)
        cbp_a = curr_mb->left->cbp_chroma & 0x03;
    else
        cbp_a = 0;

    if (curr_mb->top)
        cbp_b = curr_mb->top->cbp_chroma & 0x03;
    else
        cbp_b = 0;

    ctxIdxInc = 0;
    if (cbp_a > 0)
        ctxIdxInc++;
    if (cbp_b > 0)
        ctxIdxInc += 2;
    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 0;

    ctxIdxInc = 4;
    if (cbp_a == 2)
        ctxIdxInc++;
    if (cbp_b == 2)
        ctxIdxInc += 2;
    return 1 + m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x38(%rax), %rcx
xorl %ebp, %ebp
movl $0x0, %r14d
testq %rcx, %rcx
je 0x12834
movl 0x70(%rcx), %r14d
andl $0x3, %r14d
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x12843
movl 0x70(%rax), %ebp
andl $0x3, %ebp
xorl %eax, %eax
testl %r14d, %r14d
setne %al
leal 0x2(%rax), %esi
testl %ebp, %ebp
cmovel %eax, %esi
addq $0xdc0, %rbx            # imm = 0xDC0
addl $0x4d, %esi
movq %rbx, %rdi
callq 0x6abc
testl %eax, %eax
je 0x1288c
xorl %eax, %eax
cmpl $0x2, %r14d
sete %al
xorl %ecx, %ecx
cmpl $0x2, %ebp
sete %cl
leal (%rax,%rcx,2), %esi
addl $0x51, %esi
movq %rbx, %rdi
callq 0x6abc
incl %eax
jmp 0x1288e
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_mb_qp_delta()
int picture_cabac::decode_mb_qp_delta()
{
    const int ctxIdxOffset = 60;
    int qp_delta = 0;
    int ctxIdxInc;

    ctxIdxInc = (m_context_variables.lastQPdelta != 0) ? 1 : 0;
    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc)) {
        ctxIdxInc = 2;
        qp_delta = 1;
        while (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc)) {
            ctxIdxInc = 3;
            qp_delta++;
        }

        /* Table 9-3 Assignment of syntax element to codeNum for signed Exp-Golomb coded syntax elements se(v) */
        if (qp_delta & 0x01)
            qp_delta =  ((qp_delta + 1) >> 1);
        else
            qp_delta = -((qp_delta + 1) >> 1);
    }

    return qp_delta;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpl $0x1, 0x30(%rdi)
leaq 0xdc0(%rdi), %r14
pushq $0x3d
popq %rsi
sbbl $0x0, %esi
movq %r14, %rdi
callq 0x6abc
testl %eax, %eax
je 0x128d8
pushq $0x3e
popq %rsi
xorl %ebx, %ebx
pushq $0x3f
popq %rbp
movq %r14, %rdi
callq 0x6abc
incl %ebx
movl %ebp, %esi
testl %eax, %eax
jne 0x128bd
testb $0x1, %bl
jne 0x128dc
shrl %ebx
negl %ebx
jmp 0x128e0
xorl %ebx, %ebx
jmp 0x128e0
incl %ebx
shrl %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_intra_chroma_pred_mode()
int picture_cabac::decode_intra_chroma_pred_mode()
{
    const int ctxIdxOffset = 64;
    int ctxIdxInc = 0;
    mb* curr_mb = m_context_variables.curr_mb;

    /* No need to test for MB_IS_INTRA_NxN and MB_IS_INTRA_16x16,
       as intra_chroma_pred_mode shall be set to 0 for those macroblocks */

    ctxIdxInc += (curr_mb->left != nullptr) && (curr_mb->left->intra_chroma_pred_mode != 0);
    ctxIdxInc += (curr_mb->top != nullptr) && (curr_mb->top->intra_chroma_pred_mode != 0);

    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 0;

    ctxIdxInc = 3;

    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 1;

    if (m_cabac_decoder.decode_decision(ctxIdxOffset + ctxIdxInc) == 0)
        return 2;
    else
        return 3;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x28(%rdi), %rdx
movq 0x38(%rdx), %rsi
xorl %eax, %eax
movl $0x0, %ecx
testq %rsi, %rsi
je 0x12909
xorl %ecx, %ecx
cmpb $0x0, 0x68(%rsi)
setne %cl
movq 0x50(%rdx), %rdx
testq %rdx, %rdx
je 0x1291b
xorl %eax, %eax
cmpb $0x0, 0x68(%rdx)
setne %al
addq $0xdc0, %rbx            # imm = 0xDC0
leal (%rax,%rcx), %esi
addl $0x40, %esi
movq %rbx, %rdi
callq 0x6abc
testl %eax, %eax
je 0x12959
pushq $0x43
popq %rsi
movq %rbx, %rdi
callq 0x6abc
testl %eax, %eax
je 0x1295d
pushq $0x43
popq %rsi
movq %rbx, %rdi
callq 0x6abc
cmpl $0x1, %eax
pushq $0x3
popq %rax
sbbl $0x0, %eax
jmp 0x12960
xorl %eax, %eax
jmp 0x12960
pushq $0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_residual_dc(int*, ymn::h264::ctx_block_cat_e, int, unsigned char const*, int)
void picture_cabac::decode_residual_dc(dctcoeff* block,
                                       const enum ctx_block_cat_e ctxBlockCat,
                                       const int idx,
                                       const uint8_t* scantable,
                                       const int max_coeff)
{
    if (decode_coded_block_flag(ctxBlockCat, idx))
        decode_residual_block(block, ctxBlockCat, idx, scantable, max_coeff);
    else {
        mb_cache& nzc_cache = m_context_variables.non_zero_count_cache[idx - 16 * CC_MAX];
        nzc_cache[0] = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movq %r8, %r14
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %r15
movl %edx, %esi
movl %ecx, %edx
callq 0x12962
testl %eax, %eax
je 0x12cd5
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
movq %r14, %r8
movl %ebx, %r9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12a54
addl $-0x30, %ebp
movslq %ebp, %rax
imulq $0x28, %rax, %rax
movb $0x0, 0x80(%r15,%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/lukasz-wiecaszek[P]h264iframedecoder/picture_cabac.cpp
// Function: ymn::h264::picture_cabac::decode_residual_ac(int*, ymn::h264::ctx_block_cat_e, int, unsigned char const*, int)
void picture_cabac::decode_residual_ac(dctcoeff* block,
                                       const enum ctx_block_cat_e ctxBlockCat,
                                       const int idx,
                                       const uint8_t* scantable,
                                       const int max_coeff)
{
    if (max_coeff != 64 || m_context_variables.chroma_array_type == 3) {
        if (decode_coded_block_flag(ctxBlockCat, idx))
            decode_residual_block(block, ctxBlockCat, idx, scantable, max_coeff);
        else {
            mb_cache& nzc_cache = m_context_variables.non_zero_count_cache[idx / 16];
            const int cache_idx = mb_cache_idx[idx % 16];
            if (max_coeff == 64)
                mb_cache_fill_rectangle_2x2(nzc_cache, cache_idx, 0);
            else
                nzc_cache[cache_idx] = 0;
        }
    }
    else {
        /* When coded_block_flag is not present, it shall be inferred to be equal to 1. */
        decode_residual_block(block, ctxBlockCat, idx, scantable, max_coeff);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movq %r8, %r14
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %r15
cmpl $0x40, %r9d
jne 0x12d35
cmpl $0x3, 0x40(%r15)
je 0x12d35
pushq $0x40
popq %r9
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
movq %r14, %r8
jmp 0x12d57
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
callq 0x12962
testl %eax, %eax
je 0x12d6a
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
movl %ebp, %ecx
movq %r14, %r8
movl %ebx, %r9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12a54
pushq $0x10
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
cltq
imulq $0x28, %rax, %rax
addq %r15, %rax
addq $0x80, %rax
movslq %edx, %rcx
leaq 0x60c5(%rip), %rdx      # 0x18e50
movzbl (%rcx,%rdx), %ecx
cmpl $0x40, %ebx
jne 0x12da1
andw $0x0, (%rax,%rcx)
andw $0x0, 0x8(%rax,%rcx)
jmp 0x12da5
movb $0x0, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/include/cnn/Layer.h
// Function: abcdl::cnn::Layer::~Layer()
virtual ~Layer(){
        for(auto& weight : _batch_weights){delete weight;}
        _batch_weights.clear();
        delete _batch_bias;

        for(auto& weight : _delta_weights){delete weight;}
        _delta_weights.clear();
        delete _delta_bias;

        for(auto& weight : _weights){delete weight;}
        _weights.clear();
        delete _bias;

        for(auto& delta : _deltas){delete delta;}
        _deltas.clear();

        for(auto& activation : _activations){delete activation;}
        _activations.clear();
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x3cca0(%rip), %rax     # 0x4bf10
movq %rax, (%rdi)
leaq 0x98(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x98(%rdi), %rbx
movq 0xa0(%rdi), %r12
cmpq %r12, %rbx
je 0xf2b0
movq (%rbx), %r15
testq %r15, %r15
je 0xf2a2
movq %r15, %rdi
callq 0x167fa
movq %r15, %rdi
callq 0x82f0
addq $0x8, %rbx
jmp 0xf28d
movq 0x98(%r14), %rax
cmpq %rax, 0xa0(%r14)
je 0xf2c7
movq %rax, 0xa0(%r14)
movq 0xb0(%r14), %r15
testq %r15, %r15
je 0xf2db
movq %r15, %rdi
callq 0x167fa
movq %r15, %rdi
callq 0x82f0
leaq 0x78(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x78(%r14), %rbx
movq 0x80(%r14), %r15
cmpq %r15, %rbx
je 0xf31a
movq (%rbx), %r12
testq %r12, %r12
je 0xf30c
movq %r12, %rdi
callq 0x167fa
movq %r12, %rdi
callq 0x82f0
addq $0x8, %rbx
jmp 0xf2f7
movq 0x78(%r14), %rax
cmpq %rax, 0x80(%r14)
je 0xf32e
movq %rax, 0x80(%r14)
movq 0x90(%r14), %r12
testq %r12, %r12
je 0xf342
movq %r12, %rdi
callq 0x167fa
movq %r12, %rdi
callq 0x82f0
leaq 0x40(%r14), %rax
movq %rax, (%rsp)
movq 0x40(%r14), %rbx
movq 0x48(%r14), %r15
cmpq %r15, %rbx
je 0xf37d
movq (%rbx), %r13
testq %r13, %r13
je 0xf36f
movq %r13, %rdi
callq 0x167fa
movq %r13, %rdi
callq 0x82f0
addq $0x8, %rbx
jmp 0xf35a
movq 0x40(%r14), %rax
cmpq %rax, 0x48(%r14)
je 0xf38b
movq %rax, 0x48(%r14)
movq 0x58(%r14), %r13
testq %r13, %r13
je 0xf39c
movq %r13, %rdi
callq 0x167fa
movq %r13, %rdi
callq 0x82f0
leaq 0xb8(%r14), %r13
movq 0xb8(%r14), %rbx
movq 0xc0(%r14), %r15
cmpq %r15, %rbx
je 0xf3dc
movq (%rbx), %rbp
testq %rbp, %rbp
je 0xf3ce
movq %rbp, %rdi
callq 0x167fa
movq %rbp, %rdi
callq 0x82f0
addq $0x8, %rbx
jmp 0xf3b9
movq 0xb8(%r14), %rax
cmpq %rax, 0xc0(%r14)
je 0xf3f3
movq %rax, 0xc0(%r14)
leaq 0x60(%r14), %rbp
movq 0x60(%r14), %r15
movq 0x68(%r14), %r12
cmpq %r12, %r15
je 0xf422
movq (%r15), %rbx
testq %rbx, %rbx
je 0xf414
movq %rbx, %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x82f0
addq $0x8, %r15
jmp 0xf3ff
movq 0x60(%r14), %rax
cmpq %rax, 0x68(%r14)
je 0xf430
movq %rax, 0x68(%r14)
movq %r13, %rdi
callq 0xf4dc
movq 0x10(%rsp), %rdi
callq 0xf4dc
movq 0x8(%rsp), %rdi
callq 0xf4dc
movq %rbp, %rdi
callq 0xf4dc
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xf4ea
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::SubSamplingLayer::initialize(abcdl::cnn::Layer*)
void SubSamplingLayer::initialize(Layer* pre_layer){
    CHECK(pre_layer->get_rows() % _scale == 0 && pre_layer->get_cols() % _scale == 0);
	
    this->_rows = pre_layer->get_rows() / _scale;
    this->_cols = pre_layer->get_cols() / _scale;

    //can't change out_channel_size.
    this->_in_channel_size = this->_out_channel_size = pre_layer->get_out_channel_size();

    this->_deltas.reserve(this->_out_channel_size);
    for(size_t i = 0; i != this->_out_channel_size; i++){
        this->_deltas.push_back(new abcdl::algebra::Mat());
        this->_activations.push_back(new abcdl::algebra::Mat());
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r14
movq 0x8(%rsi), %rcx
movq %rdi, 0x8(%rsp)
movq 0xd0(%rdi), %rdi
movq %rcx, %rax
xorl %edx, %edx
divq %rdi
testq %rdx, %rdx
jne 0x12931
movq 0x10(%r14), %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
testq %rdx, %rdx
jne 0x12931
xorl %ebx, %ebx
movq %rcx, %rax
xorl %edx, %edx
divq %rdi
movq 0x8(%rsp), %r15
movq %rax, 0x8(%r15)
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movq %rax, 0x10(%r15)
movq 0x20(%r14), %rsi
movq %rsi, 0x20(%r15)
movq %rsi, 0x18(%r15)
leaq 0xb8(%r15), %r14
movq %r14, %rdi
callq 0x137d4
addq $0x60, %r15
pushq $0x28
popq %r12
leaq 0x10(%rsp), %r13
movq 0x8(%rsp), %rax
cmpq 0x20(%rax), %rbx
je 0x1291f
movq %r12, %rdi
callq 0x8310
movq %rax, %rbp
movq %rax, %rdi
callq 0x165d0
movq %rbp, 0x10(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0xf594
movq %r12, %rdi
callq 0x8310
movq %rax, %rbp
movq %rax, %rdi
callq 0x165d0
movq %rbp, 0x10(%rsp)
movq %r15, %rdi
movq %r13, %rsi
callq 0xf594
incq %rbx
jmp 0x128c9
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1e42c(%rip), %rsi     # 0x30d64
leaq 0x10(%rsp), %r15
pushq $0xf
popq %rdx
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0x2d5b4
leaq 0x1e424(%rip), %rsi     # 0x30d76
movq %r15, %rdi
callq 0x8300
leaq 0x10(%rsp), %rdi
callq 0x2d7f0
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rsi
movq 0x8(%rsp), %rax
movq 0xd0(%rax), %rdi
jmp 0x12882
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x2d7f0
jmp 0x12999
jmp 0x1298e
movq %rax, %rbx
movq %rbp, %rdi
callq 0x82f0
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::SubSamplingLayer::forward(abcdl::cnn::Layer*)
void SubSamplingLayer::forward(Layer* pre_layer){
	abcdl::algebra::Mat activation;
    for(size_t i = 0; i != this->_out_channel_size; i++){
        _pooling->pool(activation, pre_layer->get_activation(i), this->_rows, this->_cols, this->_scale);
        this->set_activation(i, activation);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x165d0
xorl %r12d, %r12d
cmpq 0x20(%r14), %r12
je 0x12a10
movq 0xd8(%r14), %r13
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13864
movq 0x8(%r14), %rcx
movq 0x10(%r14), %r8
movq 0xd0(%r14), %r9
movq (%r13), %r10
movq %r13, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq *0x10(%r10)
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x138ea
incq %r12
jmp 0x129c5
leaq 0x8(%rsp), %rdi
callq 0x167fa
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::SubSamplingLayer::backward(abcdl::cnn::Layer*, abcdl::cnn::Layer*)
void SubSamplingLayer::backward(Layer* pre_layer, Layer* back_layer){
    if(back_layer->get_layer_type() == abcdl::framework::OUTPUT){
        size_t size = this->_rows * this->_cols;
        real*  data = back_layer->get_delta(0).data();
        abcdl::algebra::Mat delta(this->_rows, this->_cols);
        
        //recover multiply mat
        for(size_t i = 0; i != this->_out_channel_size; i++){
            memcpy(delta.data(), &data[i * size], sizeof(real) * size);
            this->set_delta(i, delta);
        }
    }else if(back_layer->get_layer_type() == abcdl::framework::CONVOLUTION){
        size_t stride = ((ConvolutionLayer*)back_layer)->get_stride();
        for(size_t i = 0 ; i != this->_out_channel_size; i++){
            abcdl::algebra::Mat delta;
            abcdl::algebra::Mat sub_delta;
            for(size_t j = 0; j != back_layer->get_out_channel_size(); j++){
                _helper.convn(sub_delta, back_layer->get_delta(j), back_layer->get_weight(i, j), stride, abcdl::algebra::FULL);
                delta += sub_delta;
            }
            this->set_delta(i, delta);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movl 0x28(%rdx), %eax
cmpl $0x3, %eax
je 0x12ac6
cmpl $0x4, %eax
jne 0x12b8a
movq %rdi, %r13
movq 0x10(%rdi), %rbx
imulq 0x8(%rdi), %rbx
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x1396a
movq 0x10(%rax), %r14
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
leaq 0x18(%rsp), %r12
movq %r12, %rdi
callq 0x165ea
shlq $0x2, %rbx
cmpq 0x20(%r13), %r15
je 0x12b80
movq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x8250
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x139f8
incq %r15
addq %rbx, %r14
jmp 0x12a96
movq 0xd0(%r14), %rax
movq %rax, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
leaq 0x30(%rdi), %r12
xorl %r13d, %r13d
leaq 0x40(%rsp), %rbx
movq 0x8(%rsp), %rax
cmpq 0x20(%rax), %r13
je 0x12b8a
leaq 0x18(%rsp), %rdi
callq 0x165d0
movq %rbx, %rdi
callq 0x165d0
xorl %ebp, %ebp
cmpq 0x20(%r14), %rbp
je 0x12b53
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1396a
movq %rax, %r15
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x13a7c
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rax, %rcx
movq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0x27698
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x1c9c4
incq %rbp
jmp 0x12b06
movq 0x8(%rsp), %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdx
callq 0x139f8
movq %rbx, %rdi
callq 0x167fa
movq %r15, %rdi
callq 0x167fa
incq %r13
jmp 0x12ae3
leaq 0x18(%rsp), %rdi
callq 0x167fa
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x12ba2
jmp 0x12b9d
movq %rax, %rbx
jmp 0x12baf
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x167fa
leaq 0x18(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::ConvolutionLayer::forward(abcdl::cnn::Layer*)
void ConvolutionLayer::forward(Layer* pre_layer){
    for(size_t i = 0; i != this->_out_channel_size; i++){
        abcdl::algebra::Mat activation;
        abcdl::algebra::Mat pre_activation;
        for(size_t j = 0; j != pre_layer->get_out_channel_size(); j++){
            pre_activation = pre_layer->get_activation(j);
            pre_activation.convn(this->get_weight(j, i), _stride, abcdl::algebra::VALID);
            activation += pre_activation;//sum all channels of pre_layer
        }
        //add shared bias of channel in current layer.
        activation += this->_bias->get_data(i, 0);

        _activate_func->activate(activation, activation);
        this->set_activation(i, activation);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
leaq 0x30(%rsp), %r12
leaq 0x8(%rsp), %r13
cmpq 0x20(%r14), %r15
je 0x12f7a
movq %r12, %rdi
callq 0x165d0
movq %r13, %rdi
callq 0x165d0
xorl %ebp, %ebp
cmpq 0x20(%rbx), %rbp
je 0x12f28
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x13864
movq %r13, %rdi
movq %rax, %rsi
callq 0x1c67e
movq %r14, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x13a7c
movq 0xd0(%r14), %rdx
movq %r13, %rdi
movq %rax, %rsi
pushq $0x1
popq %rcx
callq 0x2257a
movq %r12, %rdi
movq %r13, %rsi
callq 0x1c9c4
incq %rbp
jmp 0x12ed9
movq 0x58(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x13b9a
movq %r12, %rdi
movq %rax, %rsi
callq 0x1c960
movq 0xe0(%r14), %rdi
movq (%rdi), %rax
movq %r12, %rsi
movq %r12, %rdx
callq *0x10(%rax)
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x138ea
movq %r13, %rdi
callq 0x167fa
movq %r12, %rdi
callq 0x167fa
incq %r15
jmp 0x12ebd
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x12f9d
jmp 0x12f90
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x167fa
leaq 0x30(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::OutputLayer::initialize(abcdl::cnn::Layer*)
void OutputLayer::initialize(Layer* pre_layer){
    this->_cols = pre_layer->get_rows() * pre_layer->get_cols() * pre_layer->get_out_channel_size();
    this->_in_channel_size = pre_layer->get_out_channel_size();

    this->_weights.push_back(new abcdl::algebra::RandomMatrix<real>(this->_rows, this->_cols, 0.0, 0.5));
    this->_bias = new abcdl::algebra::Mat(0.0, _rows, 1);
    this->_activations.push_back(new abcdl::algebra::Mat());
    this->_deltas.push_back(new abcdl::algebra::Mat());

    this->_delta_weights.push_back(new abcdl::algebra::Mat(this->_rows, this->_cols));
    this->_delta_bias = new abcdl::algebra::Mat(0.0, _rows, 1);
    this->_batch_weights.push_back(new abcdl::algebra::Mat(this->_rows, this->_cols));
    this->_batch_bias = new abcdl::algebra::Mat(0.0, _rows, 1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x10(%rsi), %r14
imulq 0x8(%rsi), %r14
movq 0x20(%rsi), %rax
imulq %rax, %r14
movq %r14, 0x10(%rdi)
movq %rax, 0x18(%rdi)
pushq $0x38
popq %rdi
callq 0x8310
movq 0x8(%rbx), %rsi
leaq 0x1c(%rsp), %rcx
andl $0x0, (%rcx)
movq %rax, %r15
leaq 0x18(%rsp), %r8
movl $0x3f000000, (%r8)      # imm = 0x3F000000
leaq 0x14(%rsp), %r9
andl $0x0, (%r9)
leaq 0x10(%rsp), %rax
andl $0x0, (%rax)
movq %rax, (%rsp)
movq %r15, %rdi
movq %r14, %rdx
callq 0x19ca4
leaq 0x40(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movq %r15, (%rsi)
callq 0x13f9e
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
movq 0x8(%rbx), %rdx
pushq $0x1
popq %rcx
movq %rax, %rdi
callq 0x1663e
movq %r14, 0x58(%rbx)
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
movq %rax, %rdi
callq 0x165d0
leaq 0x60(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
callq 0xf594
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
movq %rax, %rdi
callq 0x165d0
leaq 0xb8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
movq %r14, (%rsi)
callq 0xf594
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %rax, %rdi
callq 0x165ea
leaq 0x78(%rbx), %rdi
leaq 0x8(%rsp), %r15
movq %r14, (%r15)
movq %r15, %rsi
callq 0xf594
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
andl $0x0, (%r15)
movq 0x8(%rbx), %rdx
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rcx
movq %rax, %rdi
callq 0x1663e
movq %r14, 0x90(%rbx)
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %rax, %rdi
callq 0x165ea
leaq 0x98(%rbx), %rdi
leaq 0x8(%rsp), %r15
movq %r14, (%r15)
movq %r15, %rsi
callq 0xf594
pushq $0x28
popq %rdi
callq 0x8310
movq %rax, %r14
andl $0x0, (%r15)
movq 0x8(%rbx), %rdx
leaq 0x8(%rsp), %rsi
pushq $0x1
popq %rcx
movq %rax, %rdi
callq 0x1663e
movq %r14, 0xb0(%rbx)
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x1340f
jmp 0x1340f
jmp 0x1340f
jmp 0x1340f
jmp 0x1340f
jmp 0x1340f
movq %rax, %rbx
movq %r14, %rdi
callq 0x82f0
movq %rbx, %rdi
callq 0x84f0
movq %rax, %rbx
jmp 0x1341a
movq %rax, %rbx
movq %r15, %rdi
jmp 0x13415
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/Layer.cpp
// Function: abcdl::cnn::OutputLayer::forward(abcdl::cnn::Layer*)
void OutputLayer::forward(Layer* pre_layer){
    //concatenate pre_layer's all channel mat into array
	size_t size = pre_layer->get_rows() * pre_layer->get_cols() * this->_in_channel_size;
    real* data = new real[size];
    size_t idx = 0;
    for(size_t i = 0; i != this->_in_channel_size; i++){
        size_t activation_size = pre_layer->get_activation(i).get_size();
        memcpy(&data[idx], pre_layer->get_activation(i).data(), sizeof(real) * activation_size);
        idx += activation_size;
    }

    _pre_activation_array.set_shallow_data(data, size, 1);

    auto activation = _helper.dot(this->get_weight(0, 0), _pre_activation_array) + (*this->_bias);
    _activate_func->activate(activation, activation);
    this->set_activation(0, activation);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r15
movq 0x10(%rsi), %rcx
imulq 0x8(%rsi), %rcx
movq %rdi, %r13
movq 0x18(%rdi), %rbp
imulq %rbp, %rcx
movq %rcx, %rax
shrq $0x3e, %rax
movq %rcx, 0x10(%rsp)
leaq (,%rcx,4), %rcx
xorl %r12d, %r12d
negq %rax
movl $0x0, %edi
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x8030
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
cmpq %rbp, %r12
je 0x134d3
movq %r15, %rdi
movq %r12, %rsi
callq 0x13864
movq 0x8(%rax), %rbx
imulq (%rax), %rbx
movq 0x8(%rsp), %rax
leaq (%rax,%r14,4), %rbp
movq %r15, %rdi
movq %r12, %rsi
callq 0x13864
movq 0x10(%rax), %rsi
leaq (,%rbx,4), %rdx
movq %rbp, %rdi
callq 0x8250
addq %rbx, %r14
incq %r12
movq 0x18(%r13), %rbp
jmp 0x13487
leaq 0x100(%r13), %r15
pushq $0x1
popq %rcx
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x169d0
leaq 0x30(%r13), %r14
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x13a7c
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rax, %rdx
movq %r15, %rcx
callq 0x26554
movq 0x58(%r13), %rdx
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x1c79c
leaq 0x40(%rsp), %rdi
callq 0x167fa
movq 0x130(%r13), %rdi
movq (%rdi), %rax
leaq 0x18(%rsp), %rdx
movq %rdx, %rsi
callq *0x10(%rax)
leaq 0x18(%rsp), %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x138ea
leaq 0x18(%rsp), %rdi
callq 0x167fa
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x1357f
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/CNN.cpp
// Function: abcdl::cnn::CNN::set_layers(std::vector<abcdl::cnn::Layer*, std::allocator<abcdl::cnn::Layer*>>)
void CNN::set_layers(std::vector<abcdl::cnn::Layer*> layers){
    CHECK(layers.size() > 0 && layers[0]->get_layer_type() == abcdl::framework::INPUT);
    CHECK(layers[layers.size() - 1]->get_layer_type() == abcdl::framework::OUTPUT);

    abcdl::cnn::Layer* pre_layer = nullptr;
    for(auto& layer : layers){
        layer->initialize(pre_layer);
        _layers.push_back(layer);
        pre_layer = layer;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %r15
movq 0x8(%rsi), %r12
cmpq %r15, %r12
je 0x14213
movq (%r15), %rax
cmpl $0x0, 0x28(%rax)
jne 0x14213
movq -0x8(%r12), %rax
cmpl $0x4, 0x28(%rax)
jne 0x1424b
addq $0x18, %rbx
xorl %esi, %esi
cmpq %r12, %r15
je 0x14204
movq (%r15), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x149ea
movq (%r15), %rsi
addq $0x8, %r15
jmp 0x141e2
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1cd93(%rip), %rsi     # 0x30fad
movq %rsp, %r15
pushq $0x13
popq %rdx
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0x2d5b4
leaq 0x1cd8b(%rip), %rsi     # 0x30fbd
movq %r15, %rdi
callq 0x8300
movq %rsp, %rdi
callq 0x2d7f0
movq (%r14), %r15
movq 0x8(%r14), %r12
jmp 0x141d1
leaq 0x1cd5b(%rip), %rsi     # 0x30fad
movq %rsp, %r15
pushq $0x14
popq %rdx
pushq $0x3
popq %rcx
movq %r15, %rdi
callq 0x2d5b4
leaq 0x1cdad(%rip), %rsi     # 0x31017
movq %r15, %rdi
callq 0x8300
movq %rsp, %rdi
callq 0x2d7f0
movq (%r14), %r15
movq 0x8(%r14), %r12
jmp 0x141dc
jmp 0x14288
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2d7f0
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/CNN.cpp
// Function: abcdl::cnn::CNN::forward(abcdl::algebra::Matrix<float> const&)
void CNN::forward(const abcdl::algebra::Mat& mat){
    size_t layer_size = _layers.size();
    abcdl::cnn::Layer* pre_layer = nullptr;

    for(size_t k = 0; k != layer_size; k++){
        auto layer = _layers[k];
        if(layer->get_layer_type() == abcdl::framework::INPUT){
            ((InputLayer*)layer)->set_x(mat);
        }

        layer->forward(pre_layer);
        pre_layer = layer;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %r13
subq 0x18(%rdi), %r13
movq %rsi, %r14
sarq $0x3, %r13
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpq %rbp, %r13
je 0x14755
movq 0x18(%rbx), %rax
movq (%rax,%rbp,8), %r12
cmpl $0x0, 0x28(%r12)
jne 0x14740
movq %r12, %rdi
movq %r14, %rsi
callq 0x14a3e
movq (%r12), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *0x18(%rax)
incq %rbp
movq %r12, %r15
jmp 0x14720
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/CNN.cpp
// Function: abcdl::cnn::CNN::backward(abcdl::algebra::Matrix<float> const&)
void CNN::backward(const abcdl::algebra::Mat& mat){
    int layer_size = _layers.size();
    abcdl::cnn::Layer* back_layer = nullptr;
    abcdl::cnn::Layer* pre_layer = nullptr;

    for(int k = layer_size - 1; k >= 0; k--){
        auto layer = _layers[k];
        if(layer->get_layer_type() == abcdl::framework::OUTPUT){
            ((OutputLayer*)layer)->set_y(mat.clone().reshape(mat.cols(), mat.rows()));
        }

        pre_layer = (k > 0) ? _layers[k - 1] : nullptr;
        layer->backward(pre_layer, back_layer);
        back_layer = layer;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x20(%rdi), %rax
subq 0x18(%rdi), %rax
shrq $0x3, %rax
movl %eax, %ebp
xorl %r12d, %r12d
movq %rsp, %r15
testl %ebp, %ebp
jle 0x147f5
movq 0x18(%r14), %rax
movq -0x8(%rax,%rbp,8), %r13
cmpl $0x4, 0x28(%r13)
jne 0x147cd
movq %r15, %rdi
movq %rbx, %rsi
callq 0x173a4
movq (%rbx), %rdx
movq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x14b50
movq %r13, %rdi
movq %rax, %rsi
callq 0x14aca
movq %r15, %rdi
callq 0x167fa
cmpq $0x1, %rbp
jne 0x147d7
xorl %esi, %esi
jmp 0x147e0
movq 0x18(%r14), %rax
movq -0x10(%rax,%rbp,8), %rsi
movq (%r13), %rax
movq %r13, %rdi
movq %r12, %rdx
callq *0x20(%rax)
decq %rbp
movq %r13, %r12
jmp 0x1478c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/src/cnn/CNN.cpp
// Function: abcdl::cnn::CNN::evaluate(abcdl::algebra::MatrixSet<float> const&, abcdl::algebra::MatrixSet<float> const&)
size_t CNN::evaluate(const abcdl::algebra::MatSet& data_mat, const abcdl::algebra::MatSet& label_mat){
    size_t cnt = 0;
    size_t size = data_mat.size();
    for(size_t i = 0; i != size; i++){
        forward(data_mat[i]);
        if(label_mat[i].argmax() == _layers[_layers.size() - 1]->get_activation(0).argmax()){
            cnt++;
        }
    }
    return cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, 0x8(%rsp)
movq %rdi, %r15
movq 0x8(%rsi), %rax
movq %rsi, 0x10(%rsp)
subq (%rsi), %rax
pushq $0x28
popq %rcx
cqto
idivq %rcx
movq %rax, 0x18(%rsp)
xorl %r13d, %r13d
leaq 0x20(%rsp), %rbp
xorl %ebx, %ebx
cmpq %rbx, 0x18(%rsp)
je 0x14907
movq %rbp, %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x14a08
movq %r15, %rdi
movq %rbp, %rsi
callq 0x146fe
movq %rbp, %rdi
callq 0x167fa
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x14a08
movq %rbp, %rdi
callq 0x22684
movq %rax, %r14
movq 0x20(%r15), %rax
movq -0x8(%rax), %rdi
xorl %esi, %esi
callq 0x13864
movq %rax, %rdi
callq 0x22684
xorl %r12d, %r12d
cmpq %rax, %r14
sete %r12b
movq %rbp, %rdi
callq 0x167fa
addq %r12, %r13
incq %rbx
jmp 0x14891
movq %r13, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1491b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
// File: /workspace/github_cpp_makefile_star2_O2/btbujiangjun[P]abcdl/include/cnn/Layer.h
// Function: abcdl::cnn::Layer::update_gradient(unsigned long, float)
void update_gradient(const size_t batch_size,
                         const real alpha){
        real learning_rate = alpha / batch_size;
        for(size_t i = 0; i != _weights.size(); i++){
            _weights[i]->operator-=(_batch_weights[i]->operator*(learning_rate));
        }
        if(_bias->get_size() > 0){
            _bias->operator-=(_batch_bias->operator*(learning_rate));
        }

        for(auto& weight : _batch_weights){
            weight->reset();
        }
        _batch_bias->reset();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
testq %rsi, %rsi
js 0x14bf6
cvtsi2ss %rsi, %xmm1
jmp 0x14c0b
movq %rsi, %rax
shrq %rax
andl $0x1, %esi
orq %rax, %rsi
cvtsi2ss %rsi, %xmm1
addss %xmm1, %xmm1
divss %xmm1, %xmm0
leaq 0x4(%rsp), %r14
movss %xmm0, (%r14)
xorl %r13d, %r13d
leaq 0x8(%rsp), %r15
movq 0x40(%rbx), %rax
movq 0x48(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
je 0x14c67
movq (%rax,%r13,8), %r12
movq 0x98(%rbx), %rax
movq (%rax,%r13,8), %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x1cf90
movq %r12, %rdi
movq %r15, %rsi
callq 0x1cdfe
movq %r15, %rdi
callq 0x167fa
incq %r13
jmp 0x14c21
movq 0x58(%rbx), %r14
movq 0x8(%r14), %rax
imulq (%r14), %rax
testq %rax, %rax
je 0x14ca6
movq 0xb0(%rbx), %rsi
leaq 0x8(%rsp), %r15
leaq 0x4(%rsp), %rdx
movq %r15, %rdi
callq 0x1cf90
movq %r14, %rdi
movq %r15, %rsi
callq 0x1cdfe
leaq 0x8(%rsp), %rdi
callq 0x167fa
movq 0x98(%rbx), %r15
movq 0xa0(%rbx), %r12
leaq 0x8(%rsp), %r14
cmpq %r12, %r15
je 0x14cd4
movq (%r15), %rdi
andl $0x0, 0x8(%rsp)
movq %r14, %rsi
callq 0x173d6
addq $0x8, %r15
jmp 0x14cb9
movq 0xb0(%rbx), %rdi
leaq 0x8(%rsp), %rsi
andl $0x0, (%rsi)
callq 0x173d6
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x14cf8
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x167fa
movq %rbx, %rdi
callq 0x84f0
nop