// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/decoder.c
// Function: x264_slice_header_part1_read(bs_s*, x264_slice_header_t*, x264_sps_t*, x264_pps_t*, int)
static int x264_slice_header_part1_read(bs_t *s,
        x264_slice_header_t *sh, x264_sps_t sps_array[32], x264_pps_t pps_array[256], int b_idr) {LOG_CALL;
    sh->i_first_mb = bs_read_ue(s, "i_first_mb");
    sh->i_type = bs_read_ue(s,"i_type");
    if (sh->i_type >= 5)
    {
        sh->i_type -= 5;
    }
    sh->i_pps_id = bs_read_ue(s,"i_pps_id");
    if (bs_eof(s) || sh->i_pps_id >= 256 || pps_array[sh->i_pps_id].i_id == -1)
    {
        fprintf(stderr, "invalid pps_id in slice header\n");
        return -1;
    }

    sh->pps = &pps_array[sh->i_pps_id];
    sh->sps = &sps_array[sh->pps->i_sps_id]; /* valid if pps valid */

    sh->i_frame_num = bs_read(s, sh->sps->i_log2_max_frame_num,"i_log2_max_frame_num");
    if (!sh->sps->b_frame_mbs_only)
    {
        sh->b_field_pic = bs_read1(s,"b_field_pic");
        if (sh->b_field_pic)
        {
            sh->b_bottom_field = bs_read1(s,"b_bottom_field");
        }
    }

    if (b_idr)
    {
        sh->i_idr_pic_id = bs_read_ue(s,"i_idr_pic_id");
    } else
    {
        sh->i_idr_pic_id = 0;
    }

    if (sh->sps->i_poc_type == 0)
    {
        sh->i_poc_lsb = bs_read(s, sh->sps->i_log2_max_poc_lsb,"i_log2_max_poc_lsb");
        if (sh->pps->b_pic_order && !sh->b_field_pic)
        {
            sh->i_delta_poc_bottom = bs_read_se(s,"i_delta_poc_bottom");
        }
    } else if (sh->sps->i_poc_type == 1 && !sh->sps->b_delta_pic_order_always_zero)
    {
        sh->i_delta_poc[0] = bs_read_se(s,"i_delta_poc[0]");
        if (sh->pps->b_pic_order && !sh->b_field_pic)
        {
            sh->i_delta_poc[1] = bs_read_se(s,"i_delta_poc[0]");
        }
    }

    if (sh->pps->b_redundant_pic_cnt)
    {
        sh->i_redundant_pic_cnt = bs_read_ue(s,"i_redundant_pic_cnt");
    }

    if (sh->i_type == SLICE_TYPE_B)
    {
        sh->b_direct_spatial_mv_pred = bs_read1(s,"b_direct_spatial_mv_pred");
    }

    if (sh->i_type == SLICE_TYPE_P || sh->i_type == SLICE_TYPE_SP || sh->i_type == SLICE_TYPE_B)
    {
        sh->b_num_ref_idx_override = bs_read1(s,"b_num_ref_idx_override");

        sh->i_num_ref_idx_l0_active = sh->pps->i_num_ref_idx_l0_active; /* default */
        sh->i_num_ref_idx_l1_active = sh->pps->i_num_ref_idx_l1_active; /* default */

        if (sh->b_num_ref_idx_override)
        {
            sh->i_num_ref_idx_l0_active = bs_read_ue(s,"i_num_ref_idx_l0_active") + 1;
            if (sh->i_type == SLICE_TYPE_B)
            {
                sh->i_num_ref_idx_l1_active = bs_read_ue(s,"i_num_ref_idx_l1_active") + 1;
            }
        }
    }

    return bs_eof(s) ? -1 : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
leaq 0x18f0d(%rip), %rdi     # 0x28eb0
leaq 0x1b30e(%rip), %rsi     # 0x2b2b8
leaq 0x1b4cb(%rip), %rdx     # 0x2b47c
movb $0x0, %al
callq 0x4d20
movq -0x10(%rbp), %rdi
leaq 0x1b4d6(%rip), %rsi     # 0x2b499
callq 0x109f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rdi
leaq 0x1b4c8(%rip), %rsi     # 0x2b4a4
callq 0x109f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpl $0x5, 0x10(%rax)
jl 0x10001
movq -0x18(%rbp), %rax
movl 0x10(%rax), %ecx
subl $0x5, %ecx
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rdi
leaq 0x1b49f(%rip), %rsi     # 0x2b4ab
callq 0x109f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rdi
callq 0x10aa0
cmpl $0x0, %eax
jne 0x10050
movq -0x18(%rbp), %rax
cmpl $0x100, 0x18(%rax)      # imm = 0x100
jge 0x10050
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq 0x18(%rcx), %rcx
imulq $0x104c, %rcx, %rcx     # imm = 0x104C
addq %rcx, %rax
cmpl $-0x1, (%rax)
jne 0x10074
movq 0x25f79(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1b453(%rip), %rsi     # 0x2b4b4
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x10338
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movslq 0x18(%rax), %rax
imulq $0x104c, %rax, %rax     # imm = 0x104C
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movslq 0x4(%rax), %rax
imulq $0x470, %rax, %rax      # imm = 0x470
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x18(%rax), %esi
leaq 0x1b40c(%rip), %rdx     # 0x2b4d4
callq 0x10af0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x1c(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x444(%rax)
jne 0x10124
movq -0x10(%rbp), %rdi
leaq 0x1b3f8(%rip), %rsi     # 0x2b4e9
callq 0x10c40
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x10122
movq -0x10(%rbp), %rdi
leaq 0x1b3e1(%rip), %rsi     # 0x2b4f5
callq 0x10c40
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0x10124
cmpl $0x0, -0x2c(%rbp)
je 0x10145
movq -0x10(%rbp), %rdi
leaq 0x1b3cf(%rip), %rsi     # 0x2b504
callq 0x109f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x28(%rax)
jmp 0x10150
movq -0x18(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x101b3
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x20(%rax), %esi
leaq 0x1b39f(%rip), %rdx     # 0x2b511
callq 0x10af0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0xc(%rax)
je 0x101b1
movq -0x18(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x101b1
movq -0x10(%rbp), %rdi
leaq 0x1b381(%rip), %rsi     # 0x2b524
callq 0x10cf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
jmp 0x1021b
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x1, 0x1c(%rax)
jne 0x10219
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0x24(%rax)
jne 0x10219
movq -0x10(%rbp), %rdi
leaq 0x1b35f(%rip), %rsi     # 0x2b537
callq 0x10cf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0xc(%rax)
je 0x10217
movq -0x18(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x10217
movq -0x10(%rbp), %rdi
leaq 0x1b32e(%rip), %rsi     # 0x2b537
callq 0x10cf0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x38(%rax)
jmp 0x10219
jmp 0x1021b
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x1048(%rax)
je 0x10245
movq -0x10(%rbp), %rdi
leaq 0x1b30f(%rip), %rsi     # 0x2b546
callq 0x109f0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x10268
movq -0x10(%rbp), %rdi
leaq 0x1b300(%rip), %rsi     # 0x2b55a
callq 0x10c40
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x40(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1028a
movq -0x18(%rbp), %rax
cmpl $0x3, 0x10(%rax)
je 0x1028a
movq -0x18(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x1031d
movq -0x10(%rbp), %rdi
leaq 0x1b2de(%rip), %rsi     # 0x2b573
callq 0x10c40
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x44(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1024(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x1028(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4c(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x44(%rax)
je 0x1031b
movq -0x10(%rbp), %rdi
leaq 0x1b2a8(%rip), %rsi     # 0x2b58a
callq 0x109f0
movl %eax, %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x48(%rax)
movq -0x18(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jne 0x10319
movq -0x10(%rbp), %rdi
leaq 0x1b29a(%rip), %rsi     # 0x2b5a2
callq 0x109f0
movl %eax, %ecx
addl $0x1, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4c(%rax)
jmp 0x1031b
jmp 0x1031d
movq -0x10(%rbp), %rdi
callq 0x10aa0
movl %eax, %edx
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)