// File: /workspace/github_c_makefile_star2_O1/termbox[P]termbox/demo/paint.c
// Function: updateAndDrawButtons
void updateAndDrawButtons(int *current, int x, int y, int mx, int my, int n, void (*attrFunc)(int, uint32_t*, uint16_t*, uint16_t*)) {
    int lx = x;
    int ly = y;
    for (int i = 0; i < n; i++) {
        if (lx <= mx && mx <= lx+3 && ly <= my && my <= ly+1) {
            *current = i;
        }
        uint32_t r;
        uint16_t fg, bg;
        (*attrFunc)(i, &r, &fg, &bg);
                tb_change_cell(lx+0, ly+0, r, fg, bg);
                tb_change_cell(lx+1, ly+0, r, fg, bg);
                tb_change_cell(lx+2, ly+0, r, fg, bg);
                tb_change_cell(lx+3, ly+0, r, fg, bg);
                tb_change_cell(lx+0, ly+1, r, fg, bg);
                tb_change_cell(lx+1, ly+1, r, fg, bg);
                tb_change_cell(lx+2, ly+1, r, fg, bg);
                tb_change_cell(lx+3, ly+1, r, fg, bg);
                lx += 4;
    }
    lx = x;
    ly = y;
        for (int i = 0; i < n; i++) {
                if (*current == i) {
                        uint16_t fg = TB_RED | TB_BOLD;
                        uint16_t bg = TB_DEFAULT;
                        tb_change_cell(lx+0, ly+2, '^', fg, bg);
                        tb_change_cell(lx+1, ly+2, '^', fg, bg);
                        tb_change_cell(lx+2, ly+2, '^', fg, bg);
                        tb_change_cell(lx+3, ly+2, '^', fg, bg);
                }
                lx += 4;
        }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %r14d
movl %r8d, 0x14(%rsp)
movl %ecx, 0x10(%rsp)
movl %edx, %r12d
movq %rsi, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
testl %r9d, %r9d
jle 0x3544
leal 0x1(%r12), %r13d
xorl %ebx, %ebx
movq 0x18(%rsp), %r15
movl %r14d, 0xc(%rsp)
movl %r13d, 0x8(%rsp)
movl 0x14(%rsp), %ecx
cmpl %ecx, %r13d
setl %al
cmpl %ecx, %r12d
setg %cl
movl 0x10(%rsp), %esi
cmpl %esi, %r15d
setg %dl
addl $0x3, %r15d
cmpl %esi, %r15d
setl %sil
orb %cl, %dl
orb %sil, %dl
orb %al, %dl
jne 0x3447
movq 0x20(%rsp), %rax
movl %ebx, (%rax)
movl %ebx, %edi
leaq 0x4(%rsp), %rsi
leaq 0x2(%rsp), %rdx
movq %rsp, %rcx
callq *0x60(%rsp)
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x3(%r15), %r13d
movl %r13d, %edi
movl %r12d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x2(%r15), %r14d
movl %r14d, %edi
movl %r12d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x1(%r15), %ebp
movl %ebp, %edi
movl %r12d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r12d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r13d, %edi
movl 0x8(%rsp), %r13d
movl %r13d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r14d, %edi
movl %r13d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %ebp, %edi
movl %r13d, %esi
callq 0x48f1
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r13d, %esi
callq 0x48f1
incl %ebx
incl %r15d
movl 0xc(%rsp), %r14d
cmpl %ebx, %r14d
jne 0x3412
testl %r14d, %r14d
movq 0x18(%rsp), %r15
jle 0x35cb
addl $0x2, %r12d
xorl %ebx, %ebx
movq 0x20(%rsp), %rax
cmpl (%rax), %ebx
jne 0x35c0
movl %r15d, %edi
movl %r12d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x48f1
leal 0x1(%r15), %edi
movl %r12d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x48f1
leal 0x2(%r15), %edi
movl %r12d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x48f1
leal 0x3(%r15), %edi
movl %r12d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x48f1
addl $0x4, %r15d
incl %ebx
cmpl %ebx, %r14d
jne 0x3554
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq