// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/encoder/macroblock.c
// Function: x264_mb_encode_i4x4(x264_t*, x264_macroblock_t*, int, int)
void x264_mb_encode_i4x4(x264_t *h, x264_macroblock_t *mb, int idx, int i_qscale) {LOG_CALL;
    x264_mb_context_t *ctx = mb->context;

    uint8_t *p_src = ctx->p_img[0] + 4 * block_idx_x[idx] + 4 * block_idx_y[idx] * ctx->i_img[0];
    int i_src = ctx->i_img[0];
    uint8_t *p_dst = ctx->p_fdec[0] + 4 * block_idx_x[idx] + 4 * block_idx_y[idx] * ctx->i_fdec[0];
    int i_dst = ctx->i_fdec[0];

    int16_t luma[4][4];
    int16_t dct4x4[4][4];

    /* we calculate diff */
    h->pixf.sub4x4(luma, p_src, i_src, p_dst, i_dst);

    /* calculate dct coeffs */
    h->dctf.dct4x4(dct4x4, luma);
    quant_4x4(dct4x4, i_qscale, 1);

    scan_zigzag_4x4full(mb->block[idx].luma4x4, dct4x4);

    /* output samples to fdec */
    x264_mb_dequant_4x4(dct4x4, i_qscale);
    h->dctf.idct4x4(luma, dct4x4);

    /* put pixel to fdec */
    h->pixf.add4x4(p_dst, i_dst, luma);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
leaq 0xe060(%rip), %rdi      # 0x28eb0
leaq 0x14c7d(%rip), %rsi     # 0x2fad4
leaq 0x14ca1(%rip), %rdx     # 0x2faff
movb $0x0, %al
callq 0x4d20
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movslq -0x14(%rbp), %rdx
leaq 0x127dc(%rip), %rcx     # 0x2d660
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rdx
leaq 0x127d4(%rip), %rcx     # 0x2d670
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movq -0x20(%rbp), %rdx
imull 0x30(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movslq -0x14(%rbp), %rdx
leaq 0x1278e(%rip), %rcx     # 0x2d660
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rdx
leaq 0x12786(%rip), %rcx     # 0x2d670
movzbl (%rcx,%rdx), %ecx
shll $0x2, %ecx
movq -0x20(%rbp), %rdx
imull 0x58(%rdx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f350(%rax), %rax
leaq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
movq -0x38(%rbp), %rcx
movl -0x3c(%rbp), %r8d
callq *%rax
movq -0x8(%rbp), %rax
movq 0x10f398(%rax), %rax
leaq -0x80(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq *%rax
leaq -0x80(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x1, %edx
callq 0x1afc0
movq -0x10(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movslq -0x14(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x44, %rdi
leaq -0x80(%rbp), %rsi
callq 0x1b160
leaq -0x80(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x7900
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq *%rax
movq -0x8(%rbp), %rax
movq 0x10f368(%rax), %rax
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
leaq -0x60(%rbp), %rdx
callq *%rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)