// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_kb.c
// Function: lv_kb_create
lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("keyboard create started");

    /*Create the ancestor of keyboard*/
    lv_obj_t * new_kb = lv_btnm_create(par, copy);
    LV_ASSERT_MEM(new_kb);
    if(new_kb == NULL) return NULL;

    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_kb);

    /*Allocate the keyboard type specific extended data*/
    lv_kb_ext_t * ext = lv_obj_allocate_ext_attr(new_kb, sizeof(lv_kb_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */

    ext->ta         = NULL;
    ext->mode       = LV_KB_MODE_TEXT;
    ext->cursor_mng = 0;

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_kb, lv_kb_signal);

    /*Init the new keyboard keyboard*/
    if(copy == NULL) {
        /* Set a size which fits into the parent.
         * Don't use `par` directly because if the window is created on a page it is moved to the
         * scrollable so the parent has changed */
        lv_obj_set_size(new_kb, lv_obj_get_width_fit(lv_obj_get_parent(new_kb)),
                        lv_obj_get_height_fit(lv_obj_get_parent(new_kb)) / 2);

        lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
        lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb);
        lv_btnm_set_map(new_kb, kb_map_lc);
        lv_btnm_set_ctrl_map(new_kb, kb_ctrl_lc_map);
        lv_obj_set_base_dir(new_kb, LV_BIDI_DIR_LTR);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_kb_set_style(new_kb, LV_KB_STYLE_BG, th->style.kb.bg);
            lv_kb_set_style(new_kb, LV_KB_STYLE_BTN_REL, th->style.kb.btn.rel);
            lv_kb_set_style(new_kb, LV_KB_STYLE_BTN_PR, th->style.kb.btn.pr);
            lv_kb_set_style(new_kb, LV_KB_STYLE_BTN_TGL_REL, th->style.kb.btn.tgl_rel);
            lv_kb_set_style(new_kb, LV_KB_STYLE_BTN_TGL_PR, th->style.kb.btn.tgl_pr);
            lv_kb_set_style(new_kb, LV_KB_STYLE_BTN_INA, th->style.kb.btn.ina);
        } else {
            /*Let the button matrix's styles*/
        }
    }
    /*Copy an existing keyboard*/
    else {
        lv_kb_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        ext->ta                = NULL;
        ext->ta                = copy_ext->ta;
        ext->mode              = copy_ext->mode;
        ext->cursor_mng        = copy_ext->cursor_mng;

        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_kb);
    }

    LV_LOG_INFO("keyboard created");

    return new_kb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
callq 0x2148c
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0xc906
testq %rbx, %rbx
je 0xc917
cmpq $0x0, 0x53a79(%rip)     # 0x602e8
jne 0xc880
movq %rbx, %rdi
callq 0x6a8b
movq %rax, 0x53a68(%rip)     # 0x602e8
movq %rbx, %rdi
movl $0x58, %esi
callq 0x64db
movq %rax, %r15
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0xc927
testq %r15, %r15
je 0xc917
movq $0x0, 0x48(%r15)
movb $0x0, 0x50(%r15)
andb $-0x2, 0x51(%r15)
leaq 0x18a(%rip), %rsi       # 0xca48
movq %rbx, %rdi
callq 0x647b
testq %r14, %r14
je 0xc938
movq %r14, %rdi
callq 0x6af7
movq $0x0, 0x48(%r15)
movq 0x48(%rax), %rcx
movq %rcx, 0x48(%r15)
movb 0x50(%rax), %cl
movb %cl, 0x50(%r15)
movb 0x51(%rax), %al
andb $0x1, %al
movb 0x51(%r15), %cl
andb $-0x2, %cl
orb %al, %cl
movb %cl, 0x51(%r15)
movq %rbx, %rdi
callq 0x5e54
jmp 0xc919
leaq 0x327c3(%rip), %rdi     # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0xc915
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x327a2(%rip), %rdi     # 0x3f0d0
movq %r15, %rsi
callq 0x8294
jmp 0xc936
movq %rbx, %rdi
callq 0x4ab5
movq %rax, %rdi
callq 0x6772
movl %eax, %ebp
movq %rbx, %rdi
callq 0x4ab5
movq %rax, %rdi
callq 0x67ba
movzwl %ax, %ecx
shrl $0xf, %ecx
addl %eax, %ecx
movswl %cx, %edx
sarl %edx
movswl %bp, %esi
movq %rbx, %rdi
callq 0x5557
movq %rbx, %rdi
xorl %esi, %esi
movl $0x5, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5789
leaq 0x16a(%rip), %rsi       # 0xcaf7
movq %rbx, %rdi
callq 0x6363
leaq 0x46714(%rip), %rsi     # 0x530b0
movq %rbx, %rdi
callq 0x21f33
leaq 0x32a85(%rip), %rsi     # 0x3f430
movq %rbx, %rdi
callq 0x22507
movq %rbx, %rdi
xorl %esi, %esi
callq 0x61cb
callq 0x2e91c
testq %rax, %rax
je 0xc919
movq %rax, %r14
movq 0x1b8(%rax), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xce57
movq 0x1c0(%r14), %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0xce57
movq 0x1c8(%r14), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0xce57
movq 0x1d0(%r14), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0xce57
movq 0x1d8(%r14), %rdx
movq %rbx, %rdi
movl $0x4, %esi
callq 0xce57
movq 0x1e0(%r14), %rdx
movq %rbx, %rdi
movl $0x5, %esi
callq 0xce57
jmp 0xc919