// File: /workspace/github_c_makefile_star2_O0/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_list.c
// Function: lv_list_add_btn
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt)
{
    LV_ASSERT_OBJ(list, LV_OBJX_NAME);

    lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
    ext->size++;
    /*Create a list element with the image an the text*/
    lv_obj_t * liste;
    liste = lv_btn_create(list, NULL);

    /*Save the original signal function because it will be required in `lv_list_btn_signal`*/
    if(ancestor_btn_signal == NULL) ancestor_btn_signal = lv_obj_get_signal_cb(liste);

    /*Set the default styles*/
    lv_btn_set_style(liste, LV_BTN_STYLE_REL, ext->styles_btn[LV_BTN_STATE_REL]);
    lv_btn_set_style(liste, LV_BTN_STYLE_PR, ext->styles_btn[LV_BTN_STATE_PR]);
    lv_btn_set_style(liste, LV_BTN_STYLE_TGL_REL, ext->styles_btn[LV_BTN_STATE_TGL_REL]);
    lv_btn_set_style(liste, LV_BTN_STYLE_TGL_PR, ext->styles_btn[LV_BTN_STATE_TGL_PR]);
    lv_btn_set_style(liste, LV_BTN_STYLE_INA, ext->styles_btn[LV_BTN_STATE_INA]);

    lv_page_glue_obj(liste, true);
    lv_btn_set_layout(liste, LV_LAYOUT_ROW_M);
    lv_btn_set_fit2(liste, LV_FIT_FLOOD, LV_FIT_TIGHT);
    lv_obj_set_protect(liste, LV_PROTECT_PRESS_LOST);
    lv_obj_set_signal_cb(liste, lv_list_btn_signal);

#if LV_USE_IMG != 0
    lv_obj_t * img = NULL;
    if(img_src) {
        img = lv_img_create(liste, NULL);
        lv_img_set_src(img, img_src);
        lv_obj_set_style(img, ext->style_img);
        lv_obj_set_click(img, false);
        if(img_signal == NULL) img_signal = lv_obj_get_signal_cb(img);
    }
#endif
    if(txt != NULL) {
        lv_coord_t btn_hor_pad = ext->styles_btn[LV_BTN_STYLE_REL]->body.padding.left -
                                 ext->styles_btn[LV_BTN_STYLE_REL]->body.padding.right;
        lv_obj_t * label = lv_label_create(liste, NULL);
        lv_label_set_text(label, txt);
        lv_obj_set_click(label, false);
        lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL_CIRC);
        if(lv_obj_get_base_dir(liste) == LV_BIDI_DIR_RTL) lv_obj_set_width(label, label->coords.x2 - liste->coords.x1 - btn_hor_pad);
        else  lv_obj_set_width(label, liste->coords.x2 - label->coords.x1 - btn_hor_pad);
        if(label_signal == NULL) label_signal = lv_obj_get_signal_cb(label);
    }
#if LV_USE_GROUP
    /* If this is the first item to be added to the list and the list is
     * focused, select it */
    {
        lv_group_t * g = lv_obj_get_group(list);
        if(ext->size == 1 && lv_group_get_focused(g) == list) {
            lv_list_set_btn_selected(list, liste);
        }
    }
#endif

    return liste;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x2d8d3
movq -0x8(%rbp), %rsi
leaq 0x3a830(%rip), %rdi     # 0x680fc
callq 0xd410
jmp 0x2d8d1
movq -0x8(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movw 0x80(%rax), %cx
addw $0x1, %cx
movw %cx, 0x80(%rax)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fe90
movq %rax, -0x28(%rbp)
cmpq $0x0, 0x5bb81(%rip)     # 0x89490
jne 0x2d921
movq -0x28(%rbp), %rdi
callq 0xa830
movq %rax, 0x5bb6f(%rip)     # 0x89490
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdx
xorl %esi, %esi
callq 0x205e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdx
movl $0x1, %esi
callq 0x205e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rdx
movl $0x2, %esi
callq 0x205e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdx
movl $0x3, %esi
callq 0x205e0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x70(%rax), %rdx
movl $0x4, %esi
callq 0x205e0
movq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x3ee80
movq -0x28(%rbp), %rdi
movl $0x6, %esi
callq 0x2dc40
movq -0x28(%rbp), %rdi
movl $0x2, %esi
movl $0x1, %edx
callq 0x2dc70
movq -0x28(%rbp), %rdi
movl $0x10, %esi
callq 0x9a50
movq -0x28(%rbp), %rdi
leaq 0x2cc(%rip), %rsi       # 0x2dca0
callq 0x9cc0
movq $0x0, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x2da3e
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x39cb0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x3a2c0
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x78(%rax), %rsi
callq 0x9150
movq -0x30(%rbp), %rdi
xorl %esi, %esi
callq 0x94b0
cmpq $0x0, 0x5ba6e(%rip)     # 0x89498
jne 0x2da3c
movq -0x30(%rbp), %rdi
callq 0xa830
movq %rax, 0x5ba5c(%rip)     # 0x89498
jmp 0x2da3e
cmpq $0x0, -0x18(%rbp)
je 0x2db15
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rax
movswl 0x1a(%rax), %eax
movq -0x20(%rbp), %rcx
movq 0x50(%rcx), %rcx
movswl 0x1c(%rcx), %ecx
subl %ecx, %eax
movw %ax, -0x32(%rbp)
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29820
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x2a630
movq -0x40(%rbp), %rdi
xorl %esi, %esi
callq 0x94b0
movq -0x40(%rbp), %rdi
movl $0x4, %esi
callq 0x2a4f0
movq -0x28(%rbp), %rdi
callq 0x7180
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2dad5
movq -0x40(%rbp), %rdi
movq -0x40(%rbp), %rax
movswl 0x24(%rax), %eax
movq -0x28(%rbp), %rcx
movswl 0x20(%rcx), %ecx
subl %ecx, %eax
movswl -0x32(%rbp), %ecx
subl %ecx, %eax
movswl %ax, %esi
callq 0x8430
jmp 0x2daf9
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rax
movswl 0x24(%rax), %eax
movq -0x40(%rbp), %rcx
movswl 0x20(%rcx), %ecx
subl %ecx, %eax
movswl -0x32(%rbp), %ecx
subl %ecx, %eax
movswl %ax, %esi
callq 0x8430
cmpq $0x0, 0x5b99f(%rip)     # 0x894a0
jne 0x2db13
movq -0x40(%rbp), %rdi
callq 0xa830
movq %rax, 0x5b98d(%rip)     # 0x894a0
jmp 0x2db15
movq -0x8(%rbp), %rdi
callq 0x77c0
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x80(%rax), %eax
cmpl $0x1, %eax
jne 0x2db4e
movq -0x48(%rbp), %rdi
callq 0x3010
cmpq -0x8(%rbp), %rax
jne 0x2db4e
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x2def0
movq -0x28(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)