// File: /workspace/github_c_makefile_star2_O3/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 %r8d, 0x14(%rsp)
movl %ecx, 0x10(%rsp)
movq %rdi, 0x18(%rsp)
movl %r9d, 0x8(%rsp)
testl %r9d, %r9d
jle 0x35c4
movl %edx, %r14d
leal 0x1(%r14), %r13d
xorl %ebx, %ebx
movq %rsi, 0x20(%rsp)
movq %rsi, %r15
movl %r13d, 0xc(%rsp)
movl 0x14(%rsp), %ecx
cmpl %ecx, %r13d
setl %al
cmpl %ecx, %r14d
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 0x3441
movq 0x18(%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 %r14d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x2(%r15), %ebp
movl %ebp, %edi
movl %r14d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
leal -0x1(%r15), %r12d
movl %r12d, %edi
movl %r14d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r14d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r13d, %edi
movl 0xc(%rsp), %r13d
movl %r13d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %ebp, %edi
movl %r13d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r12d, %edi
movl %r13d, %esi
callq 0x488f
movl 0x4(%rsp), %edx
movzwl 0x2(%rsp), %ecx
movzwl (%rsp), %r8d
movl %r15d, %edi
movl %r13d, %esi
callq 0x488f
incl %ebx
incl %r15d
cmpl %ebx, 0x8(%rsp)
jne 0x340c
cmpl $0x0, 0x8(%rsp)
movq 0x20(%rsp), %r15
jle 0x35c4
addl $0x2, %r14d
xorl %ebx, %ebx
movq 0x18(%rsp), %rax
cmpl (%rax), %ebx
jne 0x35b8
movl %r15d, %edi
movl %r14d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x488f
leal 0x1(%r15), %edi
movl %r14d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x488f
leal 0x2(%r15), %edi
movl %r14d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x488f
leal 0x3(%r15), %edi
movl %r14d, %esi
movl $0x5e, %edx
movl $0x102, %ecx            # imm = 0x102
xorl %r8d, %r8d
callq 0x488f
addl $0x4, %r15d
incl %ebx
cmpl %ebx, 0x8(%rsp)
jne 0x354c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq