// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/macroblock.c
// Function: x264_macroblock_read_cavlc(x264_t*, bs_s*, x264_macroblock_t*)
int x264_macroblock_read_cavlc(x264_t *h, bs_t *s, x264_macroblock_t *mb) {LOG_CALL;
    int i_mb_i_offset;
    int i_mb_p_offset;
    int b_sub_ref0 = 0;
    int i_type;
    int i;

    /* read the mb type */
    switch (h->sh.i_type) // slice type
    {
        case SLICE_TYPE_I:
            i_mb_p_offset = 0; /* shut up gcc */
            i_mb_i_offset = 0;
            break;
        case SLICE_TYPE_P:
            i_mb_p_offset = 0;
            i_mb_i_offset = 5;
            break;
        case SLICE_TYPE_B:
            i_mb_p_offset = 23;
            i_mb_i_offset = 23 + 5;
            break;
        default:
            fprintf(stderr, "internal error or slice unsupported\n");
            return -1;
    }

    i_type = bs_read_ue(s,"i_type");

    if (i_type < i_mb_i_offset)
    {
        if (i_type < i_mb_p_offset)
        {
            fprintf(stderr, "unsupported mb type(B*)\n");
            /* TODO for B frame */
            return -1;
        } else
        {
            i_type -= i_mb_p_offset;

            if (i_type == 0)
            {
                mb->i_type = P_L0;
                mb->i_partition = D_16x16;
            } else if (i_type == 1)
            {
                mb->i_type = P_L0;
                mb->i_partition = D_16x8;
            } else if (i_type == 2)
            {
                mb->i_type = P_L0;
                mb->i_partition = D_8x16;
            } else if (i_type == 3 || i_type == 4)
            {
                mb->i_type = P_8x8;
                mb->i_partition = D_8x8;
                b_sub_ref0 = i_type == 4 ? 1 : 0;
            } else
            {
                fprintf(stderr, "invalid mb type\n");
                return -1;
            }
        }
    } else
    {
        i_type -= i_mb_i_offset;

        if (i_type == 0)
        {
            mb->i_type = I_4x4;
        } else if (i_type < 25)
        {
            mb->i_type = I_16x16;

            mb->i_intra16x16_pred_mode = (i_type - 1) % 4;
            mb->i_cbp_chroma = ((i_type - 1) / 4) % 3;
            mb->i_cbp_luma = ((i_type - 1) / 12) ? 0x0f : 0x00;
        } else if (i_type == 25)
        {
            mb->i_type = I_PCM;
        } else
        {
            fprintf(stderr, "invalid mb type (%d)\n", i_type);
            return -1;
        }
    }

    if (mb->i_type == I_PCM)
    {
        return x264_macroblock_decode_ipcm(h, s, mb);
    }

    if (IS_INTRA(mb->i_type))
    {
        if (mb->i_type == I_4x4)
        {
            for (i = 0; i < 16; i++)
            {
                int b_coded;
                
                /*
                  MB type : I/intra coded, P/inter coded from one reference frame, B/inter coded from one or
                    two reference frames.
                    Prediction information : prediction mode(s) for an I macroblock, choice of reference frame(s)
and motion vectors for a P or B macroblock.
 Coded Block Pattern CBP : indicates which luma and chroma blocks contain non-zero
residual coefficients.
 Quantization Parameter QP, for macroblocks with CBP = 0.
 Residual data, for blocks containing non-zero residual coefficients.
                 
                 */

                b_coded = bs_read1(s,"b_coded");

                if (b_coded)
                {
                    mb->block[i].i_intra4x4_pred_mode = x264_mb_predict_intra4x4_mode(h, mb, i);
                } else
                {
                    int i_predicted_mode = x264_mb_predict_intra4x4_mode(h, mb, i);
                    int i_mode = bs_read(s, 3,"i_mode");

                    if (i_mode >= i_predicted_mode)
                    {
                        mb->block[i].i_intra4x4_pred_mode = i_mode + 1;
                    } else
                    {
                        mb->block[i].i_intra4x4_pred_mode = i_mode;
                    }
                }
            }
        }

        mb->i_chroma_pred_mode = bs_read_ue(s,"i_chroma_pred_mode");
    } else if (mb->i_type == P_8x8 || mb->i_type == B_8x8)
    {
        /* FIXME won't work for B_8x8 */

        for (i = 0; i < 4; i++)
        {
            int i_sub_partition;

            i_sub_partition = bs_read_ue(s,"i_sub_partition");
            switch (i_sub_partition)
            {
                case 0:
                    mb->i_sub_partition[i] = D_L0_8x8;
                    break;
                case 1:
                    mb->i_sub_partition[i] = D_L0_8x4;
                    break;
                case 2:
                    mb->i_sub_partition[i] = D_L0_4x8;
                    break;
                case 3:
                    mb->i_sub_partition[i] = D_L0_4x4;
                    break;
                default:
                    fprintf(stderr, "invalid i_sub_partition\n");
                    return -1;
            }
        }
        for (i = 0; i < 4; i++)
        {
            int i_ref;

            i_ref = b_sub_ref0 ? 0 : bs_read_te(s, h->sh.i_num_ref_idx_l0_active - 1,"i_ref");
            x264_mb_partition_ref_set(mb, 0, i, i_ref);
        }
        for (i = 0; i < 4; i++)
        {
            int i_sub;
            int i_ref;

            x264_mb_partition_get(mb, 0, i, 0, &i_ref, NULL, NULL);

            for (i_sub = 0; i_sub < x264_mb_partition_count_table[mb->i_sub_partition[i]]; i_sub++)
            {
                int mv[2];

                x264_mb_predict_mv(mb, 0, i, i_sub, mv);
                mv[0] += bs_read_se(s,"mv[0]");
                mv[1] += bs_read_se(s,"mv[1]");

                x264_mb_partition_mv_set(mb, 0, i, i_sub, mv);
            }
        }
    } else if (mb->i_type != B_DIRECT)
    {
        /* FIXME will work only for P block */

        /* FIXME using x264_mb_partition_set/x264_mb_partition_get here are too unoptimised
         * I should introduce ref and mv get/set */

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

        for (i = 0; i < i_part; i++)
        {
            int i_ref;

            i_ref = bs_read_te(s, h->sh.i_num_ref_idx_l0_active - 1,"i_ref");

            x264_mb_partition_ref_set(mb, 0, i, i_ref);
        }

        for (i = 0; i < i_part; i++)
        {
            int mv[2];

            x264_mb_predict_mv(mb, 0, i, 0, mv);

            mv[0] += bs_read_se(s,"mv[0]");
            mv[1] += bs_read_se(s,"mv[1]");

            x264_mb_partition_mv_set(mb, 0, i, 0, mv);
        }
    }

    if (mb->i_type != I_16x16)
    {
        int i_cbp;
//In MPEG-2, the buffer is called VBV buffer (Video Buffer Verifier Buffer).
//In H.264, the buffer is called CPB (Coded Picture Buffer).
//The water level of the tank at certain time instance is called buffer fullness and 
//described in number of bits. The size of the tank is called VBV buffer size in MPEG-2 
//and CPB buffer size in H.264.
        i_cbp = bs_read_ue(s,"i_cbp");
        if (i_cbp >= 48)
        {
            fprintf(stderr, "invalid cbp\n");
            return -1;
        }

        if (mb->i_type == I_4x4)
        {
            i_cbp = golomb_to_intra4x4_cbp[i_cbp];
        } else
        {
            i_cbp = golomb_to_inter_cbp[i_cbp];
        }
        mb->i_cbp_luma = i_cbp & 0x0f;
        mb->i_cbp_chroma = i_cbp >> 4;
    }

    if (mb->i_cbp_luma > 0 || mb->i_cbp_chroma > 0 || mb->i_type == I_16x16)
    {
        mb->i_qp = bs_read_se(s,"i_qp") + h->pps->i_pic_init_qp + h->sh.i_qp_delta;

        /* write residual */
        if (mb->i_type == I_16x16)
        {
            /* DC Luma */
            if (block_residual_read_cavlc(h, s, mb, BLOCK_INDEX_LUMA_DC, mb->luma16x16_dc, 16) < 0)
            {
                return -1;
            }

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

        if (mb->i_cbp_chroma & 0x03) /* Chroma DC residual present */
        {
            if (block_residual_read_cavlc(h, s, mb, BLOCK_INDEX_CHROMA_DC, mb->chroma_dc[0], 4) < 0 ||
                    block_residual_read_cavlc(h, s, mb, BLOCK_INDEX_CHROMA_DC, mb->chroma_dc[1], 4) < 0)
            {
                return -1;
            }
        } else
        {
            array_zero_set(mb->chroma_dc[0], 4);
            array_zero_set(mb->chroma_dc[1], 4);
        }
        if (mb->i_cbp_chroma & 0x02) /* Chroma AC residual present */
        {
            for (i = 0; i < 8; i++)
            {
                if (block_residual_read_cavlc(h, s, mb, 16 + i, mb->block[16 + i].residual_ac, 15) < 0)
                {
                    return -1;
                }
            }
        } else
        {
            for (i = 0; i < 8; i++)
            {
                mb->block[16 + i].i_non_zero_count = 0;
                array_zero_set(mb->block[16 + i].residual_ac, 15);
            }
        }
    } else
    {
        mb->i_qp = h->pps->i_pic_init_qp + h->sh.i_qp_delta;
        for (i = 0; i < 16; i++)
        {
            mb->block[i].i_non_zero_count = 0;
            array_zero_set(mb->block[i].luma4x4, 16);
        }
        array_zero_set(mb->chroma_dc[0], 4);
        array_zero_set(mb->chroma_dc[1], 4);
        for (i = 0; i < 8; i++)
        {
            array_zero_set(mb->block[16 + i].residual_ac, 15);
            mb->block[16 + i].i_non_zero_count = 0;
        }
    }

    //fprintf( stderr, "mb read type=%d\n", mb->i_type );

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
leaq 0x17972(%rip), %rdi     # 0x28eb0
leaq 0x1a68b(%rip), %rsi     # 0x2bbd0
leaq 0x1a6e7(%rip), %rdx     # 0x2bc33
xorl %eax, %eax
callq 0x4d20
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movl 0x10db00(%rax), %eax
movl %eax, -0x70(%rbp)
testl %eax, %eax
je 0x11591
jmp 0x1156d
movl -0x70(%rbp), %eax
subl $0x1, %eax
je 0x115a1
jmp 0x11577
movl -0x70(%rbp), %eax
subl $0x2, %eax
jne 0x115b1
jmp 0x11581
movl $0x0, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
jmp 0x115d5
movl $0x0, -0x28(%rbp)
movl $0x5, -0x24(%rbp)
jmp 0x115d5
movl $0x17, -0x28(%rbp)
movl $0x1c, -0x24(%rbp)
jmp 0x115d5
movq 0x24a18(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1a68c(%rip), %rsi     # 0x2bc4e
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
movq -0x18(%rbp), %rdi
leaq 0x19ec4(%rip), %rsi     # 0x2b4a4
callq 0x121b0
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x116f0
movl -0x30(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x11620
movq 0x249cd(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1a666(%rip), %rsi     # 0x2bc73
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
movl -0x28(%rbp), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x1164c
movq -0x20(%rbp), %rax
movl $0x3, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0x10, 0x1c(%rax)
jmp 0x116e9
cmpl $0x1, -0x30(%rbp)
jne 0x1166a
movq -0x20(%rbp), %rax
movl $0x3, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0xe, 0x1c(%rax)
jmp 0x116e7
cmpl $0x2, -0x30(%rbp)
jne 0x11688
movq -0x20(%rbp), %rax
movl $0x3, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0xf, 0x1c(%rax)
jmp 0x116e5
cmpl $0x3, -0x30(%rbp)
je 0x11694
cmpl $0x4, -0x30(%rbp)
jne 0x116bf
movq -0x20(%rbp), %rax
movl $0x4, 0x18(%rax)
movq -0x20(%rbp), %rax
movl $0xd, 0x1c(%rax)
movl -0x30(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x4, %edx
cmovel %ecx, %eax
movl %eax, -0x2c(%rbp)
jmp 0x116e3
movq 0x2490a(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1a5bc(%rip), %rsi     # 0x2bc8c
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x116e5
jmp 0x116e7
jmp 0x116e9
jmp 0x116eb
jmp 0x117c3
movl -0x24(%rbp), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x11711
movq -0x20(%rbp), %rax
movl $0x0, 0x18(%rax)
jmp 0x117c1
cmpl $0x19, -0x30(%rbp)
jge 0x11783
movq -0x20(%rbp), %rax
movl $0x1, 0x18(%rax)
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x20(%rbp), %rax
movl %edx, 0x2bc(%rax)
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl $0x3, %ecx
cltd
idivl %ecx
movq -0x20(%rbp), %rax
movl %edx, 0x2b4(%rax)
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl $0xc, %ecx
cltd
idivl %ecx
movl %eax, %edx
xorl %ecx, %ecx
movl $0xf, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b8(%rax)
jmp 0x117bf
cmpl $0x19, -0x30(%rbp)
jne 0x11796
movq -0x20(%rbp), %rax
movl $0x2, 0x18(%rax)
jmp 0x117bd
movq 0x24833(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
movl -0x30(%rbp), %edx
leaq 0x1a4f3(%rip), %rsi     # 0x2bc9d
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x117bf
jmp 0x117c1
jmp 0x117c3
movq -0x20(%rbp), %rax
cmpl $0x2, 0x18(%rax)
jne 0x117e6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x12260
movl %eax, -0x4(%rbp)
jmp 0x12197
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x117fe
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x1190b
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x118ea
movl $0x0, -0x34(%rbp)
cmpl $0x10, -0x34(%rbp)
jge 0x118e8
movq -0x18(%rbp), %rdi
leaq 0x1a48b(%rip), %rsi     # 0x2bcb3
callq 0x122a0
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x11864
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x34(%rbp), %edx
callq 0x7400
movl %eax, %ecx
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rdx
imulq $0x84, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0x118d8
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x34(%rbp), %edx
callq 0x7400
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rdi
movl $0x3, %esi
leaq 0x1a434(%rip), %rdx     # 0x2bcbb
callq 0x12350
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jl 0x118b9
movl -0x40(%rbp), %ecx
addl $0x1, %ecx
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rdx
imulq $0x84, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0x118d6
movl -0x40(%rbp), %ecx
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rdx
imulq $0x84, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0x118d8
jmp 0x118da
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11813
jmp 0x118ea
movq -0x18(%rbp), %rdi
leaq 0x1a3cd(%rip), %rsi     # 0x2bcc2
callq 0x121b0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2c0(%rax)
jmp 0x11bed
movq -0x20(%rbp), %rax
cmpl $0x4, 0x18(%rax)
je 0x11923
movq -0x20(%rbp), %rax
cmpl $0x10, 0x18(%rax)
jne 0x11b0b
movl $0x0, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0x119e4
movq -0x18(%rbp), %rdi
leaq 0x1a396(%rip), %rsi     # 0x2bcd5
callq 0x121b0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq %rax, -0x78(%rbp)
subq $0x3, %rax
ja 0x119b0
movq -0x78(%rbp), %rax
leaq 0x19e91(%rip), %rcx     # 0x2b7f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x3, 0x20(%rax,%rcx,4)
jmp 0x119d4
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x1, 0x20(%rax,%rcx,4)
jmp 0x119d4
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x2, 0x20(%rax,%rcx,4)
jmp 0x119d4
movq -0x20(%rbp), %rax
movslq -0x34(%rbp), %rcx
movl $0x0, 0x20(%rax,%rcx,4)
jmp 0x119d4
movq 0x24619(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1a324(%rip), %rsi     # 0x2bce5
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x119d6
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1192a
movl $0x0, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0x11a40
cmpl $0x0, -0x2c(%rbp)
je 0x119fe
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0x11a1e
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10db38(%rax), %esi
subl $0x1, %esi
leaq 0x1a2e8(%rip), %rdx     # 0x2bcfe
callq 0x124a0
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x48(%rbp), %ecx
xorl %esi, %esi
callq 0x10f90
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x119eb
movl $0x0, -0x34(%rbp)
cmpl $0x4, -0x34(%rbp)
jge 0x11b06
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
xorl %ecx, %ecx
leaq -0x50(%rbp), %r8
xorl %eax, %eax
movl %eax, %r9d
movl %ecx, %esi
movq $0x0, (%rsp)
callq 0x7ef0
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
movslq -0x34(%rbp), %rdx
movslq 0x20(%rcx,%rdx,4), %rdx
leaq 0x19d70(%rip), %rcx     # 0x2b800
cmpl (%rcx,%rdx,4), %eax
jge 0x11af6
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x4c(%rbp), %ecx
leaq -0x58(%rbp), %r8
xorl %esi, %esi
callq 0x7ff0
movq -0x18(%rbp), %rdi
leaq 0x1a24f(%rip), %rsi     # 0x2bd04
callq 0x12520
addl -0x58(%rbp), %eax
movl %eax, -0x58(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1a23f(%rip), %rsi     # 0x2bd0a
callq 0x12520
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x4c(%rbp), %ecx
leaq -0x58(%rbp), %r8
xorl %esi, %esi
callq 0x11240
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x11a79
jmp 0x11af8
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11a47
jmp 0x11beb
movq -0x20(%rbp), %rax
cmpl $0x6, 0x18(%rax)
je 0x11be9
movq -0x20(%rbp), %rax
movslq 0x1c(%rax), %rcx
leaq 0x19cd8(%rip), %rax     # 0x2b800
movl (%rax,%rcx,4), %eax
movl %eax, -0x5c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x11b79
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x10db38(%rax), %esi
subl $0x1, %esi
leaq 0x1a1a9(%rip), %rdx     # 0x2bcfe
callq 0x124a0
movl %eax, -0x60(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
movl -0x60(%rbp), %ecx
xorl %esi, %esi
callq 0x10f90
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11b35
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x5c(%rbp), %eax
jge 0x11be7
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq -0x68(%rbp), %r8
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x7ff0
movq -0x18(%rbp), %rdi
leaq 0x1a15d(%rip), %rsi     # 0x2bd04
callq 0x12520
addl -0x68(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x1a14d(%rip), %rsi     # 0x2bd0a
callq 0x12520
addl -0x64(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x20(%rbp), %rdi
movl -0x34(%rbp), %edx
leaq -0x68(%rbp), %r8
xorl %ecx, %ecx
movl %ecx, %esi
callq 0x11240
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11b80
jmp 0x11be9
jmp 0x11beb
jmp 0x11bed
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
je 0x11c86
movq -0x18(%rbp), %rdi
leaq 0x1a10a(%rip), %rsi     # 0x2bd10
callq 0x121b0
movl %eax, -0x6c(%rbp)
cmpl $0x30, -0x6c(%rbp)
jl 0x11c38
movq 0x243b5(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1a0f1(%rip), %rsi     # 0x2bd16
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
movq -0x20(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x11c55
movslq -0x6c(%rbp), %rcx
leaq 0x19c03(%rip), %rax     # 0x2b850
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
jmp 0x11c66
movslq -0x6c(%rbp), %rcx
leaq 0x19cb0(%rip), %rax     # 0x2b910
movl (%rax,%rcx,4), %eax
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %ecx
andl $0xf, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b8(%rax)
movl -0x6c(%rbp), %ecx
sarl $0x4, %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b4(%rax)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b8(%rax)
jg 0x11cae
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b4(%rax)
jg 0x11cae
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x12076
movq -0x18(%rbp), %rdi
leaq 0x1a06a(%rip), %rsi     # 0x2bd23
callq 0x12520
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x10dae0(%rax), %rax
addl 0x1034(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x10db44(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b0(%rax)
movq -0x20(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x11e01
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %r8
addq $0x2c4, %r8             # imm = 0x2C4
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
movl $0x10, %r9d
callq 0x125a0
cmpl $0x0, %eax
jge 0x11d2b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
movq -0x20(%rbp), %rax
cmpl $0x0, 0x2b8(%rax)
je 0x11d9c
movl $0x0, -0x34(%rbp)
cmpl $0x10, -0x34(%rbp)
jge 0x11d9a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %r8
addq $0x324, %r8             # imm = 0x324
movslq -0x34(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %r8
addq $0x8, %r8
movl $0xf, %r9d
callq 0x125a0
cmpl $0x0, %eax
jge 0x11d8d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x11d8f
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11d3f
jmp 0x11dfc
movl $0x0, -0x34(%rbp)
cmpl $0x10, -0x34(%rbp)
jge 0x11dfa
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movslq -0x34(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movl $0xf, %esi
callq 0x12c30
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11da3
jmp 0x11dfc
jmp 0x11ee1
movl $0x0, -0x34(%rbp)
cmpl $0x10, -0x34(%rbp)
jge 0x11edf
movq -0x20(%rbp), %rax
movl 0x2b8(%rax), %eax
movl %eax, -0x80(%rbp)
movl -0x34(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x80(%rbp), %eax
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x11e89
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x34(%rbp), %ecx
movq -0x20(%rbp), %r8
addq $0x324, %r8             # imm = 0x324
movslq -0x34(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %r8
addq $0x44, %r8
movl $0x10, %r9d
callq 0x125a0
cmpl $0x0, %eax
jge 0x11e87
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x11ecf
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movslq -0x34(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x44, %rdi
movl $0x10, %esi
callq 0x12c30
jmp 0x11ed1
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11e08
jmp 0x11ee1
movq -0x20(%rbp), %rax
movl 0x2b4(%rax), %eax
andl $0x3, %eax
cmpl $0x0, %eax
je 0x11f5d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %r8
addq $0x304, %r8             # imm = 0x304
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x4, %r9d
callq 0x125a0
cmpl $0x0, %eax
jl 0x11f4f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x20(%rbp), %r8
addq $0x304, %r8             # imm = 0x304
addq $0x10, %r8
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl $0x4, %r9d
callq 0x125a0
cmpl $0x0, %eax
jge 0x11f5b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x11f8b
movq -0x20(%rbp), %rdi
addq $0x304, %rdi            # imm = 0x304
movl $0x4, %esi
callq 0x12c30
movq -0x20(%rbp), %rdi
addq $0x304, %rdi            # imm = 0x304
addq $0x10, %rdi
movl $0x4, %esi
callq 0x12c30
movq -0x20(%rbp), %rax
movl 0x2b4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x12008
movl $0x0, -0x34(%rbp)
cmpl $0x8, -0x34(%rbp)
jge 0x12006
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x34(%rbp), %ecx
addl $0x10, %ecx
movq -0x20(%rbp), %r8
addq $0x324, %r8             # imm = 0x324
movl -0x34(%rbp), %eax
addl $0x10, %eax
cltq
imulq $0x84, %rax, %rax
addq %rax, %r8
addq $0x8, %r8
movl $0xf, %r9d
callq 0x125a0
cmpl $0x0, %eax
jge 0x11ff9
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x12197
jmp 0x11ffb
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x11fa4
jmp 0x12071
movl $0x0, -0x34(%rbp)
cmpl $0x8, -0x34(%rbp)
jge 0x1206f
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movl -0x34(%rbp), %ecx
addl $0x10, %ecx
movslq %ecx, %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movl -0x34(%rbp), %eax
addl $0x10, %eax
cltq
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movl $0xf, %esi
callq 0x12c30
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1200f
jmp 0x12071
jmp 0x12190
movq -0x10(%rbp), %rax
movq 0x10dae0(%rax), %rax
movl 0x1034(%rax), %ecx
movq -0x10(%rbp), %rax
addl 0x10db44(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x2b0(%rax)
movl $0x0, -0x34(%rbp)
cmpl $0x10, -0x34(%rbp)
jge 0x120f9
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movslq -0x34(%rbp), %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movq -0x20(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movslq -0x34(%rbp), %rax
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x44, %rdi
movl $0x10, %esi
callq 0x12c30
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x120a2
movq -0x20(%rbp), %rdi
addq $0x304, %rdi            # imm = 0x304
movl $0x4, %esi
callq 0x12c30
movq -0x20(%rbp), %rdi
addq $0x304, %rdi            # imm = 0x304
addq $0x10, %rdi
movl $0x4, %esi
callq 0x12c30
movl $0x0, -0x34(%rbp)
cmpl $0x8, -0x34(%rbp)
jge 0x1218e
movq -0x20(%rbp), %rdi
addq $0x324, %rdi            # imm = 0x324
movl -0x34(%rbp), %eax
addl $0x10, %eax
cltq
imulq $0x84, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movl $0xf, %esi
callq 0x12c30
movq -0x20(%rbp), %rax
addq $0x324, %rax            # imm = 0x324
movl -0x34(%rbp), %ecx
addl $0x10, %ecx
movslq %ecx, %rcx
imulq $0x84, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x4(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x1212e
jmp 0x12190
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)