// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_hal/lv_hal_disp.c
// Function: lv_disp_drv_register
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
{
    lv_disp_t * disp = lv_ll_ins_head(&LV_GC_ROOT(_lv_disp_ll));
    if(!disp) {
        LV_ASSERT_MEM(disp);
        return NULL;
    }

    memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
    memset(&disp->inv_area_joined, 0, sizeof(disp->inv_area_joined));
    memset(&disp->inv_areas, 0, sizeof(disp->inv_areas));
    lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));

    if(disp_def == NULL) disp_def = disp;

    lv_disp_t * disp_def_tmp = disp_def;
    disp_def                 = disp; /*Temporarily change the default screen to create the default screens on the
                                        new display*/

    disp->inv_p = 0;

    disp->act_scr   = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
    disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
    disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
    lv_obj_set_style(disp->top_layer, &lv_style_transp);
    lv_obj_set_style(disp->sys_layer, &lv_style_transp);

    lv_obj_invalidate(disp->act_scr);

    disp_def = disp_def_tmp; /*Revert the default display*/

    /*Create a refresh task*/
    disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, disp);
    LV_ASSERT_MEM(disp->refr_task);
    if(disp->refr_task == NULL) return NULL;

    lv_task_ready(disp->refr_task); /*Be sure the screen will be refreshed immediately on start up*/

    return disp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x60178(%rip), %rdi     # 0x684f8
callq 0x29c08
testq %rax, %rax
je 0x8491
movq %rax, %rbx
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq 0x78(%rax), %rdi
movq %rax, %r14
addq $0x48, %r14
movl $0x120, %edx            # imm = 0x120
xorl %esi, %esi
callq 0x20a0
movq %r14, %rdi
movl $0x70, %esi
callq 0x29bf8
cmpq $0x0, 0x57e99(%rip)     # 0x60278
jne 0x83e8
movq %rbx, 0x57e90(%rip)     # 0x60278
movq 0x57e89(%rip), %r15     # 0x60278
movq %rbx, 0x57e82(%rip)     # 0x60278
andw $0xfc00, 0x198(%rbx)    # imm = 0xFC00
xorl %edi, %edi
xorl %esi, %esi
callq 0x455f
movq %rax, 0x60(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x455f
movq %rax, 0x68(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x455f
movq %rax, 0x70(%rbx)
movq 0x68(%rbx), %rdi
leaq 0x57c07(%rip), %r14     # 0x60038
movq %r14, %rsi
callq 0x5d83
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x5d83
movq 0x60(%rbx), %rdi
callq 0x4c36
movq %r15, 0x57e23(%rip)     # 0x60278
leaq -0x180a(%rip), %rdi     # 0x6c52
movl $0x1e, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x28a94
movq %rax, 0x40(%rbx)
movq %rax, %rdi
callq 0x80d4
movq 0x40(%rbx), %rsi
testb %al, %al
je 0x84ae
testq %rsi, %rsi
je 0x84bc
movq %rsi, %rdi
callq 0x28baf
jmp 0x84be
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x80d4
testb %al, %al
jne 0x84be
leaq 0x36b9b(%rip), %rdi     # 0x3f040
xorl %esi, %esi
callq 0x829e
jmp 0x84ac
leaq 0x36b8b(%rip), %rdi     # 0x3f040
callq 0x829e
jmp 0x84ba
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq