// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_core/lv_refr.c
// Function: lv_inv_area
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
{
    if(!disp) disp = lv_disp_get_default();
    if(!disp) return;

    /*Clear the invalidate buffer if the parameter is NULL*/
    if(area_p == NULL) {
        disp->inv_p = 0;
        return;
    }

    lv_area_t scr_area;
    scr_area.x1 = 0;
    scr_area.y1 = 0;
    scr_area.x2 = lv_disp_get_hor_res(disp) - 1;
    scr_area.y2 = lv_disp_get_ver_res(disp) - 1;

    lv_area_t com_area;
    bool suc;

    suc = lv_area_intersect(&com_area, area_p, &scr_area);

    /*The area is truncated to the screen*/
    if(suc != false) {
        if(disp->driver.rounder_cb) disp->driver.rounder_cb(&disp->driver, &com_area);

        /*Save only if this area is not in one of the saved areas*/
        uint16_t i;
        for(i = 0; i < disp->inv_p; i++) {
            if(lv_area_is_in(&com_area, &disp->inv_areas[i]) != false) return;
        }

        /*Save the area*/
        if(disp->inv_p < LV_INV_BUF_SIZE) {
            lv_area_copy(&disp->inv_areas[disp->inv_p], &com_area);
        } else { /*If no place for the area add the screen*/
            disp->inv_p = 0;
            lv_area_copy(&disp->inv_areas[disp->inv_p], &scr_area);
        }
        disp->inv_p++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xadf0
callq 0xdad0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0xadfc
jmp 0xafb1
cmpq $0x0, -0x10(%rbp)
jne 0xae23
movq -0x8(%rbp), %rax
movw 0x198(%rax), %cx
andw $0xfc00, %cx            # imm = 0xFC00
orw $0x0, %cx
movw %cx, 0x198(%rax)
jmp 0xafb1
movw $0x0, -0x18(%rbp)
movw $0x0, -0x16(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd940
cwtl
subl $0x1, %eax
movw %ax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd9b0
cwtl
subl $0x1, %eax
movw %ax, -0x12(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdi
leaq -0x18(%rbp), %rdx
callq 0x427d0
andb $0x1, %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xafb1
movq -0x8(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0xae95
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq *%rax
movw $0x0, -0x24(%rbp)
movzwl -0x24(%rbp), %eax
movq -0x8(%rbp), %rcx
movw 0x198(%rcx), %cx
andw $0x3ff, %cx             # imm = 0x3FF
movzwl %cx, %ecx
cmpl %ecx, %eax
jge 0xaef1
movq -0x8(%rbp), %rsi
addq $0x78, %rsi
movzwl -0x24(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rsi
leaq -0x20(%rbp), %rdi
callq 0x42ae0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xaee1
jmp 0xafb1
jmp 0xaee3
movw -0x24(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x24(%rbp)
jmp 0xae9b
movq -0x8(%rbp), %rax
movw 0x198(%rax), %ax
andw $0x3ff, %ax             # imm = 0x3FF
movzwl %ax, %eax
cmpl $0x20, %eax
jge 0xaf36
movq -0x8(%rbp), %rdi
addq $0x78, %rdi
movq -0x8(%rbp), %rax
movw 0x198(%rax), %ax
andw $0x3ff, %ax             # imm = 0x3FF
movzwl %ax, %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x20(%rbp), %rsi
callq 0xafc0
jmp 0xaf7d
movq -0x8(%rbp), %rax
movw 0x198(%rax), %cx
andw $0xfc00, %cx            # imm = 0xFC00
orw $0x0, %cx
movw %cx, 0x198(%rax)
movq -0x8(%rbp), %rdi
addq $0x78, %rdi
movq -0x8(%rbp), %rax
movw 0x198(%rax), %ax
andw $0x3ff, %ax             # imm = 0x3FF
movzwl %ax, %eax
movl %eax, %eax
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x18(%rbp), %rsi
callq 0xafc0
movq -0x8(%rbp), %rax
movw 0x198(%rax), %cx
andw $0x3ff, %cx             # imm = 0x3FF
movzwl %cx, %ecx
addl $0x1, %ecx
movw %cx, %dx
movw 0x198(%rax), %cx
andw $0x3ff, %dx             # imm = 0x3FF
andw $0xfc00, %cx            # imm = 0xFC00
orw %dx, %cx
movw %cx, 0x198(%rax)
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)