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

    uint8_t *p_src = ctx->p_img[0];
    int i_src = ctx->i_img[0];
    uint8_t *p_dst = ctx->p_fdec[0];
    int i_dst = ctx->i_fdec[0];

    int16_t luma[16][4][4];
    int16_t dct4x4[16 + 1][4][4];

    int i;

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

    /* calculate dct coeffs */
    for (i = 0; i < 16; i++)
    {
        h->dctf.dct4x4(dct4x4[i + 1], luma[i]);

        /* copy dc coeff */
        dct4x4[0][block_idx_y[i]][block_idx_x[i]] = dct4x4[1 + i][0][0];

        quant_4x4(dct4x4[1 + i], i_qscale, 1);
        scan_zigzag_4x4(mb->block[i].residual_ac, dct4x4[1 + i]);
    }

    h->dctf.dct4x4dc(dct4x4[0], dct4x4[0]);
    quant_4x4_dc(dct4x4[0], i_qscale);
    scan_zigzag_4x4full(mb->luma16x16_dc, dct4x4[0]);

    /* output samples to fdec */
    h->dctf.idct4x4dc(dct4x4[0], dct4x4[0]);
    x264_mb_dequant_4x4_dc(dct4x4[0], i_qscale); /* XXX not inversed */

    /* calculate dct coeffs */
    for (i = 0; i < 16; i++)
    {
        x264_mb_dequant_4x4(dct4x4[1 + i], i_qscale);

        /* copy dc coeff */
        dct4x4[1 + i][0][0] = dct4x4[0][block_idx_y[i]][block_idx_x[i]];

        h->dctf.idct4x4(luma[i], dct4x4[i + 1]);
    }
    /* put pixels to fdec */
    h->pixf.add16x16(p_dst, i_dst, luma);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq 0xd193(%rip), %rdi      # 0x28eb0
leaq 0x13db0(%rip), %rsi     # 0x2fad4
leaq 0x14166(%rip), %rdx     # 0x2fe91
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
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movq 0x10f360(%rax), %rax
leaq -0x240(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x2c(%rbp), %edx
movq -0x38(%rbp), %rcx
movl -0x3c(%rbp), %r8d
callq *%rax
movl $0x0, -0x464(%rbp)
cmpl $0x10, -0x464(%rbp)
jge 0x1beab
movq -0x8(%rbp), %rax
movq 0x10f398(%rax), %rax
movl -0x464(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
leaq -0x460(%rbp), %rdi
shlq $0x5, %rcx
addq %rcx, %rdi
movslq -0x464(%rbp), %rcx
leaq -0x240(%rbp), %rsi
shlq $0x5, %rcx
addq %rcx, %rsi
callq *%rax
movl -0x464(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq -0x460(%rbp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movw (%rax), %dx
leaq -0x460(%rbp), %rax
movslq -0x464(%rbp), %rsi
leaq 0x1185e(%rip), %rcx     # 0x2d670
movzbl (%rcx,%rsi), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x464(%rbp), %rsi
leaq 0x11835(%rip), %rcx     # 0x2d660
movzbl (%rcx,%rsi), %ecx
movw %dx, (%rax,%rcx,2)
movl -0x464(%rbp), %eax
addl $0x1, %eax
cltq
leaq -0x460(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
movl $0x1, %edx
callq 0x1afc0
movq -0x10(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movslq -0x464(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movl -0x464(%rbp), %eax
addl $0x1, %eax
cltq
leaq -0x460(%rbp), %rsi
shlq $0x5, %rax
addq %rax, %rsi
callq 0x203f0
movl -0x464(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x464(%rbp)
jmp 0x1bd97
movq -0x8(%rbp), %rax
movq 0x10f3a0(%rax), %rax
leaq -0x460(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq *%rax
leaq -0x460(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x20480
movq -0x10(%rbp), %rdi
addq $0x2c4, %rdi            # imm = 0x2C4
leaq -0x460(%rbp), %rsi
callq 0x1b160
movq -0x8(%rbp), %rax
movq 0x10f3b0(%rax), %rax
leaq -0x460(%rbp), %rdi
leaq -0x460(%rbp), %rsi
callq *%rax
leaq -0x460(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x7770
movl $0x0, -0x464(%rbp)
cmpl $0x10, -0x464(%rbp)
jge 0x1bff1
movl -0x464(%rbp), %eax
addl $0x1, %eax
cltq
leaq -0x460(%rbp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x7900
leaq -0x460(%rbp), %rax
movslq -0x464(%rbp), %rdx
leaq 0x1170d(%rip), %rcx     # 0x2d670
movzbl (%rcx,%rdx), %ecx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x464(%rbp), %rdx
leaq 0x116e4(%rip), %rcx     # 0x2d660
movzbl (%rcx,%rdx), %ecx
movw (%rax,%rcx,2), %cx
movl -0x464(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdx
leaq -0x460(%rbp), %rax
shlq $0x5, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x8(%rbp), %rax
movq 0x10f3a8(%rax), %rax
movslq -0x464(%rbp), %rcx
leaq -0x240(%rbp), %rdi
shlq $0x5, %rcx
addq %rcx, %rdi
movl -0x464(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
leaq -0x460(%rbp), %rsi
shlq $0x5, %rcx
addq %rcx, %rsi
callq *%rax
movl -0x464(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x464(%rbp)
jmp 0x1bf20
movq -0x8(%rbp), %rax
movq 0x10f378(%rax), %rax
movq -0x38(%rbp), %rdi
movl -0x3c(%rbp), %esi
leaq -0x240(%rbp), %rdx
callq *%rax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
nopw %cs:(%rax,%rax)