// File: /workspace/github_c_makefile_star2_O0/termbox[P]termbox/termbox.c
// Function: tb_present
void tb_present(void) {
    int x, y, w, i;
    struct tb_cell *back, *front;

    /* invalidate cursor position */
    lastx = LAST_COORD_INIT;
    lasty = LAST_COORD_INIT;

    if (buffer_size_change_request) {
        update_size();
        buffer_size_change_request = 0;
    }

    for (y = 0; y < front_buffer.height; ++y) {
        for (x = 0; x < front_buffer.width;) {
            back = &CELL(&back_buffer, x, y);
            front = &CELL(&front_buffer, x, y);
            w = wcwidth(back->ch);
            if (w < 1)
                w = 1;
            if (memcmp(back, front, sizeof(struct tb_cell)) == 0) {
                x += w;
                continue;
            }
            memcpy(front, back, sizeof(struct tb_cell));
            send_attr(back->fg, back->bg);
            if (w > 1 && x >= front_buffer.width - (w - 1)) {
                // Not enough room for wide ch, so send spaces
                for (i = x; i < front_buffer.width; ++i) {
                    send_char(i, y, ' ');
                }
            } else {
                send_char(x, y, back->ch);
                for (i = 1; i < w; ++i) {
                    front = &CELL(&front_buffer, x + i, y);
                    front->ch = 0;
                    front->fg = back->fg;
                    front->bg = back->bg;
                }
            }
            x += w;
        }
    }
    if (!IS_CURSOR_HIDDEN(cursor_x, cursor_y))
        write_cursor(cursor_x, cursor_y);
    bytebuffer_flush(&output_buffer, inout);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0xffffffff, 0x6036(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x6030(%rip) # imm = 0xFFFFFFFF
movl 0x68ae(%rip), %eax      # 0xa9d0
cmpl $0x0, %eax
je 0x4136
callq 0x4340
movl $0x0, 0x689a(%rip)      # 0xa9d0
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl 0x687e(%rip), %eax      # 0xa9c4
jge 0x42f6
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x6864(%rip), %eax      # 0xa9c0
jge 0x42e6
movq 0x684f(%rip), %rax      # 0xa9b8
movl -0x8(%rbp), %ecx
imull 0x683d(%rip), %ecx      # 0xa9b0
addl -0x4(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq 0x683d(%rip), %rax      # 0xa9c8
movl -0x8(%rbp), %ecx
imull 0x682b(%rip), %ecx      # 0xa9c0
addl -0x4(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edi
callq 0x31a0
movl %eax, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
jge 0x41c1
movl $0x1, -0xc(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq (%rax), %rax
subq %rcx, %rax
setne %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x41eb
movl -0xc(%rbp), %eax
addl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4153
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x18(%rbp), %rax
movzwl %cx, %edi
movzwl 0x6(%rax), %esi
callq 0x4390
cmpl $0x1, -0xc(%rbp)
jle 0x425a
movl -0x4(%rbp), %eax
movl 0x67a0(%rip), %ecx      # 0xa9c0
movl -0xc(%rbp), %edx
subl $0x1, %edx
subl %edx, %ecx
cmpl %ecx, %eax
jl 0x425a
movl -0x4(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl 0x6785(%rip), %eax      # 0xa9c0
jge 0x4258
movl -0x10(%rbp), %edi
movl -0x8(%rbp), %esi
movl $0x20, %edx
callq 0x45c0
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4232
jmp 0x42d8
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
movq -0x18(%rbp), %rax
movl (%rax), %edx
callq 0x45c0
movl $0x1, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x42d6
movq 0x6747(%rip), %rax      # 0xa9c8
movl -0x8(%rbp), %ecx
imull 0x6735(%rip), %ecx      # 0xa9c0
movl -0x4(%rbp), %edx
addl -0x10(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movw 0x4(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x18(%rbp), %rax
movw 0x6(%rax), %cx
movq -0x20(%rbp), %rax
movw %cx, 0x6(%rax)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x4272
jmp 0x42d8
movl -0xc(%rbp), %eax
addl -0x4(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4153
jmp 0x42e8
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x413d
cmpl $-0x1, 0x5e53(%rip)     # 0xa150
je 0x4319
cmpl $-0x1, 0x5e4e(%rip)     # 0xa154
je 0x4319
movl 0x5e42(%rip), %edi      # 0xa150
movl 0x5e40(%rip), %esi      # 0xa154
callq 0x4640
movl 0x6621(%rip), %esi      # 0xa940
leaq 0x6672(%rip), %rdi      # 0xa998
callq 0x3fe0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)