// File: /workspace/github_c_makefile_star2_O3/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 0x246a7(%rip), %rdi     # 0x271b4
leaq 0x28414(%rip), %rsi     # 0x2af28
leaq 0x2857a(%rip), %rdx     # 0x2b095
xorl %eax, %eax
callq 0x4a56
movq 0x30d277(%rip), %r9     # 0x30fda0
movq 0x30d278(%rip), %r11    # 0x30fda8
movq 0x30d279(%rip), %rsi    # 0x30fdb0
movq 0x30d27a(%rip), %rcx    # 0x30fdb8
leaq (%r9,%r11), %rax
addq %rsi, %rax
leaq (%rcx,%rax), %r12
incq %r12
movq 0x3047d(%rip), %rax     # 0x32fd0
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 0x284e9(%rip), %rsi     # 0x2b0a8
movl %r8d, %edx
movq %r9, %rcx
movl %r10d, %r8d
movq %r11, %r9
xorl %eax, %eax
pushq %r13
pushq %r12
pushq %r15
pushq %r14
callq 0x2170
addq $0x20, %rsp
cmpl $-0x1, 0x98(%rbx)
jl 0x2c07
pushq $-0x1
popq %r14
movq 0x10eff8(%rbx,%r14,8), %rdi
callq 0x4f72
movslq 0x98(%rbx), %rax
incq %r14
cmpq %rax, %r14
jle 0x2beb
cmpl $0x0, 0xa4(%rbx)
jle 0x2c58
xorl %r14d, %r14d
movq 0x10ef58(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2c25
callq 0x4f72
movq 0x10ee50(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2c37
callq 0x4f72
movq 0x10eed0(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x2c49
callq 0x4f72
incq %r14
movslq 0xa4(%rbx), %rax
cmpq %rax, %r14
jl 0x2c13
movq 0x10f188(%rbx), %rdi
callq 0x1f721
movq 0x10efe8(%rbx), %rdi
callq 0x466d
movq 0x58(%rbx), %rdi
callq 0x466d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x466d