// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x35980
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x15010
movq -0x20(%rbp), %rsi
leaq 0x5303b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1500e
cmpq $0x0, -0x20(%rbp)
jne 0x15024
movq $0x0, -0x8(%rbp)
jmp 0x15270
cmpq $0x0, 0x7438c(%rip)     # 0x893b8
jne 0x1503e
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x7437a(%rip)     # 0x893b8
movq -0x20(%rbp), %rdi
movl $0x58, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x1506f
movq -0x28(%rbp), %rsi
leaq 0x52fdc(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x1506d
cmpq $0x0, -0x28(%rbp)
jne 0x15083
movq $0x0, -0x8(%rbp)
jmp 0x15270
movq -0x28(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x28(%rbp), %rax
movb $0x0, 0x50(%rax)
movq -0x28(%rbp), %rax
movb 0x51(%rax), %cl
andb $-0x2, %cl
orb $0x0, %cl
movb %cl, 0x51(%rax)
movq -0x20(%rbp), %rdi
leaq 0x1ce(%rip), %rsi       # 0x15280
callq 0x9cc0
cmpq $0x0, -0x18(%rbp)
jne 0x1520c
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
callq 0x71b0
movq %rax, %rdi
callq 0xa1e0
movw %ax, -0x3a(%rbp)
movq -0x20(%rbp), %rdi
callq 0x71b0
movq %rax, %rdi
callq 0xa240
movq -0x48(%rbp), %rdi
movw -0x3a(%rbp), %cx
cwtl
movl $0x2, %esi
cltd
idivl %esi
movswl %cx, %esi
movswl %ax, %edx
callq 0x8180
movq -0x20(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x5, %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x8500
movq -0x20(%rbp), %rdi
leaq 0x291(%rip), %rsi       # 0x153c0
callq 0x9b00
movq -0x20(%rbp), %rdi
leaq 0x66f61(%rip), %rsi     # 0x7c0a0
callq 0x36c80
movq -0x20(%rbp), %rdi
leaq 0x530a1(%rip), %rsi     # 0x681f0
callq 0x37640
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x9840
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x15208
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1b8(%rax), %rdx
xorl %esi, %esi
callq 0x15810
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1c0(%rax), %rdx
movl $0x1, %esi
callq 0x15810
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1c8(%rax), %rdx
movl $0x2, %esi
callq 0x15810
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1d0(%rax), %rdx
movl $0x3, %esi
callq 0x15810
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1d8(%rax), %rdx
movl $0x4, %esi
callq 0x15810
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x1e0(%rax), %rdx
movl $0x5, %esi
callq 0x15810
jmp 0x1520a
jmp 0x1520a
jmp 0x15268
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x38(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x38(%rbp), %rax
movb 0x50(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x50(%rax)
movq -0x38(%rbp), %rax
movb 0x51(%rax), %dl
andb $0x1, %dl
movq -0x28(%rbp), %rax
movb 0x51(%rax), %cl
andb $0x1, %dl
andb $-0x2, %cl
orb %dl, %cl
movb %cl, 0x51(%rax)
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)