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

    int i_qscale;

    /* quantification scale */
    i_qscale = mb->i_qp;

    if (mb->i_type == I_16x16)
    {
        /* do the right prediction */
        h->predict_16x16[mb->i_intra16x16_pred_mode](ctx->p_fdec[0], ctx->i_fdec[0]);

        /* encode the 16x16 macroblock */
        x264_mb_encode_i16x16(h, mb, i_qscale);

        /* fix the pred mode value */
        mb->i_intra16x16_pred_mode = x264_mb_pred_mode16x16_fix[mb->i_intra16x16_pred_mode];
    } else if (mb->i_type == I_4x4)
    {
        for (i = 0; i < 16; i++)
        {
            uint8_t *p_dst_by;

            /* Do the right prediction */
            p_dst_by = ctx->p_fdec[0] + 4 * block_idx_x[i] + 4 * block_idx_y[i] * ctx->i_fdec[0];
            h->predict_4x4[mb->block[i].i_intra4x4_pred_mode](p_dst_by, ctx->i_fdec[0]);

            /* encode one 4x4 block */
            x264_mb_encode_i4x4(h, mb, i, i_qscale);

            /* fix the pred mode value */
            mb->block[i].i_intra4x4_pred_mode = x264_mb_pred_mode4x4_fix[mb->block[i].i_intra4x4_pred_mode];
        }
    } else /* Inter MB */
    {
        int16_t dct4x4[16][4][4];

        int i8x8, i4x4, idx;
        int i_decimate_mb = 0;

        /* Motion compensation */
        x264_mb_mc(h, mb);

        for (i8x8 = 0; i8x8 < 4; i8x8++)
        {
            int16_t luma[4][4];
            int i_decimate_8x8;

            /* encode one 4x4 block */
            i_decimate_8x8 = 0;
            for (i4x4 = 0; i4x4 < 4; i4x4++)
            {
                uint8_t *p_src, *p_dst;

                idx = i8x8 * 4 + i4x4;

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

                /* we calculate diff */
                h->pixf.sub4x4(luma, p_src, ctx->i_img[0], p_dst, ctx->i_fdec[0]);

                /* calculate dct coeffs */
                h->dctf.dct4x4(dct4x4[idx], luma);
                quant_4x4(dct4x4[idx], i_qscale, 0);

                scan_zigzag_4x4full(mb->block[idx].luma4x4, dct4x4[idx]);
                i_decimate_8x8 += x264_mb_decimate_score(mb->block[idx].luma4x4, 16);
            }

            /* decimate this 8x8 block */
            i_decimate_mb += i_decimate_8x8;
            if (i_decimate_8x8 < 4)
            {
                for (i4x4 = 0; i4x4 < 4; i4x4++)
                {
                    int x, y;
                    idx = i8x8 * 4 + i4x4;
                    for (i = 0; i < 16; i++)
                    {
                        mb->block[idx].luma4x4[i] = 0;
                    }
                    for (x = 0; x < 4; x++)
                    {
                        for (y = 0; y < 4; y++)
                        {
                            dct4x4[idx][x][y] = 0;
                        }
                    }
                }
            }
        }

        if (i_decimate_mb < 6)
        {
            for (i8x8 = 0; i8x8 < 4; i8x8++)
            {
                for (i4x4 = 0; i4x4 < 4; i4x4++)
                {
                    for (i = 0; i < 16; i++)
                    {
                        mb->block[i8x8 * 4 + i4x4].luma4x4[i] = 0;
                    }
                }
            }
        } else
        {
            for (i8x8 = 0; i8x8 < 4; i8x8++)
            {
                int16_t luma[4][4];
                /* TODO we could avoid it if we had decimate this 8x8 block */
                /* output samples to fdec */
                for (i4x4 = 0; i4x4 < 4; i4x4++)
                {
                    uint8_t *p_dst;

                    idx = i8x8 * 4 + i4x4;

                    x264_mb_dequant_4x4(dct4x4[idx], i_qscale);
                    h->dctf.idct4x4(luma, dct4x4[idx]);

                    /* put pixel to fdec */
                    p_dst = ctx->p_fdec[0] + 4 * block_idx_x[idx] + 4 * block_idx_y[idx] * ctx->i_fdec[0];
                    h->pixf.add4x4(p_dst, ctx->i_fdec[0], luma);
                }
            }
        }
    }

    /* encode chroma */
    i_qscale = i_chroma_qp_table[x264_clip3(i_qscale + h->pps->i_chroma_qp_index_offset, 0, 51)];
    if (IS_INTRA(mb->i_type))
    {
        /* do the right prediction */
        h->predict_8x8[mb->i_chroma_pred_mode](ctx->p_fdec[1], ctx->i_fdec[1]);
        h->predict_8x8[mb->i_chroma_pred_mode](ctx->p_fdec[2], ctx->i_fdec[2]);
    }

    /* encode the 8x8 blocks */
    x264_mb_encode_8x8(h, mb, !IS_INTRA(mb->i_type), i_qscale);

    /* fix the pred mode value */
    if (IS_INTRA(mb->i_type))
    {
        mb->i_chroma_pred_mode = x264_mb_pred_mode8x8_fix[mb->i_chroma_pred_mode];
    }

    /* Calculate the Luma/Chroma patern and non_zero_count */
    if (mb->i_type == I_16x16)
    {
        mb->i_cbp_luma = 0x00;
        for (i = 0; i < 16; i++)
        {
            mb->block[i].i_non_zero_count = array_non_zero_count(mb->block[i].residual_ac, 15);
            if (mb->block[i].i_non_zero_count > 0)
            {
                mb->i_cbp_luma = 0x0f;
            }
        }
    } else
    {
        mb->i_cbp_luma = 0x00;
        for (i = 0; i < 16; i++)
        {
            mb->block[i].i_non_zero_count = array_non_zero_count(mb->block[i].luma4x4, 16);
            if (mb->block[i].i_non_zero_count > 0)
            {
                mb->i_cbp_luma |= 1 << (i / 4);
            }
        }
    }

    /* Calculate the chroma patern */
    mb->i_cbp_chroma = 0x00;
    for (i = 0; i < 8; i++)
    {
        mb->block[16 + i].i_non_zero_count = array_non_zero_count(mb->block[16 + i].residual_ac, 15);
        if (mb->block[16 + i].i_non_zero_count > 0)
        {
            mb->i_cbp_chroma = 0x02; /* dc+ac (we can't do only ac) */
        }
    }
    if (mb->i_cbp_chroma == 0x00 &&
            (array_non_zero_count(mb->chroma_dc[0], 4) > 0 || array_non_zero_count(mb->chroma_dc[1], 4)) > 0)
    {
        mb->i_cbp_chroma = 0x01; /* dc only */
    }

    /* Check for P_SKIP
     * XXX: in the me perhaps we should take x264_mb_predict_mv_pskip into account
     *      (if multiple mv give same result)*/
    if (mb->i_type == P_L0 && mb->i_partition == D_16x16 &&
            mb->i_cbp_luma == 0x00 && mb->i_cbp_chroma == 0x00)
    {

        int i_ref;
        int mvx, mvy;
        x264_mb_partition_get(mb, 0, 0, 0, &i_ref, &mvx, &mvy);

        if (i_ref == 0)
        {
            int mvp[2];

            x264_mb_predict_mv_pskip(mb, mvp);
            if (mvp[0] == mvx && mvp[1] == mvy)
            {
                mb->i_type = P_SKIP;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x4c8, %rsp            # imm = 0x4C8
movq %rsi, %r14
movq %rdi, %r12
leaq 0xe744(%rip), %rdi      # 0x251b4
leaq 0x14fa1(%rip), %rsi     # 0x2ba18
leaq 0x14fd9(%rip), %rdx     # 0x2ba57
xorl %eax, %eax
callq 0x4c22
movq 0x10(%r14), %r13
movl 0x2b0(%r14), %eax
movl %eax, -0x38(%rbp)
movl 0x18(%r14), %eax
cmpl $0x1, %eax
movq %r14, -0x30(%rbp)
movq %r12, -0x50(%rbp)
movq %r13, -0x68(%rbp)
je 0x16b31
testl %eax, %eax
jne 0x16e43
leaq 0x324(%r14), %rbx
xorl %r15d, %r15d
movl -0x38(%rbp), %r14d
leaq 0x11227(%rip), %rax     # 0x27cf0
movzbl (%r15,%rax), %eax
shlq $0x2, %rax
addq 0x40(%r13), %rax
leaq 0x11203(%rip), %rcx     # 0x27ce0
movzbl (%r15,%rcx), %edi
shll $0x2, %edi
movslq 0x58(%r13), %rsi
imulq %rsi, %rdi
addq %rax, %rdi
movslq (%rbx), %rax
callq *0x10f248(%r12,%rax,8)
movq %r12, %rdi
movq -0x30(%rbp), %rsi
movl %r15d, %edx
movl %r14d, %ecx
callq 0x1680f
movslq (%rbx), %rax
leaq 0x12e79(%rip), %rcx     # 0x29990
movl (%rcx,%rax,4), %eax
movl %eax, (%rbx)
incq %r15
addq $0x84, %rbx
cmpq $0x10, %r15
jne 0x16ac2
jmp 0x17156
movslq 0x2bc(%r14), %rax
movq 0x40(%r13), %rdi
movl 0x58(%r13), %esi
callq *0x10f1d8(%r12,%rax,8)
leaq 0xe665(%rip), %rdi      # 0x251b4
leaq 0x14ec2(%rip), %rsi     # 0x2ba18
leaq 0x1525d(%rip), %rdx     # 0x2bdba
xorl %eax, %eax
callq 0x4c22
movq 0x10(%r14), %rax
movq 0x18(%rax), %rsi
movl 0x30(%rax), %edx
movq 0x40(%rax), %rcx
movl 0x58(%rax), %r8d
leaq -0x2c0(%rbp), %rdi
movq %rcx, -0x60(%rbp)
movl %r8d, -0x40(%rbp)
callq *0x10f360(%r12)
leaq 0x32c(%r14), %rbx
leaq 0x13234(%rip), %r14     # 0x29dd0
leaq 0x1326d(%rip), %r12     # 0x29e10
xorl %r13d, %r13d
leaq 0x1(%r13), %rax
movq %rax, -0x48(%rbp)
shlq $0x5, %rax
leaq (%rax,%rbp), %r15
addq $-0x4e0, %r15           # imm = 0xFB20
movq %r13, %rax
shlq $0x5, %rax
leaq (%rax,%rbp), %rsi
addq $-0x2c0, %rsi           # imm = 0xFD40
movq %r15, %rdi
movq -0x50(%rbp), %rax
callq *0x10f398(%rax)
movzwl (%r15), %eax
leaq 0x110f9(%rip), %rcx     # 0x27ce0
movzbl (%r13,%rcx), %ecx
leaq 0x110fc(%rip), %rdx     # 0x27cf0
movzbl (%r13,%rdx), %edx
leaq -0x4e0(%rbp,%rcx,8), %rcx
movw %ax, (%rcx,%rdx,2)
movq %r15, %rdi
movl -0x38(%rbp), %esi
movl $0x1, %edx
callq 0x16981
leaq 0xe597(%rip), %rdi      # 0x251b4
leaq 0x14df4(%rip), %rsi     # 0x2ba18
leaq 0x118bb(%rip), %rdx     # 0x284e6
xorl %eax, %eax
callq 0x4c22
xorl %eax, %eax
movslq 0x4(%r14,%rax,4), %rcx
movslq 0x4(%r12,%rax,4), %rdx
leaq (%r15,%rcx,8), %rcx
movswl (%rcx,%rdx,2), %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0xf, %rax
jne 0x16c34
addq $0x84, %rbx
movq -0x48(%rbp), %r13
cmpq $0x10, %r13
jne 0x16ba6
leaq -0x4e0(%rbp), %r15
movq %r15, %rdi
movq %r15, %rsi
movq -0x50(%rbp), %rax
callq *0x10f3a0(%rax)
leaq 0xe52f(%rip), %rdi      # 0x251b4
leaq 0x14d8c(%rip), %rsi     # 0x2ba18
leaq 0xec21(%rip), %rdx      # 0x258b4
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4c22
movl -0x38(%rbp), %r13d
movslq %r13d, %rax
imulq $0x2aaaaaab, %rax, %rsi # imm = 0x2AAAAAAB
movq %rsi, %rdi
shrq $0x3f, %rdi
shrq $0x20, %rsi
leal (%rsi,%rdi), %edx
leal 0xf(%rdx), %ecx
movl $0x2, %eax
shll %cl, %eax
cltq
imulq $0x55555556, %rax, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
addl %edx, %edx
leal (%rdx,%rdx,2), %ecx
movl %r13d, %edx
subl %ecx, %edx
movslq %edx, %rcx
shlq $0x6, %rcx
leaq 0x12f60(%rip), %rdx     # 0x29c50
movl (%rcx,%rdx), %edx
leal (%rsi,%rdi), %ecx
addl $0x10, %ecx
xorl %esi, %esi
movswl (%r15,%rsi,2), %r8d
movl %edx, %edi
imull %r8d, %edi
testl %r8d, %r8d
jle 0x16d11
addl %eax, %edi
sarl %cl, %edi
jmp 0x16d20
movl %eax, %r8d
subl %edi, %r8d
sarl %cl, %r8d
negl %r8d
movl %r8d, %edi
movw %di, (%r15,%rsi,2)
incq %rsi
cmpq $0x4, %rsi
jne 0x16cfb
incq %rbx
addq $0x8, %r15
cmpq $0x4, %rbx
jne 0x16cf9
leaq 0xe472(%rip), %rdi      # 0x251b4
leaq 0x14ccf(%rip), %rsi     # 0x2ba18
leaq 0x11780(%rip), %rdx     # 0x284d0
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4c22
movq -0x30(%rbp), %rdx
movslq (%rbx,%r14), %rax
movslq (%rbx,%r12), %rcx
leaq -0x4e0(,%rax,8), %rax
addq %rbp, %rax
movswl (%rax,%rcx,2), %eax
movl %eax, 0x2c4(%rdx,%rbx)
addq $0x4, %rbx
cmpq $0x40, %rbx
jne 0x16d5d
leaq -0x4e0(%rbp), %r15
movq %r15, %rdi
movq %r15, %rsi
movq -0x50(%rbp), %r12
callq *0x10f3b0(%r12)
movq %r15, %rdi
movl %r13d, %esi
callq 0x6957
leaq -0x4c0(%rbp), %r15
xorl %ebx, %ebx
leaq -0x2c0(%rbp), %r13
leaq 0x1(%rbx), %r14
movq %r15, %rdi
movl -0x38(%rbp), %esi
callq 0x6a50
leaq 0x10f11(%rip), %rax     # 0x27ce0
movzbl (%rbx,%rax), %eax
leaq 0x10f16(%rip), %rcx     # 0x27cf0
movzbl (%rbx,%rcx), %ecx
leaq -0x4e0(%rbp,%rax,8), %rax
movzwl (%rax,%rcx,2), %eax
movw %ax, (%r15)
movq %r13, %rdi
movq %r15, %rsi
callq *0x10f3a8(%r12)
addq $0x20, %r13
addq $0x20, %r15
movq %r14, %rbx
cmpq $0x10, %r14
jne 0x16db9
leaq -0x2c0(%rbp), %rdx
movq -0x60(%rbp), %rdi
movl -0x40(%rbp), %esi
callq *0x10f378(%r12)
movq -0x30(%rbp), %rdx
movslq 0x2bc(%rdx), %rax
leaq 0x12b3b(%rip), %rcx     # 0x29970
movl (%rcx,%rax,4), %eax
movl %eax, 0x2bc(%rdx)
jmp 0x17152
movq %r12, %rdi
movq %r14, %rsi
callq 0x7415
leaq 0x324(%r14), %rax
movq %rax, -0x78(%rbp)
addq $0x368, %r14            # imm = 0x368
leaq 0x10e89(%rip), %rcx     # 0x27cf0
leaq 0x10e72(%rip), %rdx     # 0x27ce0
leaq 0x12f5b(%rip), %r15     # 0x29dd0
leaq 0x12f94(%rip), %rbx     # 0x29e10
xorl %esi, %esi
xorl %eax, %eax
movl %eax, -0x98(%rbp)
movq %rsi, %rax
shlq $0x7, %rax
addq %rbp, %rax
addq $-0x4e0, %rax           # imm = 0xFB20
movq %rax, -0x88(%rbp)
movq %rsi, -0x90(%rbp)
leaq (,%rsi,4), %rax
movq %rax, -0x80(%rbp)
movq %r14, -0x70(%rbp)
xorl %edi, %edi
xorl %esi, %esi
movl %esi, -0x48(%rbp)
movq -0x80(%rbp), %rax
movq %rdi, -0x60(%rbp)
leaq (%rdi,%rax), %rsi
movzbl (%rcx,%rsi), %eax
shll $0x2, %eax
movq 0x18(%r13), %rcx
addq %rax, %rcx
movzbl (%rdx,%rsi), %edi
movq %rsi, %r12
movq %rsi, -0x40(%rbp)
shll $0x2, %edi
movslq 0x30(%r13), %rdx
movq %rdx, %rsi
imulq %rdi, %rsi
addq %rcx, %rsi
addq 0x40(%r13), %rax
movl 0x58(%r13), %r8d
imull %r8d, %edi
movslq %edi, %rcx
addq %rax, %rcx
leaq -0x2c0(%rbp), %rdi
movq -0x50(%rbp), %r13
callq *0x10f350(%r13)
movq %r12, %rax
shlq $0x5, %rax
leaq (%rax,%rbp), %r12
addq $-0x4e0, %r12           # imm = 0xFB20
movq %r12, %rdi
leaq -0x2c0(%rbp), %rsi
callq *0x10f398(%r13)
movq %r12, %rdi
movl -0x38(%rbp), %esi
xorl %edx, %edx
callq 0x16981
movq -0x40(%rbp), %rcx
movq %rcx, %rax
shlq $0x7, %rax
leaq (%rax,%rcx,4), %rax
movq -0x78(%rbp), %rcx
leaq (%rcx,%rax), %r13
addq $0x44, %r13
leaq 0xe24d(%rip), %rdi      # 0x251b4
leaq 0x14aaa(%rip), %rsi     # 0x2ba18
leaq 0x1155b(%rip), %rdx     # 0x284d0
xorl %eax, %eax
callq 0x4c22
xorl %eax, %eax
movslq (%rax,%r15), %rcx
movslq (%rax,%rbx), %rdx
leaq (%r12,%rcx,8), %rcx
movswl (%rcx,%rdx,2), %ecx
movl %ecx, (%r14,%rax)
addq $0x4, %rax
cmpq $0x40, %rax
jne 0x16f7e
movq %r13, %rdi
movl $0x10, %esi
callq 0x178bd
movl -0x48(%rbp), %esi
addl %eax, %esi
movq -0x60(%rbp), %rdi
incq %rdi
addq $0x84, %r14
cmpq $0x4, %rdi
movq -0x68(%rbp), %r13
leaq 0x10d25(%rip), %rcx     # 0x27cf0
leaq 0x10d0e(%rip), %rdx     # 0x27ce0
jne 0x16eb8
cmpl $0x3, %esi
movq -0x70(%rbp), %r14
xorps %xmm0, %xmm0
jg 0x17031
movq -0x88(%rbp), %rax
movaps %xmm0, 0x70(%rax)
movaps %xmm0, 0x60(%rax)
movaps %xmm0, 0x50(%rax)
movaps %xmm0, 0x40(%rax)
movaps %xmm0, 0x30(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
xorl %eax, %eax
movups %xmm0, 0x30(%r14,%rax)
movups %xmm0, 0x20(%r14,%rax)
movups %xmm0, 0x10(%r14,%rax)
movups %xmm0, (%r14,%rax)
addq $0x84, %rax
cmpq $0x210, %rax            # imm = 0x210
jne 0x1700c
movl -0x98(%rbp), %eax
addl %esi, %eax
movq -0x90(%rbp), %rsi
incq %rsi
addq $0x210, %r14            # imm = 0x210
cmpq $0x4, %rsi
jne 0x16e80
cmpl $0x5, %eax
jg 0x170a1
movq -0x30(%rbp), %rax
addq $0x368, %rax            # imm = 0x368
xorl %ecx, %ecx
xorps %xmm0, %xmm0
xorl %edx, %edx
movups %xmm0, 0x30(%rax,%rdx)
movups %xmm0, 0x20(%rax,%rdx)
movups %xmm0, 0x10(%rax,%rdx)
movups %xmm0, (%rax,%rdx)
addq $0x84, %rdx
cmpq $0x210, %rdx            # imm = 0x210
jne 0x1706a
incq %rcx
addq $0x210, %rax            # imm = 0x210
cmpq $0x4, %rcx
jne 0x17068
jmp 0x1714e
leaq -0x4e0(%rbp), %r15
xorl %eax, %eax
xorl %ecx, %ecx
movq -0x50(%rbp), %r13
movq -0x68(%rbp), %r12
movq %rax, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq %r15, -0x60(%rbp)
xorl %ebx, %ebx
leaq -0x2c0(%rbp), %r14
movq %r15, %rdi
movl -0x38(%rbp), %esi
callq 0x6a50
movq %r14, %rdi
movq %r15, %rsi
callq *0x10f3a8(%r13)
movq -0x48(%rbp), %rax
addq %rbx, %rax
leaq 0x10c01(%rip), %rcx     # 0x27cf0
movzbl (%rcx,%rax), %ecx
shlq $0x2, %rcx
addq 0x40(%r12), %rcx
leaq 0x10bdd(%rip), %rdx     # 0x27ce0
movzbl (%rdx,%rax), %edi
shll $0x2, %edi
movslq 0x58(%r12), %rsi
imulq %rsi, %rdi
addq %rcx, %rdi
movq %r14, %rdx
callq *0x10f368(%r13)
incq %rbx
addq $0x20, %r15
cmpq $0x4, %rbx
jne 0x170c9
movq -0x40(%rbp), %rcx
incq %rcx
movq -0x48(%rbp), %rax
addq $0x4, %rax
movq -0x60(%rbp), %r15
subq $-0x80, %r15
cmpq $0x4, %rcx
jne 0x170b4
movq -0x50(%rbp), %r12
movl -0x38(%rbp), %r14d
movq 0x10dae0(%r12), %rax
addl 0x103c(%rax), %r14d
cmpl $0x33, %r14d
movl $0x33, %eax
cmovll %r14d, %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
leaq 0x12840(%rip), %rcx     # 0x299c0
movl (%rcx,%rax,4), %r15d
movq -0x30(%rbp), %r14
cmpl $0x1, 0x18(%r14)
ja 0x171bf
movslq 0x2c0(%r14), %rax
movq -0x68(%rbp), %rbx
movq 0x48(%rbx), %rdi
movl 0x5c(%rbx), %esi
callq *0x10f210(%r12,%rax,8)
movslq 0x2c0(%r14), %rax
movq 0x50(%rbx), %rdi
movl 0x60(%rbx), %esi
callq *0x10f210(%r12,%rax,8)
movl 0x18(%r14), %eax
xorl %ebx, %ebx
xorl %ecx, %ecx
movl %eax, -0xa4(%rbp)
cmpl $0x2, %eax
setae %bl
setb %cl
movl %ecx, -0x68(%rbp)
leaq 0xdfd4(%rip), %rdi      # 0x251b4
leaq 0x14831(%rip), %rsi     # 0x2ba18
leaq 0x14bf9(%rip), %rdx     # 0x2bde7
xorl %eax, %eax
callq 0x4c22
movq 0x10(%r14), %rax
movq %rax, -0xc0(%rbp)
leaq 0x324(%r14), %rax
movq %rax, -0x40(%rbp)
movl %r15d, -0x48(%rbp)
movslq %r15d, %rsi
imulq $0x2aaaaaab, %rsi, %rax # imm = 0x2AAAAAAB
movq %rax, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rax
leal (%rax,%rdx), %edi
leal 0xf(%rdi), %ecx
movl $0x2, %r8d
shll %cl, %r8d
movl %r8d, -0xa0(%rbp)
leal (%rbx,%rbx,2), %ecx
addl $0x3, %ecx
movl %ecx, -0x9c(%rbp)
addl %edi, %edi
leal (%rdi,%rdi,2), %ecx
subl %ecx, %esi
movslq %esi, %rcx
shlq $0x6, %rcx
leaq 0x129f5(%rip), %rsi     # 0x29c50
addq %rcx, %rsi
movq %rsi, -0xb8(%rbp)
leal (%rax,%rdx), %r13d
addl $0x10, %r13d
leaq 0x304(%r14), %rax
movq %rax, -0xb0(%rbp)
leaq 0xb6c(%r14), %rbx
leaq -0x4e0(%rbp), %r15
leaq 0x12b80(%rip), %r14     # 0x29e10
xorl %eax, %eax
movl $0x0, -0x80(%rbp)
movq %r12, %r9
leaq 0x1(%rax), %rcx
movq %rcx, -0x98(%rbp)
movq %rax, %r12
movq -0xc0(%rbp), %rax
movq 0x20(%rax,%r12,8), %rsi
movq 0x48(%rax,%r12,8), %rcx
movl 0x34(%rax,%r12,4), %edx
movl 0x5c(%rax,%r12,4), %r8d
movq %r15, %rdi
movq %rcx, -0x90(%rbp)
movl %r8d, -0x88(%rbp)
callq *0x10f358(%r9)
movq %r12, -0x70(%rbp)
leaq 0x10(,%r12,4), %rax
movq %rax, -0x38(%rbp)
movq %rbx, -0x78(%rbp)
movq %rbx, %r12
xorl %r15d, %r15d
movq %r15, %rax
shlq $0x5, %rax
leaq (%rax,%rbp), %rbx
addq $-0x2c0, %rbx           # imm = 0xFD40
leaq (%rax,%rbp), %rsi
addq $-0x4e0, %rsi           # imm = 0xFB20
movq %rbx, %rdi
movq -0x50(%rbp), %rax
callq *0x10f398(%rax)
movzwl (%rbx), %eax
leaq 0x109b5(%rip), %rcx     # 0x27ce0
movzbl (%r15,%rcx), %ecx
leaq 0x109b9(%rip), %rdx     # 0x27cf0
movzbl (%r15,%rdx), %edx
leaq -0x58(%rbp,%rcx,4), %rcx
movw %ax, (%rcx,%rdx,2)
movq %rbx, %rdi
movl -0x48(%rbp), %esi
movl -0x68(%rbp), %edx
callq 0x16981
movq -0x38(%rbp), %rax
addq %r15, %rax
movq %rax, %rcx
shlq $0x7, %rcx
leaq (%rcx,%rax,4), %rax
movq -0x40(%rbp), %rcx
addq %rcx, %rax
addq $0x8, %rax
movq %rax, -0x60(%rbp)
leaq 0xde39(%rip), %rdi      # 0x251b4
leaq 0x14696(%rip), %rsi     # 0x2ba18
leaq 0x1115d(%rip), %rdx     # 0x284e6
xorl %eax, %eax
callq 0x4c22
xorl %eax, %eax
leaq 0x12a37(%rip), %rsi     # 0x29dd0
movslq 0x4(%rsi,%rax,4), %rcx
movslq 0x4(%r14,%rax,4), %rdx
leaq (%rbx,%rcx,8), %rcx
movswl (%rcx,%rdx,2), %ecx
movl %ecx, (%r12,%rax,4)
incq %rax
cmpq $0xf, %rax
jne 0x17399
movq -0x60(%rbp), %rdi
movl $0xf, %esi
callq 0x178bd
addl %eax, -0x80(%rbp)
incq %r15
addq $0x84, %r12
cmpq $0x4, %r15
jne 0x172f7
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
movq -0x50(%rbp), %r15
callq *0x10f3b8(%r15)
leaq 0xddbb(%rip), %rdi      # 0x251b4
leaq 0x14618(%rip), %rsi     # 0x2ba18
leaq 0xe496(%rip), %rdx      # 0x2589d
xorl %eax, %eax
callq 0x4c22
movl -0xa0(%rbp), %eax
cltd
idivl -0x9c(%rbp)
movq -0xb8(%rbp), %rcx
movl (%rcx), %edx
xorl %edi, %edi
xorl %r8d, %r8d
movswl (%rbx,%r8,2), %ecx
movl %edx, %r9d
imull %ecx, %r9d
testl %ecx, %ecx
jle 0x17444
addl %eax, %r9d
movl %r13d, %ecx
sarl %cl, %r9d
jmp 0x17456
movl %eax, %r10d
subl %r9d, %r10d
movl %r13d, %ecx
sarl %cl, %r10d
negl %r10d
movl %r10d, %r9d
movw %r9w, (%rbx,%r8,2)
incq %r8
cmpq $0x1, %r8
je 0x17429
leaq 0x1(%rdi), %rcx
addq $0x4, %rbx
testq %rdi, %rdi
movq %rcx, %rdi
je 0x17426
movq -0x70(%rbp), %rbx
shlq $0x4, %rbx
leaq 0xdd31(%rip), %rdi      # 0x251b4
leaq 0x1458e(%rip), %rsi     # 0x2ba18
leaq 0x110e3(%rip), %rdx     # 0x28574
xorl %eax, %eax
callq 0x4c22
movswl -0x58(%rbp), %eax
movq -0xb0(%rbp), %rcx
movl %eax, (%rcx,%rbx)
movswl -0x56(%rbp), %eax
movl %eax, 0x4(%rcx,%rbx)
movswl -0x54(%rbp), %eax
movl %eax, 0x8(%rcx,%rbx)
movswl -0x52(%rbp), %eax
movl %eax, 0xc(%rcx,%rbx)
cmpl $0x2, -0xa4(%rbp)
movq -0x78(%rbp), %rcx
xorps %xmm0, %xmm0
jb 0x1752f
cmpl $0x6, -0x80(%rbp)
jg 0x1752f
movaps %xmm0, -0x250(%rbp)
movaps %xmm0, -0x260(%rbp)
movaps %xmm0, -0x270(%rbp)
movaps %xmm0, -0x280(%rbp)
movaps %xmm0, -0x290(%rbp)
movaps %xmm0, -0x2a0(%rbp)
movaps %xmm0, -0x2b0(%rbp)
movaps %xmm0, -0x2c0(%rbp)
xorl %eax, %eax
movups %xmm0, 0x2c(%rcx,%rax)
movups %xmm0, 0x20(%rcx,%rax)
movups %xmm0, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
addq $0x84, %rax
cmpq $0x210, %rax            # imm = 0x210
jne 0x1750e
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
movq %rbx, %rsi
callq *0x10f3c0(%r15)
movq %rbx, %rdi
movl -0x48(%rbp), %esi
callq 0x6868
leaq -0x2c0(%rbp), %rbx
leaq -0x4e0(%rbp), %r12
xorl %r15d, %r15d
movq %rbx, %rdi
movl -0x48(%rbp), %esi
callq 0x6a50
leaq 0x10772(%rip), %rax     # 0x27ce0
movzbl (%r15,%rax), %eax
leaq 0x10776(%rip), %rcx     # 0x27cf0
movzbl (%r15,%rcx), %ecx
leaq -0x58(%rbp,%rax,4), %rax
movzwl (%rax,%rcx,2), %eax
movw %ax, (%rbx)
movq %r12, %rdi
movq %rbx, %rsi
movq -0x50(%rbp), %rax
callq *0x10f3a8(%rax)
incq %r15
addq $0x20, %r12
addq $0x20, %rbx
cmpq $0x4, %r15
jne 0x1755c
movq -0x90(%rbp), %rdi
movl -0x88(%rbp), %esi
leaq -0x4e0(%rbp), %r15
movq %r15, %rdx
movq -0x50(%rbp), %r12
callq *0x10f370(%r12)
movq -0x78(%rbp), %rbx
addq $0x210, %rbx            # imm = 0x210
cmpq $0x0, -0x70(%rbp)
movq -0x98(%rbp), %rax
movq %r12, %r9
je 0x1729c
movq -0x30(%rbp), %rsi
movl 0x18(%rsi), %eax
cmpl $0x1, %eax
ja 0x17612
movslq 0x2c0(%rsi), %rcx
leaq 0x12487(%rip), %rdx     # 0x29a90
movl (%rdx,%rcx,4), %ecx
movl %ecx, 0x2c0(%rsi)
movl $0x0, 0x2b8(%rsi)
cmpl $0x1, %eax
jne 0x17698
leaq 0x32c(%rsi), %r12
leaq 0x143e9(%rip), %r14     # 0x2ba18
leaq 0x147c4(%rip), %r15     # 0x2bdfa
xorl %r13d, %r13d
movq %r13, %rax
shlq $0x7, %rax
leaq (%rax,%r13,4), %rbx
addq -0x40(%rbp), %rbx
leaq 0xdb65(%rip), %rdi      # 0x251b4
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4c22
xorl %ecx, %ecx
xorl %eax, %eax
cmpl $0x1, (%r12,%rcx,4)
sbbl $-0x1, %eax
incq %rcx
cmpq $0xf, %rcx
jne 0x17660
movl %eax, 0x4(%rbx)
testl %eax, %eax
je 0x17686
movq -0x30(%rbp), %rax
movl $0xf, 0x2b8(%rax)
incq %r13
addq $0x84, %r12
cmpq $0x10, %r13
jne 0x17639
jmp 0x17716
leaq 0x368(%rsi), %r12
leaq 0x14372(%rip), %r14     # 0x2ba18
leaq 0x1474d(%rip), %r15     # 0x2bdfa
xorl %r13d, %r13d
movq %r13, %rax
shlq $0x7, %rax
leaq (%rax,%r13,4), %rbx
addq -0x40(%rbp), %rbx
leaq 0xdaee(%rip), %rdi      # 0x251b4
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4c22
xorl %ecx, %ecx
xorl %eax, %eax
cmpl $0x1, (%r12,%rcx,4)
sbbl $-0x1, %eax
incq %rcx
cmpq $0x10, %rcx
jne 0x176d7
movl %eax, 0x4(%rbx)
testl %eax, %eax
je 0x17706
movl %r13d, %ecx
shrl $0x2, %ecx
movl $0x1, %eax
shll %cl, %eax
movq -0x30(%rbp), %rcx
orl %eax, 0x2b8(%rcx)
incq %r13
addq $0x84, %r12
cmpq $0x10, %r13
jne 0x176b0
movq -0x30(%rbp), %rax
movl $0x0, 0x2b4(%rax)
leaq 0xb6c(%rax), %r12
leaq 0x142e6(%rip), %r14     # 0x2ba18
leaq 0x146c1(%rip), %r15     # 0x2bdfa
xorl %r13d, %r13d
movq %r13, %rax
orq $0x10, %rax
shlq $0x7, %rax
leaq (%rax,%r13,4), %rbx
addq $0x40, %rbx
addq -0x40(%rbp), %rbx
leaq 0xda5a(%rip), %rdi      # 0x251b4
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4c22
xorl %ecx, %ecx
xorl %eax, %eax
cmpl $0x1, (%r12,%rcx,4)
sbbl $-0x1, %eax
incq %rcx
cmpq $0xf, %rcx
jne 0x1776b
movl %eax, 0x4(%rbx)
testl %eax, %eax
je 0x17791
movq -0x30(%rbp), %rax
movl $0x2, 0x2b4(%rax)
incq %r13
addq $0x84, %r12
cmpq $0x8, %r13
jne 0x1773c
movq -0x30(%rbp), %r14
cmpl $0x0, 0x2b4(%r14)
jne 0x1782e
leaq 0xd9fe(%rip), %rdi      # 0x251b4
leaq 0x1425b(%rip), %rsi     # 0x2ba18
leaq 0x14636(%rip), %rdx     # 0x2bdfa
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4c22
xorl %eax, %eax
movq -0xb0(%rbp), %rcx
cmpl $0x1, (%rcx,%rbx,4)
sbbl $-0x1, %eax
incq %rbx
cmpq $0x4, %rbx
jne 0x177d6
testl %eax, %eax
jne 0x17823
leaq 0xd9c3(%rip), %rdi      # 0x251b4
leaq 0x14220(%rip), %rsi     # 0x2ba18
leaq 0x145fb(%rip), %rdx     # 0x2bdfa
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4c22
xorl %eax, %eax
cmpl $0x1, 0x314(%r14,%rbx,4)
sbbl $-0x1, %eax
incq %rbx
cmpq $0x4, %rbx
jne 0x1780a
testl %eax, %eax
je 0x1782e
movl $0x1, 0x2b4(%r14)
cmpl $0x3, 0x18(%r14)
jne 0x178ab
cmpl $0x10, 0x1c(%r14)
jne 0x178ab
cmpl $0x0, 0x2b8(%r14)
jne 0x178ab
cmpl $0x0, 0x2b4(%r14)
jne 0x178ab
leaq -0xa8(%rbp), %rax
movq %rax, (%rsp)
leaq -0x2c0(%rbp), %rbx
leaq -0x58(%rbp), %r9
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x6ca8
cmpl $0x0, (%rbx)
jne 0x178ab
leaq -0x4e0(%rbp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x730c
movl (%rbx), %eax
cmpl -0x58(%rbp), %eax
jne 0x178ab
movl -0x4dc(%rbp), %eax
cmpl -0xa8(%rbp), %eax
jne 0x178ab
movl $0x5, 0x18(%r14)
addq $0x4c8, %rsp            # imm = 0x4C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq