// File: /workspace/github_c_makefile_star2_O1/akumrao[P]videoAnalyzer/encoder/encoder.c
// Function: x264_encoder_close(x264_t*)
void x264_encoder_close(x264_t *h) {LOG_CALL;
    int64_t i_mtime_total = i_mtime_analyse + i_mtime_encode + i_mtime_write + i_mtime_filter + 1;
    int i;

    fprintf(stderr, "x264: analyse=%d(%lldms) encode=%d(%lldms) write=%d(%lldms) filter=%d(%lldms)",
            (int) (100 * i_mtime_analyse / i_mtime_total), i_mtime_analyse / 1000,
            (int) (100 * i_mtime_encode / i_mtime_total), i_mtime_encode / 1000,
            (int) (100 * i_mtime_write / i_mtime_total), i_mtime_write / 1000,
            (int) (100 * i_mtime_filter / i_mtime_total), i_mtime_filter / 1000);

    /* ref frames */
    for (i = 0; i < h->param.i_frame_reference + 2; i++)
    {
        x264_frame_delete(h->freference[i]);
    }

    /* empty all allocated picture for bframes */
    for (i = 0; i < h->param.i_bframe; i++)
    {
        if (h->frame_unused[i])
        {
            x264_frame_delete(h->frame_unused[i]);
        }
        if (h->bframe_current[i])
        {
            x264_frame_delete(h->bframe_current[i]);
        }
        if (h->frame_next[i])
        {
            x264_frame_delete(h->frame_next[i]);
        }
    }

    /* rc */
    x264_ratecontrol_delete(h->rc);

    x264_free(h->mb);
    x264_free(h->p_bitstream);
    x264_free(h);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x2258a(%rip), %rdi     # 0x251b4
leaq 0x264f7(%rip), %rsi     # 0x29128
leaq 0x2665d(%rip), %rdx     # 0x29295
xorl %eax, %eax
callq 0x4c22
movq 0x30c15a(%rip), %r9     # 0x30eda0
movq 0x30c15b(%rip), %r11    # 0x30eda8
movq 0x30c15c(%rip), %rsi    # 0x30edb0
movq 0x30c15d(%rip), %rcx    # 0x30edb8
leaq (%r9,%r11), %rax
addq %rsi, %rax
leaq (%rcx,%rax), %r12
incq %r12
movq 0x2f360(%rip), %rax     # 0x31fd0
movq (%rax), %rdi
imulq $0x64, %r9, %rax
cqto
idivq %r12
movq %rax, %r8
movl $0x3e8, %r13d           # imm = 0x3E8
movq %r9, %rax
cqto
idivq %r13
movq %rax, %r9
imulq $0x64, %r11, %rax
cqto
idivq %r12
movq %rax, %r10
movq %r11, %rax
cqto
idivq %r13
movq %rax, %r11
imulq $0x64, %rsi, %rax
cqto
idivq %r12
movq %rax, %r14
movq %rsi, %rax
cqto
idivq %r13
movq %rax, %r15
imulq $0x64, %rcx, %rax
cqto
idivq %r12
movq %rax, %r12
movq %rcx, %rax
cqto
idivq %r13
movq %rax, %r13
leaq 0x265cc(%rip), %rsi     # 0x292a8
movl %r8d, %edx
movq %r9, %rcx
movl %r10d, %r8d
movq %r11, %r9
xorl %eax, %eax
pushq %r13
pushq %r12
pushq %r15
pushq %r14
callq 0x2180
addq $0x20, %rsp
cmpl $-0x1, 0x98(%rbx)
jl 0x2d24
pushq $-0x1
popq %r14
movq 0x10eff8(%rbx,%r14,8), %rdi
callq 0x513e
movslq 0x98(%rbx), %rax
incq %r14
cmpq %rax, %r14
jle 0x2d08
cmpl $0x0, 0xa4(%rbx)
jle 0x2d75
xorl %r14d, %r14d
movq 0x10ef58(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2d42
callq 0x513e
movq 0x10ee50(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2d54
callq 0x513e
movq 0x10eed0(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2d66
callq 0x513e
incq %r14
movslq 0xa4(%rbx), %rax
cmpq %rax, %r14
jl 0x2d30
movq 0x10f188(%rbx), %rdi
callq 0x1e9ad
movq 0x10efe8(%rbx), %rdi
callq 0x4838
movq 0x58(%rbx), %rdi
callq 0x4838
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4838