// File: /workspace/github_c_makefile_star2_O0/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_resize
static int cellbuf_resize(struct cellbuf_t *c, int w, int h) {
    int rv;

    int ow = c->width;
    int oh = c->height;

    if (ow == w && oh == h) {
        return TB_OK;
    }

    w = w < 1 ? 1 : w;
    h = h < 1 ? 1 : h;

    int minw = (w < ow) ? w : ow;
    int minh = (h < oh) ? h : oh;

    struct tb_cell *prev = c->cells;

    if_err_return(rv, cellbuf_init(c, w, h));
    if_err_return(rv, cellbuf_clear(c));

    int x, y;
    for (x = 0; x < minw; x++) {
        for (y = 0; y < minh; y++) {
            struct tb_cell *src, *dst;
            src = &prev[(y * ow) + x];
            if_err_return(rv, cellbuf_get(c, x, y, &dst));
            if_err_return(rv, cell_copy(dst, src));
        }
    }

    tb_free(prev);

    return TB_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jne 0xde21
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jne 0xde21
movl $0x0, -0x4(%rbp)
jmp 0xdf86
cmpl $0x1, -0x14(%rbp)
jge 0xde31
movl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0xde37
movl -0x14(%rbp), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x18(%rbp)
jge 0xde4d
movl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xde53
movl -0x18(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0xde69
movl -0x14(%rbp), %eax
movl %eax, -0x5c(%rbp)
jmp 0xde6f
movl -0x20(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0xde85
movl -0x18(%rbp), %eax
movl %eax, -0x60(%rbp)
jmp 0xde8b
movl -0x24(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0xd100
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xdebf
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf86
movq -0x10(%rbp), %rdi
callq 0x71e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xdedb
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf86
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0xdf76
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0xdf66
movq -0x38(%rbp), %rax
movl -0x40(%rbp), %ecx
imull -0x20(%rbp), %ecx
addl -0x3c(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl -0x3c(%rbp), %esi
movl -0x40(%rbp), %edx
leaq -0x50(%rbp), %rcx
callq 0x7540
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xdf3c
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf86
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x7620
movl %eax, -0x1c(%rbp)
cmpl $0x0, %eax
je 0xdf59
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xdf86
jmp 0xdf5b
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xdef5
jmp 0xdf68
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xdee2
movq -0x38(%rbp), %rdi
callq 0x6050
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop