// File: /workspace/github_c_makefile_star2_O3/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 0x601c4(%rip), %rdi     # 0x684f8
callq 0x2a2a0
testq %rax, %rax
je 0x8438
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
movq %r14, %rdi
movl $0x70, %esi
callq 0x2a290
movq 0x57ee9(%rip), %r15     # 0x60278
testq %r15, %r15
cmoveq %rbx, %r15
movq %rbx, 0x57edb(%rip)     # 0x60278
andw $0xfc00, 0x198(%rbx)    # imm = 0xFC00
xorl %edi, %edi
xorl %esi, %esi
callq 0x454f
movq %rax, 0x60(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x454f
movq %rax, 0x68(%rbx)
xorl %edi, %edi
xorl %esi, %esi
callq 0x454f
movq %rax, 0x70(%rbx)
movq 0x68(%rbx), %rdi
leaq 0x57c60(%rip), %r14     # 0x60038
movq %r14, %rsi
callq 0x5d9f
movq 0x70(%rbx), %rdi
movq %r14, %rsi
callq 0x5d9f
movq 0x60(%rbx), %rdi
callq 0x4c4d
movq %r15, 0x57e7c(%rip)     # 0x60278
leaq -0x17a5(%rip), %rdi     # 0x6c5e
movl $0x1e, %esi
movl $0x3, %edx
movq %rbx, %rcx
callq 0x29125
movq %rax, 0x40(%rbx)
movq %rax, %rdi
callq 0x80e4
movq 0x40(%rbx), %rsi
testb %al, %al
je 0x8455
testq %rsi, %rsi
je 0x8463
movq %rsi, %rdi
callq 0x2923c
jmp 0x8465
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x80e4
testb %al, %al
jne 0x8465
leaq 0x36c84(%rip), %rdi     # 0x3f0d0
xorl %esi, %esi
callq 0x8294
jmp 0x8453
leaq 0x36c74(%rip), %rdi     # 0x3f0d0
callq 0x8294
jmp 0x8461
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq