// File: /workspace/github_c_makefile_star2_O0/akumrao[P]videoAnalyzer/decoder/decoder.c
// Function: x264_decoder_decode(x264_t*, x264_picture_t**, x264_nal_t*)
int x264_decoder_decode(x264_t *h,
        x264_picture_t **pp_pic, x264_nal_t *nal) {LOG_CALL;
    int i_ret = 0;
    bs_t bs;

    /* no picture */
    *pp_pic = NULL;

    /* init bitstream reader */
    bs_init(&bs, nal->p_payload, nal->i_payload);

    switch (nal->i_type)
    {
        case NAL_SPS:
            if ((i_ret = x264_sps_read(&bs, h->sps_array)) < 0)
            {
                fprintf(stderr, "x264: x264_sps_read failed\n");
            }
            break;

        case NAL_PPS:
            if ((i_ret = x264_pps_read(&bs, h->pps_array)) < 0)
            {
                fprintf(stderr, "x264: x264_pps_read failed\n");
            }
            break;

        case NAL_SLICE_IDR:
            fprintf(stderr, "x264: NAL_SLICE_IDR\n");
            x264_slice_idr(h);

        case NAL_SLICE:
            if ((i_ret = x264_slice_header_decode(h, &bs, nal)) < 0)
            {
                fprintf(stderr, "x264: x264_slice_header_decode failed\n");
            }
            if (h->sh.i_redundant_pic_cnt == 0 && i_ret == 0)
            {
                if ((i_ret = x264_slice_data_decode(h, &bs)) < 0)
                {
                    fprintf(stderr, "x264: x264_slice_data_decode failed\n");
                } else
                {
                    *pp_pic = h->picture;
                }
            }
            break;

        case NAL_SLICE_DPA:
        case NAL_SLICE_DPB:
        case NAL_SLICE_DPC:
            fprintf(stderr, "partitioned stream unsupported\n");
            i_ret = -1;
            break;

        case NAL_SEI:
        default:
            break;
    }

    /* restore CPU state (before using float again) */
    x264_cpu_restore(h->cpu);

    return i_ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq 0x19ef5(%rip), %rdi     # 0x28eb0
leaq 0x1c2f6(%rip), %rsi     # 0x2b2b8
leaq 0x1c323(%rip), %rdx     # 0x2b2ec
xorl %eax, %eax
callq 0x4d20
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movl 0x8(%rax), %edx
leaq -0x40(%rbp), %rdi
callq 0xf180
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x7, %eax
ja 0xf161
movq -0x48(%rbp), %rax
leaq 0x1ac37(%rip), %rcx     # 0x29c50
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rsi
addq $0xd8, %rsi
leaq -0x40(%rbp), %rdi
callq 0x14010
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xf056
movq 0x26f8b(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c2b1(%rip), %rsi     # 0x2b300
movb $0x0, %al
callq 0x2160
jmp 0xf163
movq -0x8(%rbp), %rsi
addq $0x8ee0, %rsi           # imm = 0x8EE0
leaq -0x40(%rbp), %rdi
callq 0x14940
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xf08f
movq 0x26f52(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c294(%rip), %rsi     # 0x2b31c
movb $0x0, %al
callq 0x2160
jmp 0xf163
movq 0x26f35(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c293(%rip), %rsi     # 0x2b338
movb $0x0, %al
callq 0x2160
movq -0x8(%rbp), %rdi
callq 0xf1f0
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x40(%rbp), %rsi
callq 0xf2e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xf0e6
movq 0x26efb(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c26e(%rip), %rsi     # 0x2b34d
movb $0x0, %al
callq 0x2160
movq -0x8(%rbp), %rax
cmpl $0x0, 0x10db2c(%rax)
jne 0xf13c
cmpl $0x0, -0x1c(%rbp)
jne 0xf13c
movq -0x8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xf9c0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
jge 0xf128
movq 0x26ebb(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c255(%rip), %rsi     # 0x2b374
movb $0x0, %al
callq 0x2160
jmp 0xf13a
movq -0x8(%rbp), %rax
movq 0x10ee48(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0xf13c
jmp 0xf163
movq 0x26e8b(%rip), %rax     # 0x35fd0
movq (%rax), %rdi
leaq 0x1c24a(%rip), %rsi     # 0x2b399
movb $0x0, %al
callq 0x2160
movl $0xffffffff, -0x1c(%rbp) # imm = 0xFFFFFFFF
jmp 0xf163
jmp 0xf161
jmp 0xf163
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x4420
movl -0x1c(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)