// File: /workspace/github_c_makefile_star2_O2/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 0x5e954(%rip), %rdi     # 0x664f8
callq 0x27d00
testq %rax, %rax
je 0x7ca2
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
leaq 0x48(%rax), %r14
movl $0x120, %edx            # imm = 0x120
xorl %esi, %esi
callq 0x20a0
pushq $0x70
popq %rsi
movq %r14, %rdi
callq 0x27cf0
movq 0x5667b(%rip), %r15     # 0x5e278
testq %r15, %r15
cmoveq %rbx, %r15
movq %rbx, 0x5666d(%rip)     # 0x5e278
andw $0xfc00, 0x198(%rbx)    # imm = 0xFC00
xorl %edi, %edi
xorl %esi, %esi
callq 0x42c9
movq %rax, 0x60(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x42c9
movq %rax, 0x68(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x42c9
movq %rax, 0x70(%rbx)
movq 0x68(%rbx), %rdi
leaq 0x563f2(%rip), %r14     # 0x5e038
movq %r14, %rsi
callq 0x5a3d
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x5a3d
movq 0x60(%rbx), %rdi
callq 0x493a
movq %r15, 0x5660e(%rip)     # 0x5e278
leaq -0x13da(%rip), %rdi     # 0x6897
pushq $0x1e
popq %rsi
pushq $0x3
popq %rdx
movq %rbx, %rcx
callq 0x26c3b
movq %rax, 0x40(%rbx)
movq %rax, %rdi
callq 0x7994
movq 0x40(%rbx), %rsi
testb %al, %al
je 0x7cbf
testq %rsi, %rsi
je 0x7ccd
movq %rsi, %rdi
callq 0x26d4b
jmp 0x7ccf
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x7994
testb %al, %al
jne 0x7ccf
leaq 0x3338a(%rip), %rdi     # 0x3b040
xorl %esi, %esi
callq 0x7b01
jmp 0x7cbd
leaq 0x3337a(%rip), %rdi     # 0x3b040
callq 0x7b01
jmp 0x7ccb
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq