// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_gauge.c
// Function: lv_gauge_create
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
{
    LV_LOG_TRACE("gauge create started");

    /*Create the ancestor gauge*/
    lv_obj_t * new_gauge = lv_lmeter_create(par, copy);
    LV_ASSERT_MEM(new_gauge);
    if(new_gauge == NULL) return NULL;

    /*Allocate the gauge type specific extended data*/
    lv_gauge_ext_t * ext = lv_obj_allocate_ext_attr(new_gauge, sizeof(lv_gauge_ext_t));
    LV_ASSERT_MEM(ext);
    if(ext == NULL) return NULL;

    /*Initialize the allocated 'ext' */
    ext->needle_count  = 0;
    ext->values        = NULL;
    ext->needle_colors = NULL;
    ext->label_count   = LV_GAUGE_DEF_LABEL_COUNT;
    if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_gauge);
    if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_gauge);

    /*The signal and design functions are not copied so set them here*/
    lv_obj_set_signal_cb(new_gauge, lv_gauge_signal);
    lv_obj_set_design_cb(new_gauge, lv_gauge_design);

    /*Init the new gauge gauge*/
    if(copy == NULL) {
        lv_gauge_set_scale(new_gauge, LV_GAUGE_DEF_ANGLE, LV_GAUGE_DEF_LINE_COUNT, LV_GAUGE_DEF_LABEL_COUNT);
        lv_gauge_set_needle_count(new_gauge, 1, NULL);
        lv_gauge_set_critical_value(new_gauge, 80);
        lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);

        /*Set the default styles*/
        lv_theme_t * th = lv_theme_get_current();
        if(th) {
            lv_gauge_set_style(new_gauge, LV_GAUGE_STYLE_MAIN, th->style.gauge);
        } else {
            lv_gauge_set_style(new_gauge, LV_GAUGE_STYLE_MAIN, &lv_style_pretty_color);
        }
    }
    /*Copy an existing gauge*/
    else {
        lv_gauge_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
        lv_gauge_set_needle_count(new_gauge, copy_ext->needle_count, copy_ext->needle_colors);

        uint8_t i;
        for(i = 0; i < ext->needle_count; i++) {
            ext->values[i] = copy_ext->values[i];
        }
        ext->label_count = copy_ext->label_count;
        /*Refresh the style with new signal function*/
        lv_obj_refresh_style(new_gauge);
    }

    LV_LOG_INFO("gauge created");

    return new_gauge;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
callq 0x244f4
movq %rax, %rbx
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x18c51
testq %rbx, %rbx
je 0x18c62
movq %rbx, %rdi
movl $0x28, %esi
callq 0x64bc
movq %rax, %r14
movq %rax, %rdi
callq 0x80d4
testb %al, %al
je 0x18c6d
testq %r14, %r14
je 0x18c62
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movw $0x600, 0x20(%r14)      # imm = 0x600
cmpq $0x0, 0x477f7(%rip)     # 0x603a0
jne 0x18bba
movq %rbx, %rdi
callq 0x6a6c
movq %rax, 0x477e6(%rip)     # 0x603a0
cmpq $0x0, 0x477e6(%rip)     # 0x603a8
jne 0x18bd3
movq %rbx, %rdi
callq 0x6a90
movq %rax, 0x477d5(%rip)     # 0x603a8
leaq 0x110(%rip), %rsi       # 0x18cea
movq %rbx, %rdi
callq 0x645c
leaq 0x169(%rip), %rsi       # 0x18d52
movq %rbx, %rdi
callq 0x648c
testq %r15, %r15
je 0x18c7e
movq %r15, %rdi
callq 0x6ad8
movq %rax, %r15
movzbl 0x20(%rax), %esi
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0x194f0
movzbl 0x20(%r14), %eax
testq %rax, %rax
je 0x18c3f
movq %r14, %rdx
addq $0x10, %rdx
movq 0x10(%r15), %rcx
movq (%rdx), %rdx
xorl %esi, %esi
movzwl (%rcx,%rsi,2), %edi
movw %di, (%rdx,%rsi,2)
incq %rsi
cmpq %rsi, %rax
jne 0x18c2f
movb 0x21(%r15), %al
movb %al, 0x21(%r14)
movq %rbx, %rdi
callq 0x5e38
jmp 0x18c64
leaq 0x263e8(%rip), %rdi     # 0x3f040
movq %rbx, %rsi
callq 0x829e
jmp 0x18c60
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x263cc(%rip), %rdi     # 0x3f040
movq %r14, %rsi
callq 0x829e
jmp 0x18c7c
movq %rbx, %rdi
movl $0xdc, %esi
movl $0x15, %edx
movl $0x6, %ecx
callq 0x19496
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x194f0
movq %rbx, %rdi
movl $0x50, %esi
callq 0x24a41
movq %rbx, %rdi
movl $0xc8, %esi
movl $0xc8, %edx
callq 0x553f
callq 0x2e244
testq %rax, %rax
je 0x18cd6
movq 0xd8(%rax), %rsi
jmp 0x18cdd
leaq 0x47313(%rip), %rsi     # 0x5fff0
movq %rbx, %rdi
callq 0x5d83
jmp 0x18c64