// File: /workspace/github_c_makefile_star2_O2/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 0xb129(%rip), %rdi      # 0x1b1b4
leaq 0xefd6(%rip), %rsi      # 0x1f068
leaq 0xf13c(%rip), %rdx      # 0x1f1d5
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x39ba
movq 0x2f4cf6(%rip), %r9     # 0x304da0
movq 0x2f4cf7(%rip), %r11    # 0x304da8
movq 0x2f4cf8(%rip), %rsi    # 0x304db0
movq 0x2f4cf9(%rip), %rcx    # 0x304db8
leaq (%r9,%r11), %rax
addq %rsi, %rax
leaq (%rcx,%rax), %r12
incq %r12
movq 0x17efc(%rip), %rax     # 0x27fd0
movq (%rax), %rdi
imulq $0x64, %r9, %rax
cqto
idivq %r12
movq %rax, -0x30(%rbp)
movl $0x3e8, %r13d           # imm = 0x3E8
movq %r9, %rax
cqto
idivq %r13
movq %rax, %r9
imulq $0x64, %r11, %rax
cqto
idivq %r12
movq %rax, %r8
movq %r11, %rax
cqto
idivq %r13
movq %rax, %r11
imulq $0x64, %rsi, %rax
cqto
idivq %r12
movq %rax, %r10
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 0xf0a7(%rip), %rsi      # 0x1f1e8
movq -0x30(%rbp), %rdx
movq %r9, %rcx
movq %r11, %r9
xorl %eax, %eax
pushq %r13
pushq %r12
pushq %r15
pushq %r10
callq 0x2170
addq $0x20, %rsp
movslq 0x98(%rbx), %rax
addq $0x2, %rax
cmpq %rax, %r14
jge 0x10180
movq 0x10eff0(%rbx,%r14,8), %rdi
callq 0x3ecd
incq %r14
jmp 0x1015e
xorl %r14d, %r14d
movslq 0xa4(%rbx), %rax
cmpq %rax, %r14
jge 0x101ca
movq 0x10ef58(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x101a1
callq 0x3ecd
movq 0x10ee50(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x101b3
callq 0x3ecd
movq 0x10eed0(%rbx,%r14,8), %rdi
testq %rdi, %rdi
je 0x101c5
callq 0x3ecd
incq %r14
jmp 0x10183
movq 0x10f188(%rbx), %rdi
callq 0x1586d
movq 0x10efe8(%rbx), %rdi
callq 0x351a
movq 0x58(%rbx), %rdi
callq 0x351a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x351a