// File: /workspace/github_c_makefile_star2_O2/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, %r13d
movl %r8d, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
movl %edx, %r14d
movq %rdi, 0x18(%rsp)
leal 0x1(%r14), %r12d
xorl %edi, %edi
testl %r9d, %r9d
cmovlel %edi, %r13d
movq %rsi, 0x20(%rsp)
movl %esi, %r15d
movl %r13d, 0x14(%rsp)
cmpl %edi, %r13d
je 0x34f2
movl 0x10(%rsp), %ecx
cmpl %ecx, %r12d
setl %al
cmpl %ecx, %r14d
setg %cl
movl 0xc(%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 0x33f6
movq 0x18(%rsp), %rax
movl %edi, (%rax)
movl %edi, 0x8(%rsp)
movl 0x8(%rsp), %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 %r14d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x2(%r15), %ebp
movl %ebp, %edi
movl %r14d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x1(%r15), %ebx
movl %ebx, %edi
movl %r14d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r14d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r13d, %edi
movl %r12d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %ebp, %edi
movl %r12d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %ebx, %edi
movl %r12d, %esi
callq 0x4644
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r12d, %esi
callq 0x4644
movl 0x8(%rsp), %edi
incl %edi
incl %r15d
movl 0x14(%rsp), %r13d
jmp 0x33b8
addl $0x2, %r14d
xorl %ebp, %ebp
pushq $0x5e
popq %rbx
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r12
cmpl %ebp, %r13d
je 0x356f
cmpl (%r12), %ebp
jne 0x3567
movl %r15d, %edi
movl %r14d, %esi
movl %ebx, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x4644
leal 0x1(%r15), %edi
movl %r14d, %esi
movl %ebx, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x4644
leal 0x2(%r15), %edi
movl %r14d, %esi
movl %ebx, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x4644
leal 0x3(%r15), %edi
movl %r14d, %esi
movl %ebx, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x4644
addl $0x4, %r15d
incl %ebp
jmp 0x3505
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq