// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
leaq 0x83ef5(%rip), %rdi     # 0x915c8
callq 0x453f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xd70f
movq -0x18(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0xd702
movq -0x18(%rbp), %rsi
leaq 0x5a949(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0xd700
movq $0x0, -0x8(%rbp)
jmp 0xd89f
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x40, %edx
callq 0x20e0
movq -0x18(%rbp), %rdi
addq $0x178, %rdi            # imm = 0x178
xorl %esi, %esi
movl $0x20, %edx
callq 0x2090
movq -0x18(%rbp), %rdi
addq $0x78, %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x2090
movq -0x18(%rbp), %rdi
addq $0x48, %rdi
movl $0x70, %esi
callq 0x453a0
cmpq $0x0, 0x7bbe2(%rip)     # 0x89348
jne 0xd773
movq -0x18(%rbp), %rax
movq %rax, 0x7bbd5(%rip)     # 0x89348
movq 0x7bbce(%rip), %rax     # 0x89348
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, 0x7bbbf(%rip)     # 0x89348
movq -0x18(%rbp), %rax
movw 0x198(%rax), %cx
andw $0xfc00, %cx            # imm = 0xFC00
orw $0x0, %cx
movw %cx, 0x198(%rax)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x66b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x60(%rax)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x66b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x68(%rax)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x66b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x18(%rbp), %rax
movq 0x68(%rax), %rdi
leaq 0x7b910(%rip), %rsi     # 0x89108
callq 0x9150
movq -0x18(%rbp), %rax
movq 0x70(%rax), %rdi
leaq 0x7b8fc(%rip), %rsi     # 0x89108
callq 0x9150
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rdi
callq 0x7430
movq -0x20(%rbp), %rax
movq %rax, 0x7bb1f(%rip)     # 0x89348
movq -0x18(%rbp), %rcx
leaq -0x2cf4(%rip), %rdi     # 0xab40
movl $0x1e, %esi
movl $0x3, %edx
callq 0x430d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0xd120
testb $0x1, %al
jne 0xd875
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rsi
leaq 0x5a7d6(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0xd873
movq -0x18(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0xd88a
movq $0x0, -0x8(%rbp)
jmp 0xd89f
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x432d0
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)