LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw.c
// Function: lv_draw_aa_hor_seg
void lv_draw_aa_hor_seg(lv_coord_t x, lv_coord_t y, lv_coord_t length, const lv_area_t * mask, lv_color_t color,
                        lv_opa_t opa)
{
    bool aa_inv = false;
    if(length < 0) {
        aa_inv = true;
        length = -length;
    }

    lv_coord_t i;
    for(i = 0; i < length; i++) {
        lv_opa_t px_opa = lv_draw_aa_get_opa(length, i, opa);
        if(aa_inv) px_opa = opa - px_opa;
        lv_draw_px(x + i, y, mask, color, px_opa);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0x4(%rsp)
movq %rcx, 0x10(%rsp)
movl %edx, %ebp
movq %rdi, 0x8(%rsp)
movl %ebp, %r15d
negw %r15w
cmovsw %bp, %r15w
testw %r15w, %r15w
jle 0x36956
xorl %r12d, %r12d
movswl %r15w, %r13d
movzbl %r9b, %ebx
movswl %si, %r14d
movswl %r12w, %r12d
movl %r13d, %edi
movl %r12d, %esi
movl %ebx, %edx
callq 0x367eb
movl %ebx, %ecx
subb %al, %cl
testw %bp, %bp
movzbl %al, %eax
movzbl %cl, %ecx
cmovnsl %eax, %ecx
movq 0x8(%rsp), %rax
addl %r12d, %eax
movzbl %cl, %r8d
movswl %ax, %edi
movl %r14d, %esi
movq 0x10(%rsp), %rdx
movl 0x4(%rsp), %ecx
callq 0x35638
incl %r12d
cmpw %r12w, %r15w
jne 0x3690c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_rect.c
// Function: lv_draw_cont_radius_corr
static uint16_t lv_draw_cont_radius_corr(uint16_t r, lv_coord_t w, lv_coord_t h)
{
    bool aa = lv_disp_get_antialiasing(lv_refr_get_disp_refreshing());

    if(r >= (w >> 1)) {
        r = (w >> 1);
        if(r != 0) r--;
    }
    if(r >= (h >> 1)) {
        r = (h >> 1);
        if(r != 0) r--;
    }

    if(r > 0) r -= aa;

    return r;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %r14d
callq 0x7293
movq %rax, %rdi
callq 0x8595
movl %ebp, %ecx
shrl %ecx
movl %ebp, %edx
sarl %edx
cmpw $0x2, %bp
adcw $-0x1, %cx
cmpl %edx, %r14d
cmovll %r14d, %ecx
movl %ebx, %edx
shrl %edx
movl %ebx, %esi
sarl %esi
cmpw $0x2, %bx
adcw $-0x1, %dx
movzwl %cx, %edi
cmpl %esi, %edi
cmovll %ecx, %edx
movzbl %al, %eax
movl %edx, %ecx
subl %eax, %ecx
xorl %eax, %eax
testw %dx, %dx
cmovnel %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_rect.c
// Function: antialias_get_opa_circ
static lv_opa_t antialias_get_opa_circ(lv_coord_t seg, lv_coord_t px_id, lv_opa_t opa)
{
    /*Empirical non-linear values anti-aliasing values*/
    static const lv_opa_t opa_map2[2] = {210, 80};
    static const lv_opa_t opa_map3[3] = {230, 150, 60};
    static const lv_opa_t opa_map4[4] = {235, 185, 125, 50};
    static const lv_opa_t opa_map8[8] = {250, 242, 219, 191, 158, 117, 76, 40};

#if CIRCLE_AA_NON_LINEAR_OPA_THRESHOLD < 1
    if(seg == 1) return 170;
#endif

#if CIRCLE_AA_NON_LINEAR_OPA_THRESHOLD < 2
    if(seg == 2) return (opa_map2[px_id] * opa) >> 8;
#endif

#if CIRCLE_AA_NON_LINEAR_OPA_THRESHOLD < 3
    if(seg == 3) return (opa_map3[px_id] * opa) >> 8;
#endif

#if CIRCLE_AA_NON_LINEAR_OPA_THRESHOLD < 4
    if(seg == 4) return (opa_map4[px_id] * opa) >> 8;
#endif

    uint8_t id = (uint32_t)((uint32_t)px_id * (sizeof(opa_map8) - 1)) / (seg - 1);
    return (uint32_t)((uint32_t)opa_map8[id] * opa) >> 8;
}

// Assembly:
movl %edx, %ecx
cmpl $0x4, %edi
je 0x3a56d
cmpl $0x3, %edi
je 0x3a560
cmpl $0x2, %edi
jne 0x3a57a
movswq %si, %rdx
leaq 0x8e96(%rip), %rax      # 0x433f4
jmp 0x3a599
movswq %si, %rdx
leaq 0x8e8b(%rip), %rax      # 0x433f6
jmp 0x3a599
movswq %si, %rdx
leaq 0x8e81(%rip), %rax      # 0x433f9
jmp 0x3a599
movswl %di, %edi
movswl %si, %edx
leal (,%rdx,8), %eax
subl %edx, %eax
decl %edi
xorl %edx, %edx
divl %edi
movzbl %al, %edx
leaq 0x8e64(%rip), %rax      # 0x433fd
addq %rdx, %rax
movzbl (%rax), %edx
movzbl %cl, %eax
imull %edx, %eax
shrl $0x8, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_line.c
// Function: line_init
static void line_init(line_draw_t * line, const lv_point_t * p1, const lv_point_t * p2)
{
    line->p1.x = p1->x;
    line->p1.y = p1->y;
    line->p2.x = p2->x;
    line->p2.y = p2->y;

    line->dx  = LV_MATH_ABS(line->p2.x - line->p1.x);
    line->sx  = line->p1.x < line->p2.x ? 1 : -1;
    line->dy  = LV_MATH_ABS(line->p2.y - line->p1.y);
    line->sy  = line->p1.y < line->p2.y ? 1 : -1;
    line->err = (line->dx > line->dy ? line->dx : -line->dy) / 2;
    line->e2  = 0;
    line->hor = line->dx > line->dy ? true : false; /*Rather horizontal or vertical*/

    line->p_act.x = line->p1.x;
    line->p_act.y = line->p1.y;
}

// Assembly:
movw %si, (%rdi)
movw %dx, 0x2(%rdi)
movswl (%rcx), %r9d
movw %r9w, 0x4(%rdi)
movswl 0x2(%rcx), %r8d
movw %r8w, 0x6(%rdi)
movswl %si, %eax
movl %r9d, %esi
subl %eax, %esi
movl %esi, %ecx
negl %ecx
cmovsl %esi, %ecx
movw %cx, 0xc(%rdi)
xorl %esi, %esi
cmpw %ax, %r9w
setg %sil
leal -0x1(,%rsi,2), %esi
movw %si, 0xe(%rdi)
movswl %dx, %edx
movl %r8d, %esi
subl %edx, %esi
movl %esi, %r9d
negl %r9d
cmovsl %esi, %r9d
movw %r9w, 0x10(%rdi)
xorl %esi, %esi
cmpw %dx, %r8w
setg %sil
leal -0x1(,%rsi,2), %esi
movswl %r9w, %r8d
movl %r8d, %r9d
negl %r9d
cmpw %r8w, %cx
movswl %cx, %ecx
cmovlel %r9d, %ecx
movw %si, 0x12(%rdi)
setg 0x18(%rdi)
movl %ecx, %esi
shrl $0x1f, %esi
addl %ecx, %esi
shrl %esi
movw %si, 0x14(%rdi)
movw $0x0, 0x16(%rdi)
movw %ax, 0x8(%rdi)
movw %dx, 0xa(%rdi)
retq
nop
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_img.c
// Function: lv_img_buf_set_palette
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
{
    if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
       (dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
        LV_LOG_WARN("lv_img_buf_set_px_alpha: invalid 'id'");
        return;
    }

    lv_color32_t c32;
    c32.full      = lv_color_to32(c);
    uint8_t * buf = (uint8_t *)dsc->data;
    memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32));
}

// Assembly:
movl (%rdi), %eax
andl $0x1f, %eax
cmpl $0xb, %eax
sete %cl
cmpb $0x2, %sil
setae %r8b
testb %cl, %r8b
jne 0x3c869
cmpl $0xc, %eax
sete %cl
cmpb $0x4, %sil
setae %r8b
testb %cl, %r8b
jne 0x3c869
cmpl $0xd, %eax
sete %cl
cmpb $0x10, %sil
setae %r8b
cmpl $0xe, %eax
je 0x3c869
andb %cl, %r8b
jne 0x3c869
movzwl %dx, %eax
movl %eax, %ecx
shrl $0xb, %ecx
imull $0x83800, %ecx, %ecx    # imm = 0x83800
shrl $0x5, %eax
andl $0x3f, %eax
andl $0x1f, %edx
imull $0x107, %edx, %edx      # imm = 0x107
addl $0x7, %edx
shrl $0x5, %edx
addl $0x3800, %ecx           # imm = 0x3800
andl $0x1ff0000, %ecx        # imm = 0x1FF0000
addl %edx, %ecx
imull $0x40c, %eax, %eax      # imm = 0x40C
addl $0xc, %eax
andl $0xff00, %eax           # imm = 0xFF00
addl %ecx, %eax
orl $0xff000000, %eax       # imm = 0xFF000000
movq 0x8(%rdi), %rcx
movzbl %sil, %edx
movl %eax, (%rcx,%rdx,4)
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_img.c
// Function: lv_img_buf_alloc
lv_img_dsc_t *lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
{
    /* Allocate image descriptor */
    lv_img_dsc_t *dsc = lv_mem_alloc(sizeof(lv_img_dsc_t));
    if(dsc == NULL)
        return NULL;
    
    memset(dsc, 0, sizeof(lv_img_dsc_t));
    
    /* Get image data size */
    dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
    if(dsc->data_size == 0) {
        lv_mem_free(dsc);
        return NULL;
    }
    
    /* Allocate raw buffer */
    dsc->data = lv_mem_alloc(dsc->data_size);
    if(dsc->data == NULL) {
        lv_mem_free(dsc);
        return NULL;
    }
    memset((uint8_t *)dsc->data, 0, dsc->data_size);
    
    /* Fill in header */
    dsc->header.always_zero = 0;
    dsc->header.w = w;
    dsc->header.h = h;
    dsc->header.cf = cf;
    return dsc;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r15d
movl %edi, %r14d
movl $0x10, %edi
callq 0x29f85
testq %rax, %rax
je 0x3c937
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movswl %r14w, %edi
movswl %r15w, %esi
movzbl %bpl, %edx
callq 0x3c947
movl %eax, 0x4(%rbx)
testl %eax, %eax
je 0x3c92f
movl %eax, %edi
callq 0x29f85
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x3c92f
movl 0x4(%rbx), %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20a0
shll $0xa, %r14d
movl $0x300, %eax            # imm = 0x300
andl (%rbx), %eax
shll $0x15, %r15d
andl $0x1ffc00, %r14d        # imm = 0x1FFC00
orl %eax, %r14d
orl %r15d, %r14d
andb $0x1f, %bpl
movzbl %bpl, %eax
orl %r14d, %eax
movl %eax, (%rbx)
jmp 0x3c939
movq %rbx, %rdi
callq 0x2a006
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_img.c
// Function: lv_img_buf_get_img_size
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
{
    switch(cf) {
        case LV_IMG_CF_TRUE_COLOR: return LV_IMG_BUF_SIZE_TRUE_COLOR(w, h);
        case LV_IMG_CF_TRUE_COLOR_ALPHA: return LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h);
        case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED: return LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h);
        case LV_IMG_CF_ALPHA_1BIT: return LV_IMG_BUF_SIZE_ALPHA_1BIT(w, h);
        case LV_IMG_CF_ALPHA_2BIT: return LV_IMG_BUF_SIZE_ALPHA_2BIT(w, h);
        case LV_IMG_CF_ALPHA_4BIT: return LV_IMG_BUF_SIZE_ALPHA_4BIT(w, h);
        case LV_IMG_CF_ALPHA_8BIT: return LV_IMG_BUF_SIZE_ALPHA_8BIT(w, h);
        case LV_IMG_CF_INDEXED_1BIT: return LV_IMG_BUF_SIZE_INDEXED_1BIT(w, h);
        case LV_IMG_CF_INDEXED_2BIT: return LV_IMG_BUF_SIZE_INDEXED_2BIT(w, h);
        case LV_IMG_CF_INDEXED_4BIT: return LV_IMG_BUF_SIZE_INDEXED_4BIT(w, h);
        case LV_IMG_CF_INDEXED_8BIT: return LV_IMG_BUF_SIZE_INDEXED_8BIT(w, h);
        default: return 0;
    }
}

// Assembly:
addl $-0x4, %edx
cmpl $0xa, %edx
ja 0x3ca17
leaq 0x6b46(%rip), %rax      # 0x434a0
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movswl %di, %ecx
movswl %si, %eax
imull %ecx, %eax
addl %eax, %eax
retq
leal 0x3(%rdi), %eax
testw %di, %di
cmovnsl %edi, %eax
cwtl
sarl $0x2, %eax
incl %eax
movswl %ax, %ecx
movswl %si, %eax
imull %ecx, %eax
addl $0x10, %eax
retq
movzwl %di, %eax
shrl $0xf, %eax
addl %edi, %eax
cwtl
sarl %eax
jmp 0x3ca0b
movswl %di, %eax
movswl %si, %ecx
imull %eax, %ecx
leal (%rcx,%rcx,2), %eax
retq
leal 0x7(%rdi), %eax
testw %di, %di
cmovnsl %edi, %eax
cwtl
sarl $0x3, %eax
incl %eax
movswl %ax, %ecx
movswl %si, %eax
imull %ecx, %eax
addl $0x8, %eax
retq
leal 0x7(%rdi), %eax
testw %di, %di
cmovnsl %edi, %eax
cwtl
sarl $0x3, %eax
jmp 0x3ca0b
movzwl %di, %eax
shrl $0xf, %eax
addl %edi, %eax
cwtl
sarl %eax
incl %eax
movswl %ax, %ecx
movswl %si, %eax
imull %ecx, %eax
addl $0x40, %eax
retq
movswl %di, %ecx
movswl %si, %eax
imull %ecx, %eax
addl $0x400, %eax            # imm = 0x400
retq
movswl %di, %ecx
jmp 0x3ca10
leal 0x3(%rdi), %eax
testw %di, %di
cmovnsl %edi, %eax
cwtl
sarl $0x2, %eax
incl %eax
movswl %ax, %ecx
movswl %si, %eax
imull %ecx, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_img.c
// Function: lv_img_buf_free
void lv_img_buf_free(lv_img_dsc_t *dsc)
{
    if(dsc != NULL) {
        if(dsc->data != NULL)
            lv_mem_free(dsc->data);
        
        lv_mem_free(dsc);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x3ca3a
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3ca31
callq 0x2a006
movq %rbx, %rdi
popq %rbx
jmp 0x2a006
retq
nop
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_triangle.c
// Function: lv_draw_triangle
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale)
{
    /*Return if the triangle is degenerated*/
    if(points[0].x == points[1].x && points[0].y == points[1].y) return;
    if(points[1].x == points[2].x && points[1].y == points[2].y) return;
    if(points[0].x == points[2].x && points[0].y == points[2].y) return;

    if(points[0].x == points[1].x && points[1].x == points[2].x) return;
    if(points[0].y == points[1].y && points[1].y == points[2].y) return;

    lv_opa_t opa = opa_scale == LV_OPA_COVER ? style->body.opa : (uint16_t)((uint16_t)style->body.opa * opa_scale) >> 8;

    /*Is the triangle flat or tall?*/
    lv_coord_t x_min = LV_MATH_MIN(LV_MATH_MIN(points[0].x, points[1].x), points[2].x);
    lv_coord_t x_max = LV_MATH_MAX(LV_MATH_MAX(points[0].x, points[1].x), points[2].x);
    lv_coord_t y_min = LV_MATH_MIN(LV_MATH_MIN(points[0].y, points[1].y), points[2].y);
    lv_coord_t y_max = LV_MATH_MAX(LV_MATH_MAX(points[0].y, points[1].y), points[2].y);

    /* Draw the tall rectangles from vertical lines
     * and from the flat triangles from horizontal lines
     * to minimize the number of lines.
     * Some pixels are overdrawn on the common edges of the triangles
     * so use it only if the triangle has no opacity*/

    /* Draw from horizontal lines*/
    if(x_max - x_min < y_max - y_min) {
        tri_draw_tall(points, mask, style, opa);
    }
    /*Else flat so draw from vertical lines*/
    else {
        tri_draw_flat(points, mask, style, opa);
    }
}

// Assembly:
movzwl (%rdi), %r8d
movzwl 0x4(%rdi), %eax
cmpw %ax, %r8w
jne 0x3d1fa
movzwl 0x2(%rdi), %r9d
cmpw 0x6(%rdi), %r9w
je 0x3d23b
movzwl 0x8(%rdi), %r10d
cmpw %r10w, %ax
jne 0x3d211
movzwl 0x6(%rdi), %r9d
cmpw 0xa(%rdi), %r9w
je 0x3d23b
movzwl 0x2(%rdi), %r11d
cmpw %r10w, %r8w
jne 0x3d229
cmpw %r10w, %ax
je 0x3d23b
cmpw 0xa(%rdi), %r11w
je 0x3d23b
movzwl 0x6(%rdi), %r9d
cmpw %r9w, %r11w
jne 0x3d23c
cmpw 0xa(%rdi), %r11w
jne 0x3d23c
retq
pushq %rbx
cmpb $-0x1, %cl
je 0x3d251
movzbl %cl, %ebx
movzbl 0x8(%rdx), %ecx
imull %ebx, %ecx
shrl $0x8, %ecx
jmp 0x3d254
movb 0x8(%rdx), %cl
cmpw %ax, %r8w
movl %eax, %ebx
cmovll %r8d, %ebx
cmovgl %r8d, %eax
cmpw %r10w, %bx
cmovgel %r10d, %ebx
cmpw %r10w, %ax
cmovlel %r10d, %eax
cmpw %r9w, %r11w
movl %r9d, %r8d
cmovll %r11d, %r8d
cmovgl %r11d, %r9d
movzwl 0xa(%rdi), %r10d
cmpw %r10w, %r8w
cmovgel %r10d, %r8d
cmpw %r10w, %r9w
cmovlel %r10d, %r9d
cwtl
movswl %bx, %r10d
subl %r10d, %eax
movswl %r9w, %r9d
movswl %r8w, %r8d
subl %r8d, %r9d
cmpl %r9d, %eax
popq %rbx
movzbl %cl, %ecx
jl 0x3d2bb
jmp 0x3d679
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_draw_triangle.c
// Function: lv_draw_polygon
void lv_draw_polygon(const lv_point_t * points, uint32_t point_cnt, const lv_area_t * mask, const lv_style_t * style,
                     lv_opa_t opa_scale)
{
    if(point_cnt < 3) return;
    if(points == NULL) return;

    uint32_t i;
    lv_point_t tri[3];
    tri[0].x = points[0].x;
    tri[0].y = points[0].y;
    for(i = 0; i < point_cnt - 1; i++) {
        tri[1].x = points[i].x;
        tri[1].y = points[i].y;
        tri[2].x = points[i + 1].x;
        tri[2].y = points[i + 1].y;
        lv_draw_triangle(tri, mask, style, opa_scale);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
cmpl $0x3, %esi
setb %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x3db0f
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %r12
movl (%rdi), %eax
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
decl %r15d
xorl %r13d, %r13d
movzbl %r8b, %ebp
movq (%r12,%r13,4), %rax
incq %r13
movq %rax, 0x10(%rsp)
leaq 0xc(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x3d1e0
cmpq %r13, %r15
jne 0x3daec
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_init
void lv_img_decoder_init(void)
{
    lv_ll_init(&LV_GC_ROOT(_lv_img_defoder_ll), sizeof(lv_img_decoder_t));

    lv_img_decoder_t * decoder;

    /*Create a decoder for the built in color format*/
    decoder = lv_img_decoder_create();
    if(decoder == NULL) {
        LV_LOG_WARN("lv_img_decoder_init: out of memory");
        LV_ASSERT_MEM(decoder);
        return;
    }

    lv_img_decoder_set_info_cb(decoder, lv_img_decoder_built_in_info);
    lv_img_decoder_set_open_cb(decoder, lv_img_decoder_built_in_open);
    lv_img_decoder_set_read_line_cb(decoder, lv_img_decoder_built_in_read_line);
    lv_img_decoder_set_close_cb(decoder, lv_img_decoder_built_in_close);
}

// Assembly:
pushq %rax
leaq 0x2aa60(%rip), %rdi     # 0x68588
movl $0x20, %esi
callq 0x2a290
callq 0x3db86
testq %rax, %rax
je 0x3db69
leaq 0x88(%rip), %rcx        # 0x3dbcb
movq %rcx, (%rax)
leaq 0x151(%rip), %rcx       # 0x3dc9e
movq %rcx, 0x8(%rax)
leaq 0x41f(%rip), %rcx       # 0x3df77
movq %rcx, 0x10(%rax)
leaq 0x8f0(%rip), %rcx       # 0x3e453
movq %rcx, 0x18(%rax)
jmp 0x3db74
xorl %edi, %edi
callq 0x80e4
testb %al, %al
je 0x3db76
popq %rax
retq
leaq 0x1553(%rip), %rdi      # 0x3f0d0
xorl %esi, %esi
callq 0x8294
jmp 0x3db84
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_create
lv_img_decoder_t * lv_img_decoder_create(void)
{
    lv_img_decoder_t * decoder;
    decoder = lv_ll_ins_head(&LV_GC_ROOT(_lv_img_defoder_ll));
    LV_ASSERT_MEM(decoder);
    if(decoder == NULL) return NULL;

    memset(decoder, 0, sizeof(lv_img_decoder_t));

    return decoder;
}

// Assembly:
pushq %rbx
leaq 0x2a9fa(%rip), %rdi     # 0x68588
callq 0x2a2a0
movq %rax, %rbx
movq %rax, %rdi
callq 0x80e4
testb %al, %al
je 0x3dbb6
testq %rbx, %rbx
je 0x3dbb1
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq %rbx, %rax
popq %rbx
retq
leaq 0x1513(%rip), %rdi      # 0x3f0d0
movq %rbx, %rsi
callq 0x8294
jmp 0x3dbc5
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_built_in_info
lv_res_t lv_img_decoder_built_in_info(lv_img_decoder_t * decoder, const void * src, lv_img_header_t * header)
{
    (void)decoder; /*Unused*/

    lv_img_src_t src_type = lv_img_src_get_type(src);
    if(src_type == LV_IMG_SRC_VARIABLE) {
        lv_img_cf_t cf = ((lv_img_dsc_t *)src)->header.cf;
        if(cf < CF_BUILT_IN_FIRST || cf > CF_BUILT_IN_LAST) return LV_RES_INV;

        header->w  = ((lv_img_dsc_t *)src)->header.w;
        header->h  = ((lv_img_dsc_t *)src)->header.h;
        header->cf = ((lv_img_dsc_t *)src)->header.cf;
    }
#if LV_USE_FILESYSTEM
    else if(src_type == LV_IMG_SRC_FILE) {
        lv_fs_file_t file;
        lv_fs_res_t res;
        uint32_t rn;
        res = lv_fs_open(&file, src, LV_FS_MODE_RD);
        if(res == LV_FS_RES_OK) {
            res = lv_fs_read(&file, header, sizeof(lv_img_header_t), &rn);
            lv_fs_close(&file);
        }

        if(header->cf < CF_BUILT_IN_FIRST || header->cf > CF_BUILT_IN_LAST) return LV_RES_INV;

    }
#endif
    else if(src_type == LV_IMG_SRC_SYMBOL) {
        /*The size depend on the font but it is unknown here. It should be handled outside of the
         * function*/
        header->w = 1;
        header->h = 1;
        /* Symbols always have transparent parts. Important because of cover check in the design
         * function. The actual value doesn't matter because lv_draw_label will draw it*/
        header->cf = LV_IMG_CF_ALPHA_1BIT;
    } else {
        LV_LOG_WARN("Image get info found unknown src type");
        return LV_RES_INV;
    }
    return LV_RES_OK;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rsi, %rdi
callq 0x3c88e
cmpb $0x2, %al
je 0x3dc81
movzbl %al, %eax
cmpl $0x1, %eax
je 0x3dc39
testl %eax, %eax
jne 0x3dc35
movl (%r14), %eax
movl %eax, %ecx
andl $0x1f, %ecx
addl $-0x4, %ecx
cmpl $0xa, %ecx
ja 0x3dc35
andl $0x1ffc00, %eax         # imm = 0x1FFC00
movl $0xffe003ff, %ecx       # imm = 0xFFE003FF
andl (%rbx), %ecx
orl %eax, %ecx
movl %ecx, (%rbx)
movl $0xffe00000, %eax       # imm = 0xFFE00000
andl (%r14), %eax
andl $0x1fffff, %ecx         # imm = 0x1FFFFF
orl %eax, %ecx
movl %ecx, (%rbx)
movl (%r14), %eax
andl $0x1f, %eax
andl $-0x20, %ecx
orl %eax, %ecx
movl %ecx, (%rbx)
jmp 0x3dc8f
xorl %eax, %eax
jmp 0x3dc91
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl $0x2, %edx
callq 0x292db
testb %al, %al
jne 0x3dc71
leaq 0x8(%rsp), %r14
leaq 0x4(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x2948f
movq %r14, %rdi
callq 0x293d2
movl (%rbx), %eax
andl $0x1f, %eax
addl $-0x4, %eax
cmpl $0xb, %eax
setb %al
jmp 0x3dc91
movl $0x3e0, %eax            # imm = 0x3E0
andl (%rbx), %eax
orl $0x20040b, %eax         # imm = 0x20040B
movl %eax, (%rbx)
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_built_in_close
void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc)
{
    (void)decoder; /*Unused*/

    lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
    if(user_data) {
#if LV_USE_FILESYSTEM
        if(user_data->f) {
            lv_fs_close(user_data->f);
            lv_mem_free(user_data->f);
        }
#endif
        if(user_data->palette) lv_mem_free(user_data->palette);

        lv_mem_free(user_data);

        dsc->user_data = NULL;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x38(%rsi), %r14
testq %r14, %r14
je 0x3e496
movq %rsi, %rbx
movq (%r14), %rdi
testq %rdi, %rdi
je 0x3e478
callq 0x293d2
movq (%r14), %rdi
callq 0x2a006
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x3e486
callq 0x2a006
movq %r14, %rdi
callq 0x2a006
movq $0x0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_get_info
lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
{
    header->always_zero = 0;

    lv_res_t res = LV_RES_INV;
    lv_img_decoder_t * d;
    LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
    {
        res = LV_RES_INV;
        if(d->info_cb) {
            res = d->info_cb(d, src, header);
            if(res == LV_RES_OK) break;
        }
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
andb $0x1f, (%rsi)
leaq 0x2a0d2(%rip), %rdi     # 0x68588
callq 0x2a35c
testq %rax, %rax
je 0x3e4fc
movq %rax, %r15
leaq 0x2a0be(%rip), %r12     # 0x68588
movq (%r15), %rax
testq %rax, %rax
je 0x3e4e5
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq *%rax
movl %eax, %ebp
cmpb $0x1, %al
jne 0x3e4e7
jmp 0x3e500
xorl %ebp, %ebp
movq %r12, %rdi
movq %r15, %rsi
callq 0x2a448
movq %rax, %r15
testq %rax, %rax
jne 0x3e4ca
jmp 0x3e503
xorl %ebp, %ebp
jmp 0x3e503
movb $0x1, %bpl
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_open
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, const lv_style_t * style)
{
    dsc->style     = style;
    dsc->src_type  = lv_img_src_get_type(src);
    dsc->user_data = NULL;

    if(dsc->src_type == LV_IMG_SRC_FILE) {
        size_t fnlen = strlen(src);
        dsc->src = lv_mem_alloc(fnlen + 1);
        strcpy((char *)dsc->src, src);
    } else {
        dsc->src       = src;
    }

    lv_res_t res = LV_RES_INV;

    lv_img_decoder_t * d;
    LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d)
    {
        /*Info an Open callbacks are required*/
        if(d->info_cb == NULL || d->open_cb == NULL) continue;

        res = d->info_cb(d, src, &dsc->header);
        if(res != LV_RES_OK) continue;

        dsc->error_msg = NULL;
        dsc->img_data  = NULL;
        dsc->decoder   = d;

        res = d->open_cb(d, dsc);

        /*Opened successfully. It is a good decoder to for this image source*/
        if(res == LV_RES_OK) break;
    }

    if(res == LV_RES_INV) {
        memset(dsc, 0, sizeof(lv_img_decoder_dsc_t));
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rdx, 0x10(%rdi)
movq %rsi, %rdi
callq 0x3c88e
movb %al, 0x18(%rbx)
movq $0x0, 0x38(%rbx)
cmpb $0x1, %al
jne 0x3e55c
movq %r14, %rdi
callq 0x2070
leaq 0x1(%rax), %rdi
callq 0x29f85
movq %rax, 0x8(%rbx)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2040
jmp 0x3e560
movq %r14, 0x8(%rbx)
leaq 0x2a021(%rip), %rdi     # 0x68588
callq 0x2a35c
testq %rax, %rax
je 0x3e5d4
movq %rax, %r15
leaq 0x1c(%rbx), %r12
leaq 0x2a009(%rip), %r13     # 0x68588
xorl %ebp, %ebp
movq (%r15), %rax
testq %rax, %rax
je 0x3e5bc
cmpq $0x0, 0x8(%r15)
je 0x3e5bc
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq *%rax
cmpb $0x1, %al
jne 0x3e5ba
xorl %eax, %eax
movq %rax, 0x30(%rbx)
movq %rax, 0x20(%rbx)
movq %r15, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq *0x8(%r15)
cmpb $0x1, %al
je 0x3e5f9
movl %eax, %ebp
movq %r13, %rdi
movq %r15, %rsi
callq 0x2a448
movq %rax, %r15
testq %rax, %rax
jne 0x3e581
testb %bpl, %bpl
jne 0x3e5e8
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
jmp 0x3e5e8
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_decoder.c
// Function: lv_img_decoder_close
void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
{
    if(dsc->decoder) {
        if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);

        if(dsc->src_type == LV_IMG_SRC_FILE) {
            lv_mem_free(dsc->src);
            dsc->src = NULL;
        }
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x3e65c
movq 0x18(%rdi), %rax
testq %rax, %rax
je 0x3e645
movq %rbx, %rsi
callq *%rax
cmpb $0x1, 0x18(%rbx)
jne 0x3e65c
movq 0x8(%rbx), %rdi
callq 0x2a006
movq $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_cache.c
// Function: lv_img_cache_set_size
void lv_img_cache_set_size(uint16_t new_entry_cnt)
{
    if(LV_GC_ROOT(_lv_img_cache_array) != NULL) {
        /*Clean the cache before free it*/
        lv_img_cache_invalidate_src(NULL);
        lv_mem_free(LV_GC_ROOT(_lv_img_cache_array));
    }

    /*Reallocate the cache*/
    LV_GC_ROOT(_lv_img_cache_array) = lv_mem_alloc(sizeof(lv_img_cache_entry_t) * new_entry_cnt);
    LV_ASSERT_MEM(LV_GC_ROOT(_lv_img_cache_array));
    if(LV_GC_ROOT(_lv_img_cache_array) == NULL) {
        entry_cnt = 0;
        return;
    }
    entry_cnt = new_entry_cnt;

    /*Clean the cache*/
    uint16_t i;
    for(i = 0; i < entry_cnt; i++) {
        memset(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
        memset(&LV_GC_ROOT(_lv_img_cache_array)[i], 0, sizeof(lv_img_cache_entry_t));
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
leaq 0x29db1(%rip), %r14     # 0x685a0
cmpq $0x0, (%r14)
je 0x3e804
xorl %edi, %edi
callq 0x3e8a6
movq (%r14), %rdi
callq 0x2a006
movzwl %bx, %r15d
leal (,%r15,8), %eax
leaq (%rax,%rax,8), %rdi
callq 0x29f85
movq %rax, (%r14)
movq %rax, %rdi
callq 0x80e4
movq (%r14), %rsi
testb %al, %al
je 0x3e889
testq %rsi, %rsi
je 0x3e897
movw %bx, 0x332bd(%rip)      # 0x71af4
testw %bx, %bx
je 0x3e8a0
shll $0x3, %r15d
leaq (%r15,%r15,8), %rax
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movq (%r14), %rdx
movups %xmm0, 0x30(%rdx,%rcx)
movups %xmm0, 0x20(%rdx,%rcx)
movups %xmm0, 0x10(%rdx,%rcx)
movups %xmm0, (%rdx,%rcx)
movq (%r14), %rdx
movups %xmm0, 0x30(%rdx,%rcx)
movups %xmm0, 0x20(%rdx,%rcx)
movups %xmm0, 0x10(%rdx,%rcx)
movups %xmm0, (%rdx,%rcx)
movq $0x0, 0x40(%rdx,%rcx)
addq $0x48, %rcx
cmpq %rcx, %rax
jne 0x3e849
jmp 0x3e8a0
leaq 0x840(%rip), %rdi       # 0x3f0d0
callq 0x8294
jmp 0x3e895
movw $0x0, 0x33254(%rip)     # 0x71af4
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lvgl/src/lv_draw/lv_img_cache.c
// Function: lv_img_cache_invalidate_src
void lv_img_cache_invalidate_src(const void * src)
{

    lv_img_cache_entry_t * cache = LV_GC_ROOT(_lv_img_cache_array);

    uint16_t i;
    for(i = 0; i < entry_cnt; i++) {
        if(cache[i].dec_dsc.src == src || src == NULL) {
            if(cache[i].dec_dsc.src != NULL) {
                lv_img_decoder_close(&cache[i].dec_dsc);
            }

            memset(&cache[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
            memset(&cache[i], 0, sizeof(lv_img_cache_entry_t));
        }
    }
}

// Assembly:
movzwl 0x33247(%rip), %eax     # 0x71af4
testw %ax, %ax
je 0x3e923
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x29cdf(%rip), %rcx     # 0x685a0
movq (%rcx), %r14
xorl %r15d, %r15d
testq %rbx, %rbx
setne %dl
movq 0x8(%r14), %rcx
cmpq %rbx, %rcx
setne %sil
testb %sil, %dl
jne 0x3e90f
testq %rcx, %rcx
je 0x3e8f1
movq %r14, %rdi
callq 0x3e62b
movzwl 0x33203(%rip), %eax     # 0x71af4
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
movq $0x0, 0x40(%r14)
incq %r15
movzwl %ax, %ecx
addq $0x48, %r14
cmpq %rcx, %r15
jb 0x3e8c7
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lv_drivers/indev/XPT7603.c
// Function: om_i2c_read
uint16_t om_i2c_read(int addr) {
    int 	status, size;
// 	char 	pathname[255];
	int     numBytes = 2;
	int     devAddr = 0x48;
	int     fd;
    uint8_t buffer[2];
    uint16_t ret = 0;

	//// define the path to open
	//status = sprintf(pathname, I2C_DEV_PATH);
    fd = open(I2C_DEV_PATH, O_RDWR);
    
    //// set the device address
    // set to 7-bit addr
	if ( ioctl(fd, I2C_TENBIT, 0) < 0 ) {
		return EXIT_FAILURE;
	}

	//// write the  address
	if ( ioctl(fd, I2C_SLAVE, devAddr) < 0 ) {
		return EXIT_FAILURE;
	}
	
	//// set addr
	// clear the buffer
	memset( buffer, 0, numBytes );
	// push the address and data values into the buffer
	buffer[0]	= (addr & 0xff);
	size 		= 1;

	// write to the i2c device
	status = write(fd, buffer, size);
	
	// read from the i2c device
	size 	= numBytes;
	status 	= read(fd, &buffer, size);
	
	ret = (buffer[0] & 0xff) << 8;
	ret += buffer[1] & 0xff;
	
	// release the device file handle
	if ( close(fd) < 0 ) {
		return EXIT_FAILURE;
	}
	
	return ret;
 }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %edi, %r14d
leaq 0x4950(%rip), %rdi      # 0x4365a
movl $0x2, %esi
xorl %eax, %eax
callq 0x2100
movl %eax, %ebp
movl $0x704, %esi            # imm = 0x704
movl %eax, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x20b0
movw $0xffff, %bx            # imm = 0xFFFF
testl %eax, %eax
js 0x3ed94
movl $0x703, %esi            # imm = 0x703
movl %ebp, %edi
movl $0x48, %edx
xorl %eax, %eax
callq 0x20b0
testl %eax, %eax
js 0x3ed94
leaq 0xe(%rsp), %r15
movw $0x0, (%r15)
movb %r14b, (%r15)
movl $0x1, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x2060
movl $0x2, %edx
movl %ebp, %edi
movq %r15, %rsi
callq 0x20d0
movzbl (%r15), %r12d
movzbl 0x1(%r15), %r14d
movl %ebp, %edi
callq 0x20c0
testl %eax, %eax
js 0x3ed94
movzwl %r12w, %eax
shll $0x8, %eax
movzwl %r14w, %ebx
orl %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OnionIoT[P]lv_example/lv_drivers/indev/XPT7603.c
// Function: om_read_gpio
int om_read_gpio(int gpioNumber) {
    int  m_mfd;
    int regAddrOffset = GPIO_REG_DATA0_OFFSET;
    unsigned long int 	value = 0x0;
    int gpioVal;

    if (regAddress == NULL){
	    if ((m_mfd = open("/dev/mem", O_RDWR)) < 0)
	    {
		    return EXIT_FAILURE;	// maybe return -1
	    }
	    regAddress = (unsigned long int*)mmap(NULL, 
						  1024, 
						  PROT_READ|PROT_WRITE, 
						  MAP_FILE|MAP_SHARED, 
						  m_mfd, 
						  GPIO_REG_BLOCK_ADDR
						 );
	    close(m_mfd);
    }
    
	// read the value 
	value = *(regAddress + regAddrOffset);
// 	printf("GPIO_DATA_0 = 0x%08x\n", value);
	
	gpioVal = ((value >> gpioNumber) & 0x1);
// 	printf("gpioVal = %d\n", gpioVal);
	
	return gpioVal;
 }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x32e51(%rip), %rax     # 0x71c00
testq %rax, %rax
jne 0x3ee01
leaq 0x48aa(%rip), %rdi      # 0x43665
movl $0x2, %esi
xorl %eax, %eax
callq 0x2100
testl %eax, %eax
js 0x3ee18
movl %eax, %ebp
movl $0x400, %esi            # imm = 0x400
movl $0x10000000, %r9d       # imm = 0x10000000
xorl %edi, %edi
movl $0x3, %edx
movl $0x1, %ecx
movl %eax, %r8d
callq 0x2080
movq %rax, 0x32e0d(%rip)     # 0x71c00
movl %ebp, %edi
callq 0x20c0
movq 0x32dff(%rip), %rax     # 0x71c00
movq 0xc40(%rax), %rcx
xorl %eax, %eax
btq %rbx, %rcx
setb %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3ee11
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_new
diff_node_t *diff_node_new(diff_node_t *parent, char *name, diff_type_t type)
{
  int len;
  diff_node_t *new;

  new = (diff_node_t *)malloc(sizeof(diff_node_t));

  if (name == NULL) {
    new->name = NULL;
  } else {
    len = strlen(name) + 1;
    new->name = (char *)malloc(len);
    strncpy(new->name, name, len);
  }
  new->type = type;
  new->no_of_subnodes = 0;
  new->parent = parent;
  new->subnode = NULL;
  new->expanded = true;

  return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movl $0x28, %edi
callq 0x2220
movq %rax, %r14
testq %r15, %r15
je 0x2459
movq %r15, %rdi
callq 0x2100
incl %eax
movslq %eax, %r13
movq %r13, %rdi
callq 0x2220
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2090
jmp 0x245c
xorl %r12d, %r12d
movq %r12, 0x8(%r14)
movl %ebp, 0x4(%r14)
movl $0x0, 0x18(%r14)
movq %rbx, 0x10(%r14)
movq $0x0, 0x20(%r14)
movb $0x1, (%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_add
diff_node_t *diff_node_add(diff_node_t *current, char *name, diff_type_t type)
{
  diff_node_t *new;

  new = diff_node_new(current, name, type);

  if (current->subnode == NULL) {
    current->subnode = malloc(sizeof(diff_node_t *));
  } else {
    current->subnode = realloc(current->subnode, sizeof(diff_node_t *) * (current->no_of_subnodes + 1));
  }

  current->subnode[current->no_of_subnodes] = new;
  current->no_of_subnodes++;

  return new;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x240c
movq %rax, %r14
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x24b6
movl 0x18(%rbx), %esi
incl %esi
shlq $0x3, %rsi
callq 0x2230
jmp 0x24c0
movl $0x8, %edi
callq 0x2220
movq %rax, 0x20(%rbx)
movl 0x18(%rbx), %ecx
movq %r14, (%rax,%rcx,8)
leal 0x1(%rcx), %eax
movl %eax, 0x18(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_remove
void diff_node_remove(diff_node_t *node)
{
  int i;
  free(node->name);
  for (i = 0; i < node->no_of_subnodes; i++) {
    diff_node_remove(node->subnode[i]);
  }
  if (node->subnode != NULL) {
    free(node->subnode);
  }
  free(node);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x2060
cmpl $0x0, 0x18(%rbx)
je 0x250d
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x24dc
incq %r14
movl 0x18(%rbx), %eax
cmpq %rax, %r14
jb 0x24f5
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x251b
callq 0x2060
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2060
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_path
char *diff_node_path(diff_node_t *node, char *path, int path_len)
{
  char temp[PATH_MAX];

  strncpy(path, node->name, path_len);

  node = node->parent;
  while (node != NULL) {
    if (node->type == DIFF_TYPE_ROOT) {
      break;
    }
    strncpy(temp, path, PATH_MAX);
    snprintf(path, path_len, "%s/%s", node->name, temp);
    node = node->parent;
  }

  return path;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8(%rdi), %rsi
movslq %edx, %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x2090
movq 0x10(%r15), %r13
testq %r13, %r13
je 0x25b0
movq %rsp, %r15
leaq 0x1a8b(%rip), %r12      # 0x4004
cmpl $0x0, 0x4(%r13)
je 0x25b0
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2090
movq 0x8(%r13), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r15, %r8
xorl %eax, %eax
callq 0x2140
movq 0x10(%r13), %r13
testq %r13, %r13
jne 0x2579
movq %rbx, %rax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_dump
void diff_node_dump(diff_node_t *node)
{
  int i;
  int depth;

  depth = diff_node_depth(node);
  while (depth-- > 1)
    printf("  ");

  switch (node->type) {
  case DIFF_TYPE_FILE_EQUAL:
  case DIFF_TYPE_DIR_EQUAL:
    printf("=");
    break;

  case DIFF_TYPE_FILE_DIFFERS:
  case DIFF_TYPE_DIR_DIFFERS:
    printf("*");
    break;

  case DIFF_TYPE_FILE_ADDED:
  case DIFF_TYPE_DIR_ADDED:
    printf("+");
    break;

  case DIFF_TYPE_FILE_MISSING:
  case DIFF_TYPE_DIR_MISSING:
    printf("-");
    break;

  default:
    break;
  }

  printf("%s", node->name);

  switch (node->type) {
  case DIFF_TYPE_DIR_EQUAL:
  case DIFF_TYPE_DIR_DIFFERS:
  case DIFF_TYPE_DIR_ADDED:
  case DIFF_TYPE_DIR_MISSING:
    printf("/");
    break;

  default:
    break;
  }

  printf("\n");

  for (i = 0; i < node->no_of_subnodes; i++) {
    diff_node_dump(node->subnode[i]);
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %ebp, %ebp
movq %rdi, %rax
cmpl $0x0, 0x4(%rax)
je 0x25e1
movq 0x10(%rax), %rax
incl %ebp
testq %rax, %rax
jne 0x25d0
cmpl $0x2, %ebp
jl 0x2600
incl %ebp
leaq 0x1a1b(%rip), %r14      # 0x400a
movq %r14, %rdi
xorl %eax, %eax
callq 0x2130
decl %ebp
cmpl $0x2, %ebp
ja 0x25ef
movl 0x4(%rbx), %eax
decl %eax
cmpl $0x7, %eax
ja 0x261b
movl %eax, %eax
leaq 0x19fd(%rip), %rcx      # 0x4010
movl (%rcx,%rax,4), %edi
callq 0x2070
movq 0x8(%rbx), %rsi
leaq 0x19e1(%rip), %rdi      # 0x4007
xorl %eax, %eax
callq 0x2130
movl 0x4(%rbx), %eax
addl $-0x5, %eax
cmpl $0x3, %eax
ja 0x2642
movl $0x2f, %edi
callq 0x2070
movl $0xa, %edi
callq 0x2070
cmpl $0x0, 0x18(%rbx)
je 0x266d
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x25c4
incq %r14
movl 0x18(%rbx), %eax
cmpq %rax, %r14
jb 0x2655
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_parents_differ
void diff_node_parents_differ(diff_node_t *node)
{
  do {
    if (node->type == DIFF_TYPE_ROOT) {
      break;
    } else if (node->type == DIFF_TYPE_DIR_EQUAL) {
      node->type = DIFF_TYPE_DIR_DIFFERS;
    }
    
    node = node->parent;
  } while (node != NULL);
}

// Assembly:
movl 0x4(%rdi), %eax
cmpl $0x5, %eax
je 0x2680
testl %eax, %eax
jne 0x2687
jmp 0x2690
movl $0x6, 0x4(%rdi)
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
jne 0x2672
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_sort
void diff_node_sort(diff_node_t *node)
{
  int i;
  qsort(node->subnode, node->no_of_subnodes, sizeof(diff_node_t *), diff_node_compare);
  for (i = 0; i < node->no_of_subnodes; i++) {
    diff_node_sort(node->subnode[i]);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
movl 0x18(%rbx), %esi
leaq 0x33(%rip), %rcx        # 0x26d9
movl $0x8, %edx
callq 0x20b0
cmpl $0x0, 0x18(%rbx)
je 0x26d1
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2691
incq %r14
movl 0x18(%rbx), %eax
cmpq %rax, %r14
jb 0x26b9
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/node.c
// Function: diff_node_unexpand_all
void diff_node_unexpand_all(diff_node_t *node)
{
  int i;

  switch (node->type) {
  case DIFF_TYPE_DIR_EQUAL:
  case DIFF_TYPE_DIR_DIFFERS:
  case DIFF_TYPE_DIR_ADDED:
  case DIFF_TYPE_DIR_MISSING:
    if (node->no_of_subnodes > 0) {
      node->expanded = false;
    }
    break;

  default:
    break;
  }

  for (i = 0; i < node->no_of_subnodes; i++) {
    diff_node_unexpand_all(node->subnode[i]);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x4(%rdi), %ecx
movl 0x18(%rdi), %eax
addl $-0x5, %ecx
cmpl $0x3, %ecx
ja 0x270a
testl %eax, %eax
je 0x2729
movb $0x0, (%rbx)
jmp 0x270e
testl %eax, %eax
je 0x2729
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x26ec
incq %r14
movl 0x18(%rbx), %eax
cmpq %rax, %r14
jb 0x2711
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/tree.c
// Function: diff_tree_added_dir
static void diff_tree_added_dir(char *path, diff_node_t *current)
{
  DIR *dh;
  struct dirent *entry;
  struct stat st;
  char fullpath[PATH_MAX];
  diff_node_t *subnode;

  dh = opendir(path);
  if (dh == NULL) {
    fprintf(stderr, "Warning: Unable to open directory: %s\n", path);
    return;
  }

  while ((entry = readdir(dh))) {
    if (entry->d_name[0] == '.')
      continue; /* Ignore files with leading dot. */

    snprintf(fullpath, PATH_MAX, "%s/%s", path, entry->d_name);

    if (stat(fullpath, &st) == -1) {
      fprintf(stderr, "Warning: Unable to stat() path: %s\n", fullpath);
      continue;
    }

    if (S_ISDIR(st.st_mode)) {
      subnode = diff_node_add(current, entry->d_name, DIFF_TYPE_DIR_ADDED);
      diff_tree_added_dir(fullpath, subnode);
    } else if (S_ISREG(st.st_mode)) {
      diff_node_add(current, entry->d_name, DIFF_TYPE_FILE_ADDED);
    }
  }
  closedir(dh);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movq %rsi, %r14
movq %rdi, %rbx
callq 0x20f0
testq %rax, %rax
je 0x2d66
movq %rax, %r15
movq %rax, %rdi
callq 0x2200
testq %rax, %rax
je 0x2d4c
movq %rax, %r12
leaq 0x90(%rsp), %r13
movq %rsp, %rbp
cmpb $0x2e, 0x13(%r12)
je 0x2d19
addq $0x13, %r12
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdi
leaq 0x134e(%rip), %rdx      # 0x4004
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x2140
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21f0
cmpl $-0x1, %eax
je 0x2d2f
movl 0x18(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
movl %eax, %ecx
negw %cx
jo 0x2d09
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x2d19
movq %r14, %rdi
movq %r12, %rsi
movl $0x7, %edx
callq 0x248e
movq %r13, %rdi
movq %rax, %rsi
callq 0x2c54
jmp 0x2d19
movq %r14, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq 0x248e
movq %r15, %rdi
callq 0x2200
movq %rax, %r12
testq %rax, %rax
jne 0x2c9b
jmp 0x2d4c
movq 0x32c2(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1317(%rip), %rsi      # 0x4057
movq %r13, %rdx
xorl %eax, %eax
callq 0x21e0
jmp 0x2d19
movq %r15, %rdi
callq 0x21a0
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x328b(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x12b9(%rip), %rsi      # 0x4030
movq %rbx, %rdx
xorl %eax, %eax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21e0
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/tree.c
// Function: diff_tree_missing_dir
static void diff_tree_missing_dir(char *path, diff_node_t *current)
{
  DIR *dh;
  struct dirent *entry;
  struct stat st;
  char fullpath[PATH_MAX];
  diff_node_t *subnode;

  dh = opendir(path);
  if (dh == NULL) {
    fprintf(stderr, "Warning: Unable to open directory: %s\n", path);
    return;
  }

  while ((entry = readdir(dh))) {
    if (entry->d_name[0] == '.')
      continue; /* Ignore files with leading dot. */

    snprintf(fullpath, PATH_MAX, "%s/%s", path, entry->d_name);

    if (stat(fullpath, &st) == -1) {
      fprintf(stderr, "Warning: Unable to stat() path: %s\n", fullpath);
      continue;
    }

    if (S_ISDIR(st.st_mode)) {
      subnode = diff_node_add(current, entry->d_name, DIFF_TYPE_DIR_MISSING);
      diff_tree_missing_dir(fullpath, subnode);
    } else if (S_ISREG(st.st_mode)) {
      diff_node_add(current, entry->d_name, DIFF_TYPE_FILE_MISSING);
    }
  }
  closedir(dh);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movq %rsi, %r14
movq %rdi, %rbx
callq 0x20f0
testq %rax, %rax
je 0x2ea4
movq %rax, %r15
movq %rax, %rdi
callq 0x2200
testq %rax, %rax
je 0x2e8a
movq %rax, %r12
leaq 0x90(%rsp), %r13
movq %rsp, %rbp
cmpb $0x2e, 0x13(%r12)
je 0x2e57
addq $0x13, %r12
movl $0x1000, %esi           # imm = 0x1000
movq %r13, %rdi
leaq 0x1210(%rip), %rdx      # 0x4004
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x2140
movq %r13, %rdi
movq %rbp, %rsi
callq 0x21f0
cmpl $-0x1, %eax
je 0x2e6d
movl 0x18(%rsp), %eax
movl $0xf000, %ecx           # imm = 0xF000
andl %ecx, %eax
movl %eax, %ecx
negw %cx
jo 0x2e47
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x2e57
movq %r14, %rdi
movq %r12, %rsi
movl $0x8, %edx
callq 0x248e
movq %r13, %rdi
movq %rax, %rsi
callq 0x2d92
jmp 0x2e57
movq %r14, %rdi
movq %r12, %rsi
movl $0x4, %edx
callq 0x248e
movq %r15, %rdi
callq 0x2200
movq %rax, %r12
testq %rax, %rax
jne 0x2dd9
jmp 0x2e8a
movq 0x3184(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x11d9(%rip), %rsi      # 0x4057
movq %r13, %rdx
xorl %eax, %eax
callq 0x21e0
jmp 0x2e57
movq %r15, %rdi
callq 0x21a0
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x314d(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x117b(%rip), %rsi      # 0x4030
movq %rbx, %rdx
xorl %eax, %eax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21e0
// File: /workspace/github_c_makefile_star2_O3/kobolt[P]curses-collection/difftree/navi.c
// Function: diff_navi_list_size
static int diff_navi_list_size(diff_node_t *node)
{
  int i, size;

  if (node->type == DIFF_TYPE_ROOT) {
    size = 0;
  } else {
    size = 1;
  }

  if (node->expanded) {
    for (i = 0; i < node->no_of_subnodes; i++) {
      size += diff_navi_list_size(node->subnode[i]);
    }
  }

  return size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpl $0x0, 0x4(%rdi)
setne %bl
cmpb $0x1, (%rdi)
jne 0x3396
movl 0x18(%rdi), %r14d
testq %r14, %r14
je 0x3396
movq 0x20(%rdi), %r15
xorl %r12d, %r12d
movq (%r15,%r12,8), %rdi
callq 0x335d
addl %eax, %ebx
incq %r12
cmpq %r12, %r14
jne 0x3383
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq