LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_dir_close
lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p)
{
    if(rddir_p->drv == NULL || rddir_p->dir_d == NULL) {
        return LV_FS_RES_INV_PARAM;
    }

    lv_fs_res_t res;

    if(rddir_p->drv->dir_close_cb == NULL) {
        res = LV_FS_RES_NOT_IMP;
    } else {
        res = rddir_p->drv->dir_close_cb(rddir_p->drv, rddir_p->dir_d);
    }

    lv_mem_free(rddir_p->dir_d); /*Clean up*/
    rddir_p->dir_d = NULL;
    rddir_p->drv   = NULL;
    rddir_p->dir_d = NULL;

    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movb $0xb, %bpl
testq %rdi, %rdi
je 0x27263
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x27263
movq 0x78(%rdi), %rax
testq %rax, %rax
je 0x27252
callq *%rax
movl %eax, %ebp
movq (%rbx), %rsi
jmp 0x27255
movb $0x9, %bpl
movq %rsi, %rdi
callq 0x27a7a
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_free_space
lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p)
{
    lv_fs_drv_t * drv = lv_fs_get_drv(letter);

    if(drv == NULL) {
        return LV_FS_RES_INV_PARAM;
    }

    lv_fs_res_t res;

    if(drv->free_space_cb == NULL) {
        res = LV_FS_RES_NOT_IMP;
    } else {
        uint32_t total_tmp = 0;
        uint32_t free_tmp  = 0;
        res                = drv->free_space_cb(drv, &total_tmp, &free_tmp);

        if(total_p != NULL) *total_p = total_tmp;
        if(free_p != NULL) *free_p = free_tmp;
    }

    return res;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
callq 0x26daf
testq %rax, %rax
je 0x272b4
movq 0x60(%rax), %rcx
testq %rcx, %rcx
je 0x272b8
leaq 0x4(%rsp), %rsi
andl $0x0, (%rsi)
movq %rsp, %rdx
andl $0x0, (%rdx)
movq %rax, %rdi
callq *%rcx
testq %r14, %r14
je 0x272a8
movl 0x4(%rsp), %ecx
movl %ecx, (%r14)
testq %rbx, %rbx
je 0x272ba
movl (%rsp), %ecx
movl %ecx, (%rbx)
jmp 0x272ba
movb $0xb, %al
jmp 0x272ba
movb $0x9, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_drv_register
void lv_fs_drv_register(lv_fs_drv_t * drv_p)
{
    /*Save the new driver*/
    lv_fs_drv_t * new_drv;
    new_drv = lv_ll_ins_head(&LV_GC_ROOT(_lv_drv_ll));
    LV_ASSERT_MEM(new_drv);
    if(new_drv == NULL) return;

    memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3f235(%rip), %rdi     # 0x66528
callq 0x27d00
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x27320
testq %r14, %r14
je 0x27318
pushq $0x10
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
rep  movsq (%rsi), %es:(%rdi)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x13d19(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x2732f
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_get_letters
char * lv_fs_get_letters(char * buf)
{
    lv_fs_drv_t * drv;
    uint8_t i = 0;

    LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv)
    {
        buf[i] = drv->letter;
        i++;
    }

    buf[i] = '\0';

    return buf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x3f1e8(%rip), %r14     # 0x66528
movq %r14, %rdi
callq 0x27db9
xorl %r15d, %r15d
movzbl %r15b, %r15d
testq %rax, %rax
je 0x2736a
movb (%rax), %cl
movb %cl, (%rbx,%r15)
incb %r15b
movq %r14, %rdi
movq %rax, %rsi
callq 0x27e93
jmp 0x2734b
movb $0x0, (%rbx,%r15)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_up
char * lv_fs_up(char * path)
{
    size_t len = strlen(path);
    if(len == 0) return path;

    len--; /*Go before the trailing '\0'*/

    /*Ignore trailing '/' or '\'*/
    while(path[len] == '/' || path[len] == '\\') {
        path[len] = '\0';
        if(len > 0)
            len--;
        else
            return path;
    }

    size_t i;
    for(i = len; i > 0; i--) {
        if(path[i] == '/' || path[i] == '\\') break;
    }

    if(i > 0) path[i] = '\0';

    return path;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2070
testq %rax, %rax
je 0x273fd
decq %rax
movzbl (%rbx,%rax), %ecx
cmpl $0x2f, %ecx
je 0x273d4
cmpl $0x5c, %ecx
jne 0x273ee
movb $0x0, (%rbx,%rax)
addq $-0x1, %rax
jb 0x273c6
jmp 0x273fd
movzbl (%rbx,%rcx), %edx
cmpl $0x2f, %edx
je 0x273f9
cmpl $0x5c, %edx
je 0x273f9
movq %rax, %rcx
subq $0x1, %rax
jae 0x273e0
jmp 0x273fd
movb $0x0, (%rbx,%rcx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_fs.c
// Function: lv_fs_get_last
const char * lv_fs_get_last(const char * path)
{
    size_t len = strlen(path);
    if(len == 0) return path;

    len--; /*Go before the trailing '\0'*/

    /*Ignore trailing '/' or '\'*/
    while(path[len] == '/' || path[len] == '\\') {
        if(len > 0)
            len--;
        else
            return path;
    }

    size_t i;
    for(i = len; i > 0; i--) {
        if(path[i] == '/' || path[i] == '\\') break;
    }

    /*No '/' or '\' in the path so return with path itself*/
    if(i == 0) return path;

    return &path[i + 1];
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x2070
testq %rax, %rax
je 0x27443
movzbl -0x1(%rbx,%rax), %ecx
cmpl $0x2f, %ecx
je 0x2741f
cmpl $0x5c, %ecx
jne 0x27438
decq %rax
jne 0x27410
jmp 0x27443
movzbl -0x1(%rbx,%rax), %ecx
cmpl $0x2f, %ecx
je 0x27440
cmpl $0x5c, %ecx
je 0x27440
decq %rax
cmpq $0x1, %rax
jne 0x27426
jmp 0x27443
addq %rax, %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_init
void lv_anim_init(lv_anim_t * a)
{
    memset(a, 0, sizeof(lv_anim_t));
    a->time    = 500;
    a->start   = 0;
    a->end     = 100;
    a->path_cb = lv_anim_path_linear;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
andq $0x0, 0x30(%rdi)
movw $0x1f4, 0x28(%rdi)      # imm = 0x1F4
movl $0x64, 0x24(%rdi)
leaq 0x5(%rip), %rax         # 0x27659
movq %rax, 0x10(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_create
void lv_anim_create(lv_anim_t * a)
{
    LV_LOG_TRACE("animation create started")
    /* Do not let two animations for the  same 'var' with the same 'fp'*/
    if(a->exec_cb != NULL) lv_anim_del(a->var, a->exec_cb); /*fp == NULL would delete all animations of var*/

    /*Add the new animation to the animation linked list*/
    lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
    LV_ASSERT_MEM(new_anim);
    if(new_anim == NULL) return;

    /*Initialize the animation descriptor*/
    a->playback_now = 0;
    memcpy(new_anim, a, sizeof(lv_anim_t));

    /*Set the start value*/
    if(new_anim->exec_cb) new_anim->exec_cb(new_anim->var, new_anim->start);

    /* Creating an animation changed the linked list.
     * It's important if it happens in a ready callback. (see `anim_task`)*/
    anim_list_changed = true;

    LV_LOG_TRACE("animation created")
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rsi
testq %rsi, %rsi
je 0x2769d
movq (%rbx), %rdi
callq 0x27715
leaq 0x3eeb4(%rip), %rdi     # 0x66558
callq 0x27d00
movq %rax, %r14
movq %rax, %rdi
callq 0x7994
testb %al, %al
je 0x27704
testq %r14, %r14
je 0x276fc
andb $-0x5, 0x30(%rbx)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups 0x20(%rbx), %xmm2
movups %xmm0, (%r14)
movups %xmm2, 0x20(%r14)
movups %xmm1, 0x10(%r14)
movq 0x30(%rbx), %rax
movq %rax, 0x30(%r14)
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x276f5
movq (%r14), %rdi
movswl 0x20(%r14), %esi
callq *%rax
movb $0x1, 0x36dc4(%rip)     # 0x5e4c0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x13935(%rip), %rdi     # 0x3b040
movq %r14, %rsi
callq 0x7b01
jmp 0x27713
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_del
bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb)
{
    lv_anim_t * a;
    lv_anim_t * a_next;
    bool del = false;
    a        = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
    while(a != NULL) {
        /*'a' might be deleted, so get the next object while 'a' is valid*/
        a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);

        if(a->var == var && (a->exec_cb == exec_cb || exec_cb == NULL)) {
            lv_ll_rem(&LV_GC_ROOT(_lv_anim_ll), a);
            lv_mem_free(a);
            anim_list_changed = true; /*Read by `anim_task`. It need to know if a delete occurred in
                                         the linked list*/
            del = true;
        }

        a = a_next;
    }

    return del;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3ee2b(%rip), %r15     # 0x66558
movq %r15, %rdi
callq 0x27db9
movq %rax, %r12
xorl %ebp, %ebp
testq %r12, %r12
je 0x27780
movq %r12, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x27e93
movq %rax, %r12
cmpq %r14, (%r13)
jne 0x2773a
testq %rbx, %rbx
je 0x27761
cmpq %rbx, 0x8(%r13)
jne 0x2773a
movq %r15, %rdi
movq %r13, %rsi
callq 0x27e1c
movq %r13, %rdi
callq 0x27a7a
movb $0x1, 0x36d45(%rip)     # 0x5e4c0
movb $0x1, %bpl
jmp 0x2773a
andb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_speed_to_time
uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end)
{
    int32_t d     = LV_MATH_ABS((int32_t)start - end);
    uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);

    if(time > UINT16_MAX) time = UINT16_MAX;

    if(time == 0) {
        time++;
    }

    return time;
}

// Assembly:
subl %edx, %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
movl $0xffff, %esi           # imm = 0xFFFF
andl %esi, %eax
imull $0x3e8, %eax, %ecx      # imm = 0x3E8
movl %ecx, %eax
xorl %edx, %edx
divl %edi
cmpl %esi, %eax
cmovael %esi, %eax
cmpl %edi, %ecx
pushq $0x1
popq %rcx
cmovbl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_path_ease_in
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_t * a)
{
    /*Calculate the current step*/
    uint32_t t;
    if(a->time == a->act_time)
        t = 1024;
    else
        t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;

    int32_t step = lv_bezier3(t, 0, 1, 1, 1024);

    int32_t new_value;
    new_value = (int32_t)step * (a->end - a->start);
    new_value = new_value >> 10;
    new_value += a->start;

    return (lv_anim_value_t)new_value;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzwl 0x28(%rdi), %ecx
movswl 0x2a(%rdi), %eax
movl $0x400, %edi            # imm = 0x400
cmpl %eax, %ecx
je 0x2780e
shll $0xa, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %edi
pushq $0x1
popq %rcx
xorl %esi, %esi
movl %ecx, %edx
movl $0x400, %r8d            # imm = 0x400
callq 0x28df2
movl 0x20(%rbx), %ecx
movl 0x24(%rbx), %edx
subl %ecx, %edx
imull %edx, %eax
shrl $0xa, %eax
addl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_path_ease_in_out
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_t * a)
{
    /*Calculate the current step*/

    uint32_t t;
    if(a->time == a->act_time)
        t = 1024;
    else
        t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;

    int32_t step = lv_bezier3(t, 0, 100, 924, 1024);

    int32_t new_value;
    new_value = (int32_t)step * (a->end - a->start);
    new_value = new_value >> 10;
    new_value += a->start;

    return (lv_anim_value_t)new_value;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movzwl 0x28(%rdi), %ecx
movswl 0x2a(%rdi), %eax
movl $0x400, %edi            # imm = 0x400
cmpl %eax, %ecx
je 0x27897
shll $0xa, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %edi
pushq $0x64
popq %rdx
xorl %esi, %esi
movl $0x39c, %ecx            # imm = 0x39C
movl $0x400, %r8d            # imm = 0x400
callq 0x28df2
movl 0x20(%rbx), %ecx
movl 0x24(%rbx), %edx
subl %ecx, %edx
imull %edx, %eax
shrl $0xa, %eax
addl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_anim.c
// Function: lv_anim_path_bounce
lv_anim_value_t lv_anim_path_bounce(const lv_anim_t * a)
{
    /*Calculate the current step*/
    uint32_t t;
    if(a->time == a->act_time)
        t = 1024;
    else
        t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;

    int32_t diff = (a->end - a->start);

    /*3 bounces has 5 parts: 3 down and 2 up. One part is t / 5 long*/

    if(t < 408) {
        /*Go down*/
        t = (t * 2500) >> 10; /*[0..1024] range*/
    } else if(t >= 408 && t < 614) {
        /*First bounce back*/
        t -= 408;
        t    = t * 5; /*to [0..1024] range*/
        t    = 1024 - t;
        diff = diff / 6;
    } else if(t >= 614 && t < 819) {
        /*Fall back*/
        t -= 614;
        t    = t * 5; /*to [0..1024] range*/
        diff = diff / 6;
    } else if(t >= 819 && t < 921) {
        /*Second bounce back*/
        t -= 819;
        t    = t * 10; /*to [0..1024] range*/
        t    = 1024 - t;
        diff = diff / 16;
    } else if(t >= 921 && t <= 1024) {
        /*Fall back*/
        t -= 921;
        t    = t * 10; /*to [0..1024] range*/
        diff = diff / 16;
    }

    if(t > 1024) t = 1024;

    int32_t step = lv_bezier3(t, 1024, 1024, 800, 0);

    int32_t new_value;
    new_value = (int32_t)step * diff;
    new_value = new_value >> 10;
    new_value = a->end - new_value;

    return (lv_anim_value_t)new_value;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzwl 0x28(%rdi), %ecx
movswl 0x2a(%rdi), %eax
movl $0x400, %edi            # imm = 0x400
cmpl %eax, %ecx
je 0x27925
shll $0xa, %eax
xorl %edx, %edx
divl %ecx
movl %eax, %edi
movl 0x24(%rbx), %ebp
subl 0x20(%rbx), %ebp
cmpl $0x197, %edi            # imm = 0x197
ja 0x2793e
imull $0x9c4, %edi, %edi      # imm = 0x9C4
shrl $0xa, %edi
jmp 0x2796c
cmpl $0x265, %edi            # imm = 0x265
ja 0x27951
imull $-0x5, %edi, %edi
addl $0xbf8, %edi            # imm = 0xBF8
jmp 0x27962
cmpl $0x332, %edi            # imm = 0x332
ja 0x279a1
leal (%rdi,%rdi,4), %edi
addl $0xfffff402, %edi       # imm = 0xFFFFF402
pushq $0x6
popq %rcx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, %ebp
movl $0x400, %eax            # imm = 0x400
cmpl %eax, %edi
cmovael %eax, %edi
movl $0x400, %esi            # imm = 0x400
movl $0x400, %edx            # imm = 0x400
movl $0x320, %ecx            # imm = 0x320
xorl %r8d, %r8d
callq 0x28df2
imull %ebp, %eax
shrl $0xa, %eax
movl 0x24(%rbx), %ecx
subl %eax, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
cmpl $0x398, %edi            # imm = 0x398
ja 0x279b4
imull $-0xa, %edi, %edi
addl $0x23fe, %edi           # imm = 0x23FE
jmp 0x279c5
cmpl $0x400, %edi            # imm = 0x400
ja 0x2796c
imull $0xa, %edi, %edi
addl $0xffffdc06, %edi       # imm = 0xFFFFDC06
pushq $0x10
jmp 0x27964
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_mem.c
// Function: lv_mem_realloc
void * lv_mem_realloc(void * data_p, size_t new_size)
{
    /*data_p could be previously freed pointer (in this case it is invalid)*/
    if(data_p != NULL) {
        lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t));
        if(e->header.s.used == 0) {
            data_p = NULL;
        }
    }

    uint32_t old_size = lv_mem_get_size(data_p);
    if(old_size == new_size) return data_p; /*Also avoid reallocating the same memory*/

#if LV_MEM_CUSTOM == 0
    /* Truncate the memory if the new size is smaller. */
    if(new_size < old_size) {
        lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t));
        ent_trunc(e, new_size);
        return &e->first_data;
    }
#endif

    void * new_p;
    new_p = lv_mem_alloc(new_size);

    if(new_p != NULL && data_p != NULL) {
        /*Copy the old data to the new. Use the smaller size*/
        if(old_size != 0) {
            memcpy(new_p, data_p, LV_MATH_MIN(new_size, old_size));
            lv_mem_free(data_p);
        }
    }

    if(new_p == NULL) LV_LOG_WARN("Couldn't allocate memory");

    return new_p;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x27b10
xorl %eax, %eax
testb $0x1, -0x4(%rdi)
sete %cl
movl $0x0, %ebx
cmovneq %rdi, %rbx
leaq 0x3e9dc(%rip), %rdx     # 0x664d8
cmpq %rdx, %rbx
sete %dl
orb %cl, %dl
jne 0x27b14
movl -0x4(%rdi), %eax
shrl %eax
movq %rdi, %rbx
jmp 0x27b14
xorl %ebx, %ebx
xorl %eax, %eax
movl %eax, %r14d
cmpq %rsi, %r14
je 0x27b5c
jbe 0x27b29
leaq -0x4(%rbx), %rdi
callq 0x27b84
jmp 0x27b5c
movq %rsi, %rdi
callq 0x279f9
movq %rax, %r15
testq %r14, %r14
je 0x27b59
testq %rbx, %rbx
je 0x27b59
testq %r15, %r15
je 0x27b59
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x20f0
movq %rbx, %rdi
callq 0x27a7a
movq %r15, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_mem.c
// Function: lv_mem_defrag
static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e)
{
    lv_mem_ent_t * next_e = NULL;

    if(act_e == NULL) { /*NULL means: get the first entry*/
        next_e = (lv_mem_ent_t *)work_mem;
    } else { /*Get the next entry */
        uint8_t * data = &act_e->first_data;
        next_e         = (lv_mem_ent_t *)&data[act_e->header.s.d_size];

        if(&next_e->first_data >= &work_mem[LV_MEM_SIZE]) next_e = NULL;
    }

    return next_e;
}

// Assembly:
movq 0x3e901(%rip), %rcx     # 0x664d0
xorl %eax, %eax
movq %rcx, %rdi
leaq 0x8000(%rcx), %r8
testq %rdi, %rdi
je 0x27c48
movq %rdi, %rdx
movl (%rdi), %esi
movl %esi, %r9d
shrl %r9d
addq %r9, %rdi
addq $0x4, %rdi
addq %rdx, %r9
addq $0x8, %r9
cmpq %r8, %r9
cmovaeq %rax, %rdi
testb $0x1, %sil
jne 0x27bdb
jmp 0x27c38
addl %r8d, %esi
addl $0x8, %esi
movl %esi, (%rdx)
movl (%rdi), %ecx
shrl %ecx
leaq (%rdi,%rcx), %r8
addq $0x8, %r8
addq %rcx, %rdi
addq $0x4, %rdi
movq 0x3e8a6(%rip), %rcx     # 0x664d0
leaq 0x8000(%rcx), %r9
cmpq %r9, %r8
cmovaeq %rax, %rdi
testq %rdi, %rdi
je 0x27c48
movl (%rdi), %r8d
testb $0x1, %r8b
je 0x27c08
jmp 0x27bd4
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_mem.c
// Function: lv_mem_monitor
void lv_mem_monitor(lv_mem_monitor_t * mon_p)
{
    /*Init the data*/
    memset(mon_p, 0, sizeof(lv_mem_monitor_t));
#if LV_MEM_CUSTOM == 0
    lv_mem_ent_t * e;
    e = NULL;

    e = ent_get_next(e);

    while(e != NULL) {
        if(e->header.s.used == 0) {
            mon_p->free_cnt++;
            mon_p->free_size += e->header.s.d_size;
            if(e->header.s.d_size > mon_p->free_biggest_size) {
                mon_p->free_biggest_size = e->header.s.d_size;
            }
        } else {
            mon_p->used_cnt++;
        }

        e = ent_get_next(e);
    }
    mon_p->total_size = LV_MEM_SIZE;
    mon_p->used_pct   = 100 - (100U * mon_p->free_size) / mon_p->total_size;
    mon_p->frag_pct   = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size;
    mon_p->frag_pct   = 100 - mon_p->frag_pct;
#endif
}

// Assembly:
pushq %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
movups %xmm0, (%rdi)
movq 0x3e874(%rip), %r9      # 0x664d0
leaq 0x8000(%r9), %rax
xorl %edx, %edx
xorl %r10d, %r10d
xorl %ecx, %ecx
xorl %esi, %esi
xorl %r8d, %r8d
testq %r9, %r9
je 0x27cc7
testb $0x1, (%r9)
jne 0x27c9c
incl %esi
movl %esi, 0x4(%rdi)
movl (%r9), %r11d
shrl %r11d
addl %r11d, %ecx
movl %ecx, 0x8(%rdi)
movl (%r9), %r11d
shrl %r11d
cmpl %r10d, %r11d
jbe 0x27ca3
movl %r11d, 0xc(%rdi)
jmp 0x27ca6
incl %r8d
movl %r8d, 0x10(%rdi)
movl %r10d, %r11d
movl (%r9), %r10d
shrl %r10d
leaq (%r9,%r10), %rbx
addq $0x8, %rbx
addq %r10, %r9
addq $0x4, %r9
cmpq %rax, %rbx
cmovaeq %rdx, %r9
movl %r11d, %r10d
jmp 0x27c6f
movl $0x8000, (%rdi)         # imm = 0x8000
imull $0x64, %ecx, %eax
shrl $0xf, %eax
movb $0x64, %sil
movb $0x64, %dl
subb %al, %dl
movb %dl, 0x14(%rdi)
imull $0x64, %r10d, %eax
xorl %edx, %edx
divl %ecx
subb %al, %sil
movb %sil, 0x15(%rdi)
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_ins_head
void * lv_ll_ins_head(lv_ll_t * ll_p)
{
    lv_ll_node_t * n_new;

    n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);

    if(n_new != NULL) {
        node_set_prev(ll_p, n_new, NULL);       /*No prev. before the new head*/
        node_set_next(ll_p, n_new, ll_p->head); /*After new comes the old head*/

        if(ll_p->head != NULL) { /*If there is old head then before it goes the new*/
            node_set_prev(ll_p, ll_p->head, n_new);
        }

        ll_p->head = n_new;      /*Set the new head in the dsc.*/
        if(ll_p->tail == NULL) { /*If there is no tail (1. node) set the tail too*/
            ll_p->tail = n_new;
        }
    }

    return n_new;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
addq $0x10, %rdi
callq 0x279f9
testq %rax, %rax
je 0x27d44
movl (%rbx), %ecx
andq $0x0, (%rax,%rcx)
movq 0x8(%rbx), %rcx
movl (%rbx), %edx
movq %rcx, 0x8(%rax,%rdx)
movq 0x8(%rbx), %rcx
testq %rcx, %rcx
je 0x27d35
movl (%rbx), %edx
movq %rax, (%rcx,%rdx)
movq %rax, 0x8(%rbx)
cmpq $0x0, 0x10(%rbx)
jne 0x27d44
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_ins_prev
void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
{
    lv_ll_node_t * n_new;
    lv_ll_node_t * n_prev;

    if(NULL == ll_p || NULL == n_act) return NULL;

    if(lv_ll_get_head(ll_p) == n_act) {
        n_new = lv_ll_ins_head(ll_p);
        if(n_new == NULL) return NULL;
    } else {
        n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
        if(n_new == NULL) return NULL;

        n_prev = lv_ll_get_prev(ll_p, n_act);
        node_set_next(ll_p, n_prev, n_new);
        node_set_prev(ll_p, n_new, n_prev);
        node_set_prev(ll_p, n_act, n_new);
        node_set_next(ll_p, n_new, n_act);
    }

    return n_new;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x27d5e
xorl %eax, %eax
jmp 0x27da2
movq %rsi, %rbx
movq %rdi, %r14
cmpq %rsi, 0x8(%rdi)
je 0x27daa
movl (%r14), %edi
addq $0x10, %rdi
callq 0x279f9
testq %rax, %rax
je 0x27d5a
movl (%r14), %ecx
movq (%rbx,%rcx), %rdx
testq %rdx, %rdx
je 0x27d8f
movq %rax, 0x8(%rdx,%rcx)
movl (%r14), %ecx
movq %rdx, (%rax,%rcx)
movl (%r14), %ecx
movq %rax, (%rbx,%rcx)
movl (%r14), %ecx
movq %rbx, 0x8(%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x27d00
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_ins_tail
void * lv_ll_ins_tail(lv_ll_t * ll_p)
{
    lv_ll_node_t * n_new;

    n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
    if(n_new == NULL) return NULL;

    if(n_new != NULL) {
        node_set_next(ll_p, n_new, NULL);       /*No next after the new tail*/
        node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is tho old tail*/
        if(ll_p->tail != NULL) {                /*If there is old tail then the new comes after it*/
            node_set_next(ll_p, ll_p->tail, n_new);
        }

        ll_p->tail = n_new;      /*Set the new tail in the dsc.*/
        if(ll_p->head == NULL) { /*If there is no head (1. node) set the head too*/
            ll_p->head = n_new;
        }
    }

    return n_new;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
addq $0x10, %rdi
callq 0x279f9
testq %rax, %rax
je 0x27e1a
movl (%rbx), %ecx
andq $0x0, 0x8(%rax,%rcx)
movq 0x10(%rbx), %rcx
movl (%rbx), %edx
movq %rcx, (%rax,%rdx)
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x27e0b
movl (%rbx), %edx
movq %rax, 0x8(%rcx,%rdx)
movq %rax, 0x10(%rbx)
cmpq $0x0, 0x8(%rbx)
jne 0x27e1a
movq %rax, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_rem
void lv_ll_rem(lv_ll_t * ll_p, void * node_p)
{
    if(lv_ll_get_head(ll_p) == node_p) {
        /*The new head will be the node after 'n_act'*/
        ll_p->head = lv_ll_get_next(ll_p, node_p);
        if(ll_p->head == NULL) {
            ll_p->tail = NULL;
        } else {
            node_set_prev(ll_p, ll_p->head, NULL);
        }
    } else if(lv_ll_get_tail(ll_p) == node_p) {
        /*The new tail will be the  node before 'n_act'*/
        ll_p->tail = lv_ll_get_prev(ll_p, node_p);
        if(ll_p->tail == NULL) {
            ll_p->head = NULL;
        } else {
            node_set_next(ll_p, ll_p->tail, NULL);
        }
    } else {
        lv_ll_node_t * n_prev = lv_ll_get_prev(ll_p, node_p);
        lv_ll_node_t * n_next = lv_ll_get_next(ll_p, node_p);

        node_set_next(ll_p, n_prev, n_next);
        node_set_prev(ll_p, n_next, n_prev);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x27e44
cmpq %rsi, 0x8(%rdi)
je 0x27e4a
movl (%rdi), %edx
movq (%rsi,%rdx), %rax
cmpq %rsi, 0x10(%rdi)
je 0x27e60
movq 0x8(%rsi,%rdx), %rcx
testq %rax, %rax
je 0x27e7f
movq %rcx, 0x8(%rax,%rdx)
jmp 0x27e81
testq %rsi, %rsi
je 0x27e70
retq
movl (%rdi), %eax
movq 0x8(%rsi,%rax), %rcx
movq %rcx, 0x8(%rdi)
testq %rcx, %rcx
je 0x27e79
andq $0x0, (%rcx,%rax)
retq
movq %rax, 0x10(%rdi)
testq %rax, %rax
je 0x27e8d
andq $0x0, 0x8(%rax,%rdx)
retq
andq $0x0, 0x8
andq $0x0, 0x10(%rdi)
retq
xorl %eax, %eax
testq %rcx, %rcx
je 0x27e49
movl (%rdi), %edx
movq %rax, (%rcx,%rdx)
retq
andq $0x0, 0x8(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_clear
void lv_ll_clear(lv_ll_t * ll_p)
{
    void * i;
    void * i_next;

    i      = lv_ll_get_head(ll_p);
    i_next = NULL;

    while(i != NULL) {
        i_next = lv_ll_get_next(ll_p, i);

        lv_ll_rem(ll_p, i);
        lv_mem_free(i);

        i = i_next;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
je 0x27ec3
movq 0x8(%rbx), %r14
jmp 0x27eef
xorl %r14d, %r14d
jmp 0x27eef
testq %rbx, %rbx
je 0x27ed6
movl (%rbx), %eax
movq 0x8(%r14,%rax), %r15
jmp 0x27ed9
xorl %r15d, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27e1c
movq %r14, %rdi
callq 0x27a7a
movq %r15, %r14
testq %r14, %r14
jne 0x27ec8
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_chg_list
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head)
{
    lv_ll_rem(ll_ori_p, node);

    if(head) {
        /*Set node as head*/
        node_set_prev(ll_new_p, node, NULL);
        node_set_next(ll_new_p, node, ll_new_p->head);

        if(ll_new_p->head != NULL) { /*If there is old head then before it goes the new*/
            node_set_prev(ll_new_p, ll_new_p->head, node);
        }

        ll_new_p->head = node;       /*Set the new head in the dsc.*/
        if(ll_new_p->tail == NULL) { /*If there is no tail (first node) set the tail too*/
            ll_new_p->tail = node;
        }
    } else {
        /*Set node as tail*/
        node_set_prev(ll_new_p, node, ll_new_p->tail);
        node_set_next(ll_new_p, node, NULL);

        if(ll_new_p->tail != NULL) { /*If there is old tail then after it goes the new*/
            node_set_next(ll_new_p, ll_new_p->tail, node);
        }

        ll_new_p->tail = node;       /*Set the new tail in the dsc.*/
        if(ll_new_p->head == NULL) { /*If there is no head (first node) set the head too*/
            ll_new_p->head = node;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdx, %rsi
callq 0x27e1c
testl %ebp, %ebp
je 0x27f31
testq %rbx, %rbx
je 0x27f6c
movl (%r14), %eax
andq $0x0, (%rbx,%rax)
leaq 0x8(%r14), %rax
movq 0x8(%r14), %rcx
movl (%r14), %edx
movq %rcx, 0x8(%rbx,%rdx)
jmp 0x27f70
movq 0x10(%r14), %rax
testq %rbx, %rbx
je 0x27f4e
movl (%r14), %ecx
movq %rax, (%rbx,%rcx)
movl (%r14), %eax
andq $0x0, 0x8(%rbx,%rax)
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x27f5b
movl (%r14), %ecx
movq %rbx, 0x8(%rax,%rcx)
movq %rbx, 0x10(%r14)
cmpq $0x0, 0x8(%r14)
jne 0x27f91
addq $0x8, %r14
jmp 0x27f8e
leaq 0x8(%r14), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x27f7f
movl (%r14), %ecx
movq %rbx, (%rax,%rcx)
movq %rbx, 0x8(%r14)
cmpq $0x0, 0x10(%r14)
jne 0x27f91
addq $0x10, %r14
movq %rbx, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_get_len
uint32_t lv_ll_get_len(const lv_ll_t * ll_p)
{
    uint32_t len = 0;
    void * node;

    for(node = lv_ll_get_head(ll_p); node != NULL; node = lv_ll_get_next(ll_p, node)) {
        len++;
    }

    return len;
}

// Assembly:
xorl %eax, %eax
testq %rdi, %rdi
je 0x27fa3
movq 0x8(%rdi), %rcx
jmp 0x27fb9
xorl %ecx, %ecx
jmp 0x27fb9
testq %rdi, %rdi
je 0x27fb5
movl (%rdi), %edx
movq 0x8(%rcx,%rdx), %rcx
jmp 0x27fb7
xorl %ecx, %ecx
incl %eax
testq %rcx, %rcx
jne 0x27fa7
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_ll.c
// Function: lv_ll_move_before
void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
{
    if(n_act == n_after) return; /*Can't move before itself*/

    void * n_before;
    if(n_after != NULL)
        n_before = lv_ll_get_prev(ll_p, n_after);
    else
        n_before = lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/

    if(n_act == n_before) return; /*Already before `n_after`*/

    /*It's much easier to remove from the list and add again*/
    lv_ll_rem(ll_p, n_act);

    /*Add again by setting the prev. and next nodes*/
    node_set_next(ll_p, n_before, n_act);
    node_set_prev(ll_p, n_act, n_before);
    node_set_prev(ll_p, n_after, n_act);
    node_set_next(ll_p, n_act, n_after);

    /*If `n_act` was moved before NULL then it become the new tail*/
    if(n_after == NULL) ll_p->tail = n_act;

    /*If `n_act` was moved before `NULL` then it's the new head*/
    if(n_before == NULL) ll_p->head = n_act;
}

// Assembly:
cmpq %rdx, %rsi
je 0x28059
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x27fec
testq %r14, %r14
je 0x27ff7
movl (%r14), %eax
movq (%r15,%rax), %r12
jmp 0x27ffa
testq %r14, %r14
je 0x27ff7
movq 0x10(%r14), %r12
jmp 0x27ffa
xorl %r12d, %r12d
cmpq %rbx, %r12
je 0x2804e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x27e1c
testq %r12, %r12
je 0x28017
movl (%r14), %eax
movq %rbx, 0x8(%r12,%rax)
testq %rbx, %rbx
je 0x28023
movl (%r14), %eax
movq %r12, (%rbx,%rax)
testq %r15, %r15
je 0x2802f
movl (%r14), %eax
movq %rbx, (%r15,%rax)
testq %rbx, %rbx
je 0x2803c
movl (%r14), %eax
movq %r15, 0x8(%rbx,%rax)
testq %r15, %r15
jne 0x28045
movq %rbx, 0x10(%r14)
testq %r12, %r12
jne 0x2804e
movq %rbx, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_color.c
// Function: lv_color_hsv_to_rgb
lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v)
{
    h = (uint32_t)((uint32_t)h * 255) / 360;
    s = (uint16_t)((uint16_t)s * 255) / 100;
    v = (uint16_t)((uint16_t)v * 255) / 100;

    uint8_t r, g, b;

    uint8_t region, remainder, p, q, t;

    if(s == 0) {
        r = v;
        g = v;
        b = v;
        return lv_color_make(v, v, v);
    }

    region    = h / 43;
    remainder = (h - (region * 43)) * 6;

    p = (v * (255 - s)) >> 8;
    q = (v * (255 - ((s * remainder) >> 8))) >> 8;
    t = (v * (255 - ((s * (255 - remainder)) >> 8))) >> 8;

    switch(region) {
        case 0:
            r = v;
            g = t;
            b = p;
            break;
        case 1:
            r = q;
            g = v;
            b = p;
            break;
        case 2:
            r = p;
            g = v;
            b = t;
            break;
        case 3:
            r = p;
            g = q;
            b = v;
            break;
        case 4:
            r = t;
            g = p;
            b = v;
            break;
        default:
            r = v;
            g = p;
            b = q;
            break;
    }

    lv_color_t result = lv_color_make(r, g, b);
    return result;
}

// Assembly:
movl %edx, %ecx
imull $0xff, %esi, %eax
movw $0x64, %r8w
xorl %edx, %edx
divw %r8w
movl %eax, %esi
imull $0xff, %ecx, %eax
xorl %edx, %edx
divw %r8w
movl %eax, %ecx
andw $0xff, %si
je 0x28135
movzwl %si, %r8d
movzwl %di, %eax
imull $0xff, %eax, %esi
movl $0x168, %edi            # imm = 0x168
movl %esi, %eax
xorl %edx, %edx
divl %edi
movl %eax, %edi
movl $0x3c78, %r9d           # imm = 0x3C78
movl %esi, %eax
xorl %edx, %edx
divl %r9d
imull $0xd5, %eax, %edx
addl %edi, %edx
imull $0x6, %edx, %edi
movl $0xff, %r9d
movl %ecx, %r10d
andl %r9d, %r10d
movl %r8d, %edx
xorl %r9d, %edx
imull %r10d, %edx
shrl $0x8, %edx
andl %r9d, %edi
movl %edi, %esi
imull %r8d, %esi
shrl $0x8, %esi
xorl %r9d, %esi
imull %r10d, %esi
shrl $0x8, %esi
cmpb $0x4, %al
ja 0x2815e
xorl %r9d, %edi
imull %r8d, %edi
shrl $0x8, %edi
xorl %r9d, %edi
imull %r10d, %edi
shrl $0x8, %edi
andl %r9d, %eax
leaq 0x16e57(%rip), %r8      # 0x3ef7c
movslq (%r8,%rax,4), %rax
addq %r8, %rax
jmpq *%rax
movl %edi, %eax
movl %edx, %r8d
jmp 0x28163
movzbl %cl, %edi
movl %edi, %esi
movl %edi, %edx
jmp 0x28172
movl %edx, %eax
movl %ecx, %r8d
movl %edi, %esi
jmp 0x28165
movl %ecx, %eax
movl %edi, %r8d
jmp 0x28153
movl %esi, %eax
movl %ecx, %r8d
movl %edx, %esi
jmp 0x28165
movl %ecx, %eax
movl %edx, %r8d
jmp 0x28165
movl %edx, %eax
movl %esi, %r8d
movl %ecx, %esi
movzbl %sil, %edi
movzbl %al, %esi
movzbl %r8b, %edx
jmp 0x28172
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_color.c
// Function: lv_color_rgb_to_hsv
lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8)
{
    uint16_t r = ((uint32_t)r8 << 10) / 255;
    uint16_t g = ((uint32_t)g8 << 10) / 255;
    uint16_t b = ((uint32_t)b8 << 10) / 255;

    uint16_t rgbMin = r < g ? (r < b ? r : b) : (g < b ? g : b);
    uint16_t rgbMax = r > g ? (r > b ? r : b) : (g > b ? g : b);

    lv_color_hsv_t hsv;

    // https://en.wikipedia.org/wiki/HSL_and_HSV#Lightness
    hsv.v = (100 * rgbMax) >> 10;

    int32_t delta = rgbMax - rgbMin;
    if (LV_MATH_ABS(delta) < 3) {
        hsv.h = 0;
        hsv.s = 0;
        return hsv;
    }

    // https://en.wikipedia.org/wiki/HSL_and_HSV#Saturation
    hsv.s = 100 * delta / rgbMax;
    if(hsv.s < 3) {
        hsv.h = 0;
        return hsv;
    }

    // https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma
    int32_t h;
    if(rgbMax == r)
        h = (((g - b) << 10) / delta) + (g < b ? (6 << 10) : 0); // between yellow & magenta
    else if(rgbMax == g)
        h = (((b - r) << 10) / delta) + (2 << 10); // between cyan & yellow
    else if(rgbMax == b)
        h = (((r - g) << 10) / delta) + (4 << 10); // between magenta & cyan
    else
        h = 0;
    h *= 60;
    h >>= 10;
    if (h < 0) h += 360;

    hsv.h = h;
    return hsv;
}

// Assembly:
pushq %rbp
pushq %rbx
movl %edx, %ecx
movl %edi, %eax
shll $0xa, %eax
xorl %r11d, %r11d
movl $0xff, %r9d
xorl %edx, %edx
divl %r9d
movl %eax, %edi
shll $0xa, %esi
movl %esi, %eax
xorl %edx, %edx
divl %r9d
movl %eax, %r8d
shll $0xa, %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %r9d
movl %eax, %esi
movl %edi, %r9d
subl %r8d, %r9d
movl %r8d, %eax
cmovbl %edi, %eax
movl %r8d, %ebp
cmoval %edi, %ebp
cmpl %esi, %eax
cmovael %esi, %eax
cmpl %esi, %ebp
movl %esi, %r10d
cmoval %ebp, %r10d
movl %r10d, %ebx
subl %eax, %ebx
movl %ebx, %eax
negl %eax
cmovsl %ebx, %eax
cmpl $0x3, %eax
jae 0x281fa
xorl %ecx, %ecx
jmp 0x2826b
imull $0x64, %ebx, %eax
cltd
idivl %r10d
movl %eax, %ecx
movzbl %cl, %eax
cmpl $0x3, %eax
jb 0x2826b
cmpl %edi, %r10d
jne 0x2822b
movl %r8d, %eax
subl %esi, %eax
shll $0xa, %eax
cltd
idivl %ebx
movl %eax, %edx
leal 0x1800(%rdx), %eax
cmpl %esi, %r8d
cmovael %edx, %eax
jmp 0x28256
cmpl %r8d, %r10d
jne 0x28241
subl %edi, %esi
shll $0xa, %esi
movl %esi, %eax
cltd
idivl %ebx
addl $0x800, %eax            # imm = 0x800
jmp 0x28256
xorl %eax, %eax
cmpl %ebp, %esi
jb 0x28256
shll $0xa, %r9d
movl %r9d, %eax
cltd
idivl %ebx
addl $0x1000, %eax           # imm = 0x1000
imull $0x3c, %eax, %eax
sarl $0xa, %eax
leal 0x168(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
movzwl %dx, %r11d
imull $0x190000, %r10d, %edx  # imm = 0x190000
andl $0x7f000000, %edx       # imm = 0x7F000000
orl %r11d, %edx
movzbl %cl, %eax
shll $0x10, %eax
orl %edx, %eax
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_utf8_size
static uint8_t lv_txt_utf8_size(const char * str)
{
    if((str[0] & 0x80) == 0)
        return 1;
    else if((str[0] & 0xE0) == 0xC0)
        return 2;
    else if((str[0] & 0xF0) == 0xE0)
        return 3;
    else if((str[0] & 0xF8) == 0xF0)
        return 4;
    return 0; /*If the char was invalid tell it's 1 byte long*/
}

// Assembly:
movzbl (%rdi), %ecx
movb $0x1, %al
testb %cl, %cl
js 0x282e2
retq
movl %ecx, %edx
andl $-0x20, %edx
movb $0x2, %al
cmpl $0xc0, %edx
je 0x282e1
movl %ecx, %edx
andl $-0x10, %edx
movb $0x3, %al
cmpl $0xe0, %edx
je 0x282e1
andl $-0x8, %ecx
cmpl $0xf0, %ecx
sete %al
shlb $0x2, %al
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_unicode_to_utf8
static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni)
{
    if(letter_uni < 128) return letter_uni;
    uint8_t bytes[4];

    if(letter_uni < 0x0800) {
        bytes[0] = ((letter_uni >> 6) & 0x1F) | 0xC0;
        bytes[1] = ((letter_uni >> 0) & 0x3F) | 0x80;
        bytes[2] = 0;
        bytes[3] = 0;
    } else if(letter_uni < 0x010000) {
        bytes[0] = ((letter_uni >> 12) & 0x0F) | 0xE0;
        bytes[1] = ((letter_uni >> 6) & 0x3F) | 0x80;
        bytes[2] = ((letter_uni >> 0) & 0x3F) | 0x80;
        bytes[3] = 0;
    } else if(letter_uni < 0x110000) {
        bytes[0] = ((letter_uni >> 18) & 0x07) | 0xF0;
        bytes[1] = ((letter_uni >> 12) & 0x3F) | 0x80;
        bytes[2] = ((letter_uni >> 6) & 0x3F) | 0x80;
        bytes[3] = ((letter_uni >> 0) & 0x3F) | 0x80;
    }

    uint32_t * res_p = (uint32_t *)bytes;
    return *res_p;
}

// Assembly:
movl %edi, %eax
cmpl $0x80, %edi
jb 0x283c3
cmpl $0x7ff, %eax            # imm = 0x7FF
ja 0x28340
movl %eax, %ecx
shrl $0x6, %ecx
orl $0xc0, %ecx
andl $0x3f, %eax
orl $0x80, %eax
xorl %edi, %edi
xorl %esi, %esi
movl %eax, %edx
jmp 0x283b5
cmpl $0xffff, %eax           # imm = 0xFFFF
ja 0x2836c
movl %eax, %ecx
shrl $0xc, %ecx
orl $0xe0, %ecx
movl %eax, %edx
shrl $0x6, %edx
andl $0x3f, %edx
movl $0x80, %esi
orl %esi, %edx
andl $0x3f, %eax
orl %esi, %eax
xorl %edi, %edi
movl %eax, %esi
jmp 0x283b5
xorl %edi, %edi
movl $0x0, %esi
movl $0x0, %edx
movl $0x0, %ecx
cmpl $0x10ffff, %eax         # imm = 0x10FFFF
ja 0x283b5
movl %eax, %ecx
shrl $0x12, %ecx
orl $0xf0, %ecx
movl %eax, %edx
shrl $0xc, %edx
andl $0x3f, %edx
movl $0x80, %edi
orl %edi, %edx
movl %eax, %esi
shrl $0x6, %esi
andl $0x3f, %esi
orl %edi, %esi
andl $0x3f, %eax
shll $0x18, %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, %edi
shll $0x10, %esi
orl %edi, %esi
shll $0x8, %edx
orl %esi, %edx
orl %ecx, %edx
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_utf8_prev
static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i)
{
    uint8_t c_size;
    uint8_t cnt = 0;

    /*Try to find a !0 long UTF-8 char by stepping one character back*/
    (*i)--;
    do {
        if(cnt >= 4) return 0; /*No UTF-8 char found before the initial*/

        c_size = lv_txt_encoded_size(&txt[*i]);
        if(c_size == 0) {
            if(*i != 0)
                (*i)--;
            else
                return 0;
        }
        cnt++;
    } while(c_size == 0);

    uint32_t i_tmp  = *i;
    uint32_t letter = lv_txt_encoded_next(txt, &i_tmp); /*Character found, get it*/

    return letter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl (%rsi), %eax
decl %eax
movl %eax, (%rsi)
movb $0x4, %r15b
xorl %ebp, %ebp
subb $0x1, %r15b
jb 0x28658
movl %eax, %edi
addq %rbx, %rdi
callq *0x28fe7(%rip)          # 0x51618
testb %al, %al
jne 0x28643
movl (%r14), %eax
testl %eax, %eax
je 0x28658
decl %eax
movl %eax, (%r14)
jmp 0x28620
movl (%r14), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq *0x28fda(%rip)          # 0x51630
movl %eax, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_utf8_get_byte_id
static uint32_t lv_txt_utf8_get_byte_id(const char * txt, uint32_t utf8_id)
{
    uint32_t i;
    uint32_t byte_cnt = 0;
    for(i = 0; i < utf8_id; i++) {
        uint8_t c_size = lv_txt_encoded_size(&txt[byte_cnt]);
        byte_cnt += c_size > 0 ? c_size : 1;
    }

    return byte_cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
xorl %ebp, %ebp
pushq $0x1
popq %r15
subl $0x1, %ebx
jb 0x28697
movl %ebp, %edi
addq %r14, %rdi
callq *0x28f91(%rip)          # 0x51618
movzbl %al, %eax
cmpb $0x2, %al
cmovbl %r15d, %eax
movzbl %al, %eax
addl %eax, %ebp
jmp 0x28677
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_utf8_get_char_id
static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id)
{
    uint32_t i        = 0;
    uint32_t char_cnt = 0;

    while(i < byte_id) {
        lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/
        char_cnt++;
    }

    return char_cnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4(%rsp), %rbx
andl $0x0, (%rbx)
movl %esi, %ebp
movq %rdi, %r14
xorl %eax, %eax
xorl %r15d, %r15d
cmpl %ebp, %eax
jae 0x286d6
movq %r14, %rdi
movq %rbx, %rsi
callq *0x28f63(%rip)          # 0x51630
incl %r15d
movl 0x4(%rsp), %eax
jmp 0x286bd
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_utf8_get_length
static uint32_t lv_txt_utf8_get_length(const char * txt)
{
    uint32_t len = 0;
    uint32_t i   = 0;

    while(txt[i] != '\0') {
        lv_txt_encoded_next(txt, &i);
        len++;
    }

    return len;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rbx
andl $0x0, (%rbx)
movq %rdi, %r14
xorl %eax, %eax
xorl %ebp, %ebp
movl %eax, %eax
cmpb $0x0, (%r14,%rax)
je 0x28718
movq %r14, %rdi
movq %rbx, %rsi
callq *0x28f20(%rip)          # 0x51630
incl %ebp
movl 0xc(%rsp), %eax
jmp 0x286fb
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_get_width
lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
                            lv_txt_flag_t flag)
{
    if(txt == NULL) return 0;
    if(font == NULL) return 0;

    uint32_t i                   = 0;
    lv_coord_t width             = 0;
    lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
    uint32_t letter;
    uint32_t letter_next;

    if(length != 0) {
        while(i < length) {
            letter      = lv_txt_encoded_next(txt, &i);
            letter_next = lv_txt_encoded_next(&txt[i], NULL);
            if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
                if(lv_txt_is_cmd(&cmd_state, letter) != false) {
                    continue;
                }
            }

            lv_coord_t char_width = lv_font_get_glyph_width(font, letter, letter_next);
            if(char_width > 0) {
                width += char_width;
                width += letter_space;
            }
        }

        if(width > 0) {
            width -= letter_space; /*Trim the last letter space. Important if the text is center
                                      aligned */
        }
    }

    return width;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r12
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %dil
orb %al, %dil
jne 0x28c76
andl $0x0, 0xc(%rsp)
movb $0x0, 0xb(%rsp)
testw %si, %si
je 0x28c76
movl %r8d, %ebp
movq %rdx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movzwl %si, %ebx
movq $0x0, 0x10(%rsp)
leaq 0xc(%rsp), %r13
cmpl %ebx, 0xc(%rsp)
jae 0x28c7a
movq %r12, %rdi
movq %r13, %rsi
callq *0x28a13(%rip)          # 0x51630
movl %eax, %r15d
movl 0xc(%rsp), %edi
addq %r12, %rdi
xorl %esi, %esi
callq *0x28a01(%rip)          # 0x51630
movl %eax, %r14d
testb $0x1, %bpl
je 0x28c49
leaq 0xb(%rsp), %rdi
movl %r15d, %esi
callq 0x28c9d
testb %al, %al
jne 0x28c0b
movq 0x20(%rsp), %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x2603b
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rdx
addl %edx, %ecx
addl %eax, %ecx
testw %ax, %ax
cmovlel %edx, %ecx
movl %ecx, %eax
movq %rax, 0x10(%rsp)
jmp 0x28c0b
xorl %eax, %eax
jmp 0x28c8e
xorl %edx, %edx
movq 0x10(%rsp), %rax
testw %ax, %ax
movq 0x18(%rsp), %rcx
cmovlel %edx, %ecx
subl %ecx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_ins
void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
{
    size_t old_len = strlen(txt_buf);
    size_t ins_len = strlen(ins_txt);
    size_t new_len = ins_len + old_len;
    pos              = lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/

    /*Copy the second part into the end to make place to text to insert*/
    size_t i;
    for(i = new_len; i >= pos + ins_len; i--) {
        txt_buf[i] = txt_buf[i - ins_len];
    }

    /* Copy the text into the new space*/
    memcpy(txt_buf + pos, ins_txt, ins_len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
callq 0x2070
movq %rax, %r15
movq %rbx, %rdi
callq 0x2070
movq %rax, %r12
movq %r14, %rdi
movl %ebp, %esi
callq *0x28944(%rip)          # 0x51640
movl %eax, %eax
leaq (%r12,%rax), %rcx
leaq (%r14,%r12), %rdx
leaq (%r12,%r15), %rsi
cmpq %rcx, %rsi
jb 0x28d1c
movb (%r14,%r15), %sil
movb %sil, (%rdx,%r15)
decq %r15
jmp 0x28d06
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20f0
// File: /workspace/github_c_makefile_star2_O2/OnionIoT[P]lv_example/lvgl/src/lv_misc/lv_txt.c
// Function: lv_txt_cut
void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
{

    size_t old_len = strlen(txt);

    pos = lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/
    len = lv_txt_encoded_get_byte_id(&txt[pos], len);

    /*Copy the second part into the end to make place to text to insert*/
    uint32_t i;
    for(i = pos; i <= old_len - len; i++) {
        txt[i] = txt[i + len];
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %rbx
callq 0x2070
movq %rax, %r14
movq %rbx, %rdi
movl %ebp, %esi
callq *0x288e9(%rip)          # 0x51640
movl %eax, %ebp
movl %eax, %edi
addq %rbx, %rdi
movl %r15d, %esi
callq *0x288d9(%rip)          # 0x51640
movl %eax, %ecx
subq %rcx, %r14
movl %ebp, %ecx
cmpq %rcx, %r14
jb 0x28d81
leal (%rax,%rcx), %edx
movb (%rbx,%rdx), %dl
movb %dl, (%rbx,%rcx)
leal 0x1(%rcx), %ebp
jmp 0x28d6c
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq