// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x350f
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jg 0x33e3
movl -0x14(%rbp), %eax
movl -0x20(%rbp), %ecx
addl $0x3, %ecx
cmpl %ecx, %eax
jg 0x33e3
movl -0x24(%rbp), %eax
cmpl -0x18(%rbp), %eax
jg 0x33e3
movl -0x18(%rbp), %eax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x33e3
movl -0x28(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq 0x10(%rbp), %rax
movl -0x28(%rbp), %edi
leaq -0x2c(%rbp), %rsi
leaq -0x2e(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq *%rax
movl -0x20(%rbp), %edi
addl $0x0, %edi
movl -0x24(%rbp), %esi
addl $0x0, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x1, %edi
movl -0x24(%rbp), %esi
addl $0x0, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x2, %edi
movl -0x24(%rbp), %esi
addl $0x0, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x3, %edi
movl -0x24(%rbp), %esi
addl $0x0, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x0, %edi
movl -0x24(%rbp), %esi
addl $0x1, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x1, %edi
movl -0x24(%rbp), %esi
addl $0x1, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x2, %edi
movl -0x24(%rbp), %esi
addl $0x1, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x3, %edi
movl -0x24(%rbp), %esi
addl $0x1, %esi
movl -0x2c(%rbp), %edx
movw -0x2e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x30(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x33a4
movl -0xc(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x35e8
movq -0x8(%rbp), %rax
movl (%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x35d1
movw $0x102, -0x36(%rbp)     # imm = 0x102
movw $0x0, -0x38(%rbp)
movl -0x20(%rbp), %edi
addl $0x0, %edi
movl -0x24(%rbp), %esi
addl $0x2, %esi
movw -0x36(%rbp), %ax
movl $0x5e, %edx
movzwl %ax, %ecx
movzwl -0x38(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x1, %edi
movl -0x24(%rbp), %esi
addl $0x2, %esi
movw -0x36(%rbp), %ax
movl $0x5e, %edx
movzwl %ax, %ecx
movzwl -0x38(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x2, %edi
movl -0x24(%rbp), %esi
addl $0x2, %esi
movw -0x36(%rbp), %ax
movl $0x5e, %edx
movzwl %ax, %ecx
movzwl -0x38(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %edi
addl $0x3, %edi
movl -0x24(%rbp), %esi
addl $0x2, %esi
movw -0x36(%rbp), %ax
movl $0x5e, %edx
movzwl %ax, %ecx
movzwl -0x38(%rbp), %r8d
callq 0x49a0
movl -0x20(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x20(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3522
addq $0x40, %rsp
popq %rbp
retq
nop