// File: /workspace/github_c_makefile_star2_O2/akumrao[P]videoAnalyzer/encoder/macroblock.c
// Function: x264_macroblock_write_cabac(x264_t*, bs_s*, x264_macroblock_t*)
void x264_macroblock_write_cabac(x264_t *h, bs_t *s, x264_macroblock_t *mb) {LOG_CALL;
    int i;

    /* Write the MB type */
#if 0
    fprintf(stderr, "[%d,%d] type=%d cbp=%d predc=%d\n",
            mb->i_mb_x, mb->i_mb_y,
            1 + mb->i_intra16x16_pred_mode + mb->i_cbp_chroma * 4 + (mb->i_cbp_luma == 0 ? 0 : 12),
            (mb->i_cbp_chroma << 4) | mb->i_cbp_luma,
            mb->i_chroma_pred_mode);
#endif
    x264_cabac_mb_type(h, mb);

    /* PCM special block type UNTESTED */
    if (mb->i_type == I_PCM)
    {
        bs_align_0(s); /* not sure */
        /* Luma */
        for (i = 0; i < 16 * 16; i++)
        {
            bs_write(s, 8, h->picture->plane[0][mb->i_mb_y * 16 * h->picture->i_stride[0] + mb->i_mb_x * 16 + i],"h->picture->plane[0]");
        }
        /* Cb */
        for (i = 0; i < 8 * 8; i++)
        {
            bs_write(s, 8, h->picture->plane[1][mb->i_mb_y * 8 * h->picture->i_stride[1] + mb->i_mb_x * 8 + i],"h->picture->plane[1]");
        }
        /* Cr */
        for (i = 0; i < 8 * 8; i++)
        {
            bs_write(s, 8, h->picture->plane[2][mb->i_mb_y * 8 * h->picture->i_stride[2] + mb->i_mb_x * 8 + i],"h->picture->plane[2]");
        }

        for (i = 0; i < 16 + 8; i++)
        {
            /* special case */
            mb->block[i].i_non_zero_count = 16;
        }

        x264_cabac_encode_init(&h->cabac, s);
        return;
    }

    if (IS_INTRA(mb->i_type))
    {
        /* Prediction */
        if (mb->i_type == I_4x4)
        {
            for (i = 0; i < 16; i++)
            {
                x264_cabac_mb_intra4x4_pred_mode(h, mb,
                        x264_mb_predict_intra4x4_mode(h, mb, i),
                        mb->block[i].i_intra4x4_pred_mode);
            }
        }
        x264_cabac_mb_intra8x8_pred_mode(h, mb);
    } else if (mb->i_type == P_8x8)
    {
        /* sub mb type */
        for (i = 0; i < 4; i++)
        {
            x264_cabac_mb_sub_partition(h, mb->i_sub_partition[i]);
        }
        /* ref 0 */
        if (h->sh.i_num_ref_idx_l0_active > 1)
        {
            for (i = 0; i < 4; i++)
            {
                x264_cabac_mb_ref(h, mb, 0, i);
            }
        }

        for (i = 0; i < 4; i++)
        {
            int i_sub;
            for (i_sub = 0; i_sub < x264_mb_partition_count_table[mb->i_sub_partition[i]]; i_sub++)
            {
                x264_cabac_mb_mv(h, mb, 0, i, i_sub);
            }
        }
    } else if (mb->i_type == B_8x8)
    {
        /* TODO */
        fprintf(stderr, "Arggg B_8x8\n");
    } else if (mb->i_type != B_DIRECT)
    {
        /* FIXME -> invalid for B frame */

        /* Motion Vector */
        int i_part = x264_mb_partition_count_table[mb->i_partition];

        if (h->sh.i_num_ref_idx_l0_active > 1)
        {
            for (i = 0; i < i_part; i++)
            {
                if (mb->i_type == P_L0)
                {
                    x264_cabac_mb_ref(h, mb, 0, i);
                }
            }
        }

        for (i = 0; i < i_part; i++)
        {
            if (mb->i_type == P_L0)
            {
                x264_cabac_mb_mv(h, mb, 0, i, 0);
            }
        }
    }

    if (mb->i_type != I_16x16)
    {
        x264_cabac_mb_cbp_luma(h, mb);
        x264_cabac_mb_cbp_chroma(h, mb);
    }

    if (mb->i_cbp_luma > 0 || mb->i_cbp_chroma > 0 || mb->i_type == I_16x16)
    {
        x264_cabac_mb_qp_delta(h, mb);

        /* write residual */
        if (mb->i_type == I_16x16)
        {
            /* DC Luma */
            block_residual_write_cabac(h, mb, 0, 0, mb->luma16x16_dc, 16);

            if (mb->i_cbp_luma != 0)
            {
                /* AC Luma */
                for (i = 0; i < 16; i++)
                {
                    block_residual_write_cabac(h, mb, 1, i, mb->block[i].residual_ac, 15);
                }
            }
        } else
        {
            for (i = 0; i < 16; i++)
            {
                if (mb->i_cbp_luma & (1 << (i / 4)))
                {
                    block_residual_write_cabac(h, mb, 2, i, mb->block[i].luma4x4, 16);
                }
            }
        }

        if (mb->i_cbp_chroma & 0x03) /* Chroma DC residual present */
        {
            block_residual_write_cabac(h, mb, 3, 0, mb->chroma_dc[0], 4);
            block_residual_write_cabac(h, mb, 3, 1, mb->chroma_dc[1], 4);
        }
        if (mb->i_cbp_chroma & 0x02) /* Chroma AC residual present */
        {
            for (i = 0; i < 8; i++)
            {
                block_residual_write_cabac(h, mb, 4, i, mb->block[16 + i].residual_ac, 15);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, -0x30(%rbp)
movq %rdi, %rbx
leaq 0x88e6(%rip), %r12      # 0x1b1b4
leaq 0xf093(%rip), %r13      # 0x21968
leaq 0xf3c6(%rip), %rdx      # 0x21ca2
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x39ba
leaq 0xf563(%rip), %rdx      # 0x21e53
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x39ba
movl 0x10db00(%rbx), %eax
testl %eax, %eax
je 0x129ba
cmpl $0x2, %eax
jne 0x12b89
movq 0x10(%r14), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
xorl %esi, %esi
testq %rcx, %rcx
je 0x1292e
cmpl $0x0, 0x18(%rcx)
setne %sil
testq %rax, %rax
je 0x1293a
cmpl $0x1, 0x18(%rax)
sbbl $-0x1, %esi
movl 0x18(%r14), %eax
leaq 0x10db60(%rbx), %r12
addl $0x3, %esi
cmpl $0x2, %eax
je 0x129e6
testl %eax, %eax
je 0x12bcc
pushq $0x1
popq %rdx
movq %r12, %rdi
callq 0x30bc
movq %r12, %rdi
xorl %esi, %esi
callq 0x32ae
xorl %edx, %edx
cmpl $0x0, 0x2b8(%r14)
setne %dl
pushq $0x6
popq %rsi
movq %r12, %rdi
callq 0x30bc
cmpl $0x0, 0x2b4(%r14)
je 0x12b4d
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rdi
callq 0x30bc
xorl %edx, %edx
cmpl $0x1, 0x2b4(%r14)
setne %dl
pushq $0x8
popq %rsi
movq %r12, %rdi
jmp 0x12b55
movl 0x18(%r14), %eax
cmpq $0x4, %rax
ja 0x12a96
leaq 0xcea5(%rip), %rcx      # 0x1f874
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10db60(%rbx), %r12
pushq $0xe
jmp 0x12bbd
pushq $0x1
popq %r13
jmp 0x12a4f
movl 0x1c(%r14), %eax
cmpl $0xe, %eax
je 0x134e4
cmpl $0xf, %eax
je 0x12ba7
cmpl $0x10, %eax
jne 0x12bd6
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0xf
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0x10
jmp 0x12bcb
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
pushq $0x1
popq %r13
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
pushq $0x11
popq %rsi
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
movq %r12, %rdi
movl %r13d, %esi
callq 0x32ae
jmp 0x12bd6
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0xf
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
jmp 0x12b84
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
pushq $0x1
popq %r13
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
pushq $0x11
popq %rsi
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
xorl %r13d, %r13d
movq %r12, %rdi
xorl %esi, %esi
callq 0x32ae
xorl %edx, %edx
cmpl $0x0, 0x2b8(%r14)
setne %dl
pushq $0x12
popq %rsi
movq %r12, %rdi
callq 0x30bc
cmpl $0x0, 0x2b4(%r14)
je 0x12b09
pushq $0x13
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rdi
callq 0x30bc
xorl %r13d, %r13d
cmpl $0x1, 0x2b4(%r14)
setne %r13b
pushq $0x13
popq %rsi
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
movl 0x2bc(%r14), %eax
addl $-0x2, %eax
xorl %edx, %edx
cmpl $-0x3, %eax
setb %dl
pushq $0x14
popq %r13
movq %r12, %rdi
movl %r13d, %esi
callq 0x30bc
movl 0x2bc(%r14), %edx
andl $0x1, %edx
movq %r12, %rdi
movl %r13d, %esi
jmp 0x12bd1
pushq $0x7
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
movl 0x2bc(%r14), %eax
addl $-0x2, %eax
xorl %edx, %edx
cmpl $-0x3, %eax
setb %dl
pushq $0x9
popq %rsi
movq %r12, %rdi
callq 0x30bc
movl 0x2bc(%r14), %edx
andl $0x1, %edx
pushq $0xa
popq %rsi
movq %r12, %rdi
jmp 0x12bd1
movq 0x15440(%rip), %rax     # 0x27fd0
movq (%rax), %rcx
leaq 0xf2cc(%rip), %rdi      # 0x21e66
pushq $0x38
popq %rsi
pushq $0x1
popq %rdx
callq 0x21e0
jmp 0x12bd6
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
movq %r12, %rdi
callq 0x30bc
pushq $0x11
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
movl 0x18(%r14), %eax
cmpq $0x6, %rax
movq %rbx, -0x38(%rbp)
ja 0x12fe4
leaq 0xcc99(%rip), %rcx      # 0x1f888
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x324(%r14), %r12
leaq 0x10db60(%rbx), %rax
movq %rax, -0x40(%rbp)
xorl %r13d, %r13d
cmpq $0x10, %r13
je 0x12cce
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
callq 0x5490
movl %eax, %r15d
movq %r12, -0x30(%rbp)
movl (%r12), %r12d
leaq 0x857d(%rip), %rdi      # 0x1b1b4
leaq 0xed2a(%rip), %rsi      # 0x21968
leaq 0xf25a(%rip), %rdx      # 0x21e9f
xorl %eax, %eax
callq 0x39ba
cmpl %r12d, %r15d
jne 0x12c5d
movq -0x40(%rbp), %rdi
pushq $0x44
popq %rsi
pushq $0x1
popq %rdx
jmp 0x12cb6
movq -0x40(%rbp), %rbx
movq %rbx, %rdi
pushq $0x44
popq %rsi
xorl %edx, %edx
callq 0x30bc
xorl %eax, %eax
cmpl %r15d, %r12d
setg %al
subl %eax, %r12d
movl %r12d, %edx
andl $0x1, %edx
movq %rbx, %rdi
pushq $0x45
popq %r15
movl %r15d, %esi
callq 0x30bc
movl %r12d, %edx
shrl %edx
andl $0x1, %edx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x30bc
shrl $0x2, %r12d
andl $0x1, %r12d
movq %rbx, %rdi
movq -0x38(%rbp), %rbx
movl %r15d, %esi
movl %r12d, %edx
callq 0x30bc
incq %r13
movq -0x30(%rbp), %r12
addq $0x84, %r12
jmp 0x12c0d
leaq 0x84df(%rip), %rdi      # 0x1b1b4
leaq 0xec8c(%rip), %rsi      # 0x21968
leaq 0xf1dd(%rip), %rdx      # 0x21ec0
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x39ba
movq 0x10(%r14), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
testq %rcx, %rcx
je 0x12d11
cmpl $0x1, 0x18(%rcx)
ja 0x12d11
xorl %r15d, %r15d
cmpl $0x0, 0x2c0(%rcx)
setne %r15b
testq %rax, %rax
je 0x12d27
cmpl $0x1, 0x18(%rax)
ja 0x12d27
cmpl $0x1, 0x2c0(%rax)
sbbl $-0x1, %r15d
leaq 0x10db60(%rbx), %r12
addl $0x40, %r15d
cmpl $0x0, 0x2c0(%r14)
je 0x12fd5
pushq $0x1
popq %rdx
movq %r12, %rdi
movl %r15d, %esi
callq 0x30bc
xorl %edx, %edx
cmpl $0x1, 0x2c0(%r14)
setne %dl
pushq $0x43
popq %rsi
movq %r12, %rdi
callq 0x30bc
cmpl $0x2, 0x2c0(%r14)
jl 0x13050
setne %al
movzbl %al, %edx
pushq $0x43
popq %rsi
movq %r12, %rdi
jmp 0x12fdd
leaq 0x10db60(%rbx), %r15
pushq $0x8
popq %r13
cmpq $0xc, %r13
je 0x12e4c
movq %rbx, %r12
movl (%r14,%r13,4), %ebx
leaq 0x840c(%rip), %rdi      # 0x1b1b4
leaq 0xebb9(%rip), %rsi      # 0x21968
leaq 0xf12b(%rip), %rdx      # 0x21ee1
xorl %eax, %eax
callq 0x39ba
cmpq $0x3, %rbx
ja 0x12e41
leaq 0xcada(%rip), %rcx      # 0x1f8a4
movslq (%rcx,%rbx,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rdi
pushq $0x15
popq %rsi
xorl %edx, %edx
callq 0x30bc
movq %r15, %rdi
pushq $0x16
popq %rsi
pushq $0x1
popq %rdx
callq 0x30bc
movq %r15, %rdi
pushq $0x17
jmp 0x12e39
movq %r15, %rdi
pushq $0x15
popq %rsi
xorl %edx, %edx
callq 0x30bc
movq %r15, %rdi
pushq $0x16
popq %rsi
pushq $0x1
popq %rbx
movl %ebx, %edx
callq 0x30bc
movq %r15, %rdi
pushq $0x17
popq %rsi
movl %ebx, %edx
jmp 0x12e3c
movq %r15, %rdi
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
jmp 0x12e3c
movq %r15, %rdi
pushq $0x15
popq %rsi
xorl %edx, %edx
callq 0x30bc
movq %r15, %rdi
pushq $0x16
popq %rsi
xorl %edx, %edx
callq 0x30bc
incq %r13
movq %r12, %rbx
jmp 0x12d90
cmpl $0x2, 0x10db38(%rbx)
jl 0x12e71
xorl %r15d, %r15d
cmpl $0x4, %r15d
je 0x12e71
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x13539
incl %r15d
jmp 0x12e58
xorl %r15d, %r15d
leaq 0xcb85(%rip), %r13      # 0x1fa00
cmpq $0x4, %r15
je 0x13050
xorl %r12d, %r12d
movslq 0x20(%r14,%r15,4), %rax
cmpl (%r13,%rax,4), %r12d
jge 0x12eaa
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r12d, %ecx
callq 0x1369d
incl %r12d
jmp 0x12e88
incq %r15
jmp 0x12e7b
movq -0x30(%rbp), %rdi
callq 0x121d7
xorl %r15d, %r15d
leaq 0xedfc(%rip), %r12      # 0x21cbe
pushq $0x8
popq %r13
cmpl $0x100, %r15d           # imm = 0x100
je 0x12f05
movq 0x10ee48(%rbx), %rax
movq 0x20(%rax), %rcx
movl 0xc(%rax), %eax
imull 0x4(%r14), %eax
addl (%r14), %eax
shll $0x4, %eax
addl %r15d, %eax
cltq
movzbl (%rcx,%rax), %edx
movq -0x30(%rbp), %rdi
movl %r13d, %esi
movq %r12, %rcx
callq 0x1221b
incl %r15d
jmp 0x12ec6
xorl %r15d, %r15d
leaq 0xedc4(%rip), %r12      # 0x21cd3
pushq $0x8
popq %r13
cmpl $0x40, %r15d
je 0x12f4e
movq 0x10ee48(%rbx), %rax
movl 0x10(%rax), %ecx
imull 0x4(%r14), %ecx
addl (%r14), %ecx
movq 0x28(%rax), %rax
leal (%r15,%rcx,8), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
movq -0x30(%rbp), %rdi
movl %r13d, %esi
movq %r12, %rcx
callq 0x1221b
incl %r15d
jmp 0x12f13
xorl %r15d, %r15d
leaq 0xed90(%rip), %r12      # 0x21ce8
pushq $0x8
popq %r13
cmpl $0x40, %r15d
je 0x12f97
movq 0x10ee48(%rbx), %rax
movl 0x14(%rax), %ecx
imull 0x4(%r14), %ecx
addl (%r14), %ecx
movq 0x30(%rax), %rax
leal (%r15,%rcx,8), %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %edx
movq -0x30(%rbp), %rdi
movl %r13d, %esi
movq %r12, %rcx
callq 0x1221b
incl %r15d
jmp 0x12f5c
movl $0x328, %eax            # imm = 0x328
cmpq $0xf88, %rax            # imm = 0xF88
je 0x12fb4
movl $0x10, (%r14,%rax)
addq $0x84, %rax
jmp 0x12f9c
addq $0x10db60, %rbx         # imm = 0x10DB60
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x309a
movq %r12, %rdi
movl %r15d, %esi
xorl %edx, %edx
callq 0x30bc
jmp 0x13050
cmpl $0x10, %eax
je 0x13518
movslq 0x1c(%r14), %rax
leaq 0xca08(%rip), %rcx      # 0x1fa00
movl (%rcx,%rax,4), %r13d
xorl %r15d, %r15d
testl %r13d, %r13d
cmovlel %r15d, %r13d
cmpl $0x2, 0x10db38(%rbx)
jl 0x1304b
xorl %r12d, %r12d
cmpl %r12d, %r13d
je 0x1304b
cmpl $0x3, 0x18(%r14)
jne 0x1302c
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x13539
incl %r12d
jmp 0x13012
cmpl $0x3, 0x18(%r14)
jne 0x13048
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %ecx, %ecx
callq 0x1369d
incl %r15d
cmpl %r15d, %r13d
jne 0x13031
cmpl $0x1, 0x18(%r14)
je 0x13273
leaq 0x8152(%rip), %rdi      # 0x1b1b4
leaq 0xe8ff(%rip), %rsi      # 0x21968
leaq 0xeec2(%rip), %rdx      # 0x21f32
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x39ba
leaq 0x10db60(%rbx), %rax
movq %rax, -0x30(%rbp)
movl $0x13c, %r12d           # imm = 0x13C
xorl %r15d, %r15d
cmpq $0xf, %r15
ja 0x13174
movq 0x10(%r14), %rdx
movq -0x8(%rdx,%r12,4), %rdi
leaq 0xb408(%rip), %rax      # 0x1e4b0
movzbl (%r15,%rax), %eax
leaq 0xb3ec(%rip), %rcx      # 0x1e4a0
movzbl (%r15,%rcx), %ecx
xorl %esi, %esi
testq %rdi, %rdi
je 0x13105
movl 0x18(%rdi), %r8d
cmpl $0x2, %r8d
je 0x13105
cmpl $0x5, %r8d
je 0x13102
cmpl $0x11, %r8d
je 0x13102
leal -0x1(%rax), %r8d
andb $0x3, %r8b
movzbl %r8b, %r8d
leaq 0x8217(%rip), %r9       # 0x1b300
leaq (%r9,%r8,4), %r8
movzbl (%rcx,%r8), %r8d
shrl $0x2, %r8d
movl 0x2b8(%rdi), %edi
btl %r8d, %edi
jb 0x13105
pushq $0x1
popq %rsi
movq (%rdx,%r12,4), %rdx
testq %rdx, %rdx
je 0x13148
movl 0x18(%rdx), %edi
cmpl $0x2, %edi
je 0x13148
cmpl $0x5, %edi
je 0x13145
cmpl $0x11, %edi
je 0x13145
decb %cl
andb $0x3, %cl
movzbl %cl, %ecx
leaq 0x81d1(%rip), %rdi      # 0x1b300
leaq (%rdi,%rax,4), %rax
movzbl (%rcx,%rax), %eax
shrl $0x2, %eax
movl 0x2b8(%rdx), %ecx
btl %eax, %ecx
jb 0x13148
orl $0x2, %esi
addl $0x49, %esi
movl 0x2b8(%r14), %eax
xorl %edx, %edx
btl %r13d, %eax
setb %dl
movq -0x30(%rbp), %rdi
callq 0x30bc
addq $0x4, %r15
incl %r13d
addq $0x20, %r12
jmp 0x1308e
leaq 0x8039(%rip), %rdi      # 0x1b1b4
leaq 0xe7e6(%rip), %rsi      # 0x21968
leaq 0xedc0(%rip), %rdx      # 0x21f49
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x39ba
movq 0x10(%r14), %rax
movq (%rax), %r13
movq 0x8(%rax), %r15
testq %r13, %r13
je 0x131c4
movl 0x18(%r13), %eax
cmpl $0x2, %eax
je 0x131c0
cmpl $0x5, %eax
je 0x131c4
cmpl $0x11, %eax
je 0x131c4
cmpl $0x0, 0x2b4(%r13)
je 0x131c4
pushq $0x1
popq %r12
testq %r15, %r15
je 0x131ea
movl 0x18(%r15), %eax
cmpl $0x2, %eax
je 0x131e6
cmpl $0x5, %eax
je 0x131ea
cmpl $0x11, %eax
je 0x131ea
cmpl $0x0, 0x2b4(%r15)
je 0x131ea
orl $0x2, %r12d
addl $0x4d, %r12d
xorl %edx, %edx
cmpl $0x0, 0x2b4(%r14)
setg %dl
movq -0x30(%rbp), %rdi
movl %r12d, %esi
callq 0x30bc
movl 0x2b4(%r14), %eax
testl %eax, %eax
jle 0x13273
pushq $0x4
popq %rsi
testq %r13, %r13
je 0x1323a
movl 0x18(%r13), %ecx
cmpl $0x2, %ecx
je 0x13237
cmpl $0x5, %ecx
je 0x1323a
cmpl $0x11, %ecx
je 0x1323a
cmpl $0x2, 0x2b4(%r13)
jne 0x1323a
pushq $0x5
popq %rsi
testq %r15, %r15
je 0x1325f
movl 0x18(%r15), %ecx
cmpl $0x2, %ecx
je 0x1325c
cmpl $0x5, %ecx
je 0x1325f
cmpl $0x11, %ecx
je 0x1325f
cmpl $0x2, 0x2b4(%r15)
jne 0x1325f
orl $0x2, %esi
addl $0x4d, %esi
xorl %edx, %edx
cmpl $0x1, %eax
setne %dl
movq -0x30(%rbp), %rdi
callq 0x30bc
cmpl $0x0, 0x2b8(%r14)
jg 0x13292
cmpl $0x0, 0x2b4(%r14)
jg 0x13292
cmpl $0x1, 0x18(%r14)
jne 0x1348c
leaq 0x7f1b(%rip), %rdi      # 0x1b1b4
leaq 0xe6c8(%rip), %rsi      # 0x21968
leaq 0xecbb(%rip), %rdx      # 0x21f62
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x39ba
movq 0x10dae0(%rbx), %rcx
movl 0x10db44(%rbx), %eax
addl 0x1034(%rcx), %eax
cmpl $0x0, (%r14)
jg 0x132d1
cmpl $0x0, 0x4(%r14)
jle 0x13330
cmpl $0x0, -0xf88(%r14)
jg 0x132e9
cmpl $0x0, -0xf84(%r14)
jle 0x134d2
movl -0xcd8(%r14), %eax
movl %eax, %ecx
subl -0x1c60(%r14), %ecx
movl -0xf70(%r14), %edx
cmpl $0x5, %edx
je 0x13330
cmpl $0x11, %edx
je 0x13330
cmpl $0x2, %edx
je 0x13330
testl %ecx, %ecx
je 0x13330
cmpl $0x1, %edx
je 0x1332c
cmpl $0x0, -0xcd0(%r14)
jne 0x1332c
cmpl $0x0, -0xcd4(%r14)
je 0x13330
pushq $0x1
popq %r13
movl 0x2b0(%r14), %ecx
subl %eax, %ecx
leal (%rcx,%rcx), %eax
negl %eax
testl %ecx, %ecx
leal -0x1(%rcx,%rcx), %ebx
cmovlel %eax, %ebx
movq -0x38(%rbp), %rax
leaq 0x10db60(%rax), %r15
pushq $0x3
popq %r12
leal 0x3c(%r13), %esi
testl %ebx, %ebx
jle 0x13378
movq %r15, %rdi
pushq $0x1
popq %rdx
callq 0x30bc
cmpl $0x2, %r13d
movl %r12d, %r13d
sbbl $0x0, %r13d
decl %ebx
jmp 0x13356
movq %r15, %rdi
xorl %edx, %edx
callq 0x30bc
cmpl $0x1, 0x18(%r14)
jne 0x133ec
leaq 0x2c4(%r14), %r8
pushq $0x10
popq %r9
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x1382a
cmpl $0x0, 0x2b8(%r14)
je 0x13439
leaq 0x32c(%r14), %r15
xorl %r12d, %r12d
pushq $0xf
popq %r13
cmpq $0x10, %r12
je 0x13439
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x1
popq %rdx
movl %r12d, %ecx
movq %r15, %r8
movl %r13d, %r9d
callq 0x1382a
incq %r12
addq $0x84, %r15
jmp 0x133c3
leaq 0x368(%r14), %r15
xorl %r12d, %r12d
pushq $0x10
popq %r13
movq -0x38(%rbp), %rbx
cmpq $0x10, %r12
je 0x13439
movl 0x2b8(%r14), %eax
movl %r12d, %ecx
shrl $0x2, %ecx
btl %ecx, %eax
jae 0x1342d
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x2
popq %rdx
movl %r12d, %ecx
movq %r15, %r8
movl %r13d, %r9d
callq 0x1382a
incq %r12
addq $0x84, %r15
jmp 0x133fe
movl 0x2b4(%r14), %eax
testb $0x3, %al
je 0x13488
leaq 0x304(%r14), %r8
pushq $0x3
popq %r15
pushq $0x4
popq %r12
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
xorl %ecx, %ecx
movl %r12d, %r9d
callq 0x1382a
leaq 0x314(%r14), %r8
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
movl %r12d, %r9d
callq 0x1382a
movl 0x2b4(%r14), %eax
testb $0x2, %al
jne 0x1349b
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb6c(%r14), %r15
xorl %r12d, %r12d
pushq $0xf
popq %r13
cmpq $0x8, %r12
je 0x1348c
movq %rbx, %rdi
movq %r14, %rsi
pushq $0x4
popq %rdx
movl %r12d, %ecx
movq %r15, %r8
movl %r13d, %r9d
callq 0x1382a
incq %r12
addq $0x84, %r15
jmp 0x134a9
movl -0xcd8(%r14), %edx
movl %edx, %ecx
subl %eax, %ecx
movl %edx, %eax
jmp 0x132f9
leaq 0x10db60(%rbx), %r12
pushq $0xe
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x30bc
pushq $0xf
popq %rsi
pushq $0x1
popq %r13
movq %r12, %rdi
movl %r13d, %edx
callq 0x30bc
pushq $0x11
popq %rsi
movq %r12, %rdi
movl %r13d, %edx
jmp 0x12bd1
movq 0x14ab1(%rip), %rax     # 0x27fd0
movq (%rax), %rcx
leaq 0xe7d4(%rip), %rdi      # 0x21cfd
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x21e0
jmp 0x13050