// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x3b6f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x287f0
movq -0x20(%rbp), %rsi
leaq 0x3f85b(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x287ee
cmpq $0x0, -0x20(%rbp)
jne 0x28804
movq $0x0, -0x8(%rbp)
jmp 0x289d9
movq -0x20(%rbp), %rdi
movl $0x28, %esi
callq 0x9d60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xd120
testb $0x1, %al
jne 0x28835
movq -0x28(%rbp), %rsi
leaq 0x3f816(%rip), %rdi     # 0x68044
callq 0xd410
jmp 0x28833
cmpq $0x0, -0x28(%rbp)
jne 0x28849
movq $0x0, -0x8(%rbp)
jmp 0x289d9
movq -0x28(%rbp), %rax
movb $0x0, 0x20(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x28(%rbp), %rax
movb $0x6, 0x21(%rax)
cmpq $0x0, 0x60bf7(%rip)     # 0x89470
jne 0x2888b
movq -0x20(%rbp), %rdi
callq 0xa830
movq %rax, 0x60be5(%rip)     # 0x89470
cmpq $0x0, 0x60be5(%rip)     # 0x89478
jne 0x288a5
movq -0x20(%rbp), %rdi
callq 0xa870
movq %rax, 0x60bd3(%rip)     # 0x89478
movq -0x20(%rbp), %rdi
leaq 0x140(%rip), %rsi       # 0x289f0
callq 0x9cc0
movq -0x20(%rbp), %rdi
leaq 0x1d0(%rip), %rsi       # 0x28a90
callq 0x9d10
cmpq $0x0, -0x18(%rbp)
jne 0x28954
movq -0x20(%rbp), %rdi
movl $0xdc, %esi
movl $0x15, %edx
movl $0x6, %ecx
callq 0x28be0
movq -0x20(%rbp), %rdi
movl $0x1, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x28c60
movq -0x20(%rbp), %rdi
movl $0x50, %esi
callq 0x28da0
movq -0x20(%rbp), %rdi
movl $0xc8, %edx
movl %edx, %esi
callq 0x8180
callq 0x4cfc0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x28940
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0xd8(%rax), %rdx
xorl %esi, %esi
callq 0x28dd0
jmp 0x28952
movq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq 0x60773(%rip), %rdx     # 0x890c0
callq 0x28dd0
jmp 0x289d1
movq -0x18(%rbp), %rdi
callq 0xa8f0
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rax
movb 0x20(%rax), %al
movq -0x38(%rbp), %rcx
movq 0x18(%rcx), %rdx
movzbl %al, %esi
callq 0x28c60
movb $0x0, -0x39(%rbp)
movzbl -0x39(%rbp), %eax
movq -0x28(%rbp), %rcx
movzbl 0x20(%rcx), %ecx
cmpl %ecx, %eax
jge 0x289ba
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movzbl -0x39(%rbp), %ecx
movw (%rax,%rcx,2), %dx
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movzbl -0x39(%rbp), %ecx
movw %dx, (%rax,%rcx,2)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x28980
movq -0x38(%rbp), %rax
movb 0x21(%rax), %cl
movq -0x28(%rbp), %rax
movb %cl, 0x21(%rax)
movq -0x20(%rbp), %rdi
callq 0x9250
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)