// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
callq 0x22974
movq %rax, %rbx
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x178aa
testq %rbx, %rbx
je 0x178bb
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x6146
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x178cc
testq %r14, %r14
je 0x178bb
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movw $0x600, 0x20(%r14)      # imm = 0x600
cmpq $0x0, 0x46b8a(%rip)     # 0x5e3a0
jne 0x17827
movq %rbx, %rdi
callq 0x66db
movq %rax, 0x46b79(%rip)     # 0x5e3a0
cmpq $0x0, 0x46b79(%rip)     # 0x5e3a8
jne 0x17840
movq %rbx, %rdi
callq 0x66ff
movq %rax, 0x46b68(%rip)     # 0x5e3a8
leaq 0x10c(%rip), %rsi       # 0x17953
movq %rbx, %rdi
callq 0x60e6
leaq 0x163(%rip), %rsi       # 0x179b9
movq %rbx, %rdi
callq 0x6116
testq %r15, %r15
je 0x178ef
movq %r14, %r12
addq $0x10, %r12
movq %r15, %rdi
callq 0x6747
movq %rax, %r15
movzbl 0x20(%rax), %esi
movq 0x18(%rax), %rdx
movq %rbx, %rdi
callq 0x180f8
movzbl 0x20(%r14), %eax
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x178dd
movq 0x10(%r15), %rdx
movzwl (%rdx,%rcx,2), %edx
movq (%r12), %rsi
movw %dx, (%rsi,%rcx,2)
incq %rcx
jmp 0x17890
leaq 0x2378f(%rip), %rdi     # 0x3b040
movq %rbx, %rsi
callq 0x7b01
jmp 0x178b9
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2376d(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x178db
movb 0x21(%r15), %al
movb %al, 0x21(%r14)
movq %rbx, %rdi
callq 0x5ae7
jmp 0x178bd
pushq $0x15
popq %rdx
pushq $0x6
popq %rcx
movq %rbx, %rdi
movl $0xdc, %esi
callq 0x1809e
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x180f8
pushq $0x50
popq %rsi
movq %rbx, %rdi
callq 0x22e2c
movq %rbx, %rdi
movl $0xc8, %esi
movl $0xc8, %edx
callq 0x520e
callq 0x2be75
testq %rax, %rax
je 0x1793f
movq 0xd8(%rax), %rsi
jmp 0x17946
leaq 0x466aa(%rip), %rsi     # 0x5dff0
movq %rbx, %rdi
callq 0x5a3d
jmp 0x178bd