// File: /workspace/github_c_makefile_star2_O1/OnionIoT[P]lv_example/lvgl/src/lv_objx/lv_slider.c
// Function: lv_slider_design
static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_design_mode_t mode)
{
    /*Return false if the object is not covers the mask_p area*/
    if(mode == LV_DESIGN_COVER_CHK) {
        return false;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);

        const lv_style_t * style_bg    = lv_slider_get_style(slider, LV_SLIDER_STYLE_BG);
        const lv_style_t * style_knob  = lv_slider_get_style(slider, LV_SLIDER_STYLE_KNOB);
        const lv_style_t * style_indic = lv_slider_get_style(slider, LV_SLIDER_STYLE_INDIC);

        lv_opa_t opa_scale = lv_obj_get_opa_scale(slider);

        lv_coord_t slider_w = lv_area_get_width(&slider->coords);
        lv_coord_t slider_h = lv_area_get_height(&slider->coords);

        /*Draw the bar*/
        lv_area_t area_bg;
        lv_area_copy(&area_bg, &slider->coords);

        /*Be sure at least LV_SLIDER_SIZE_MIN  size will remain*/
        lv_coord_t pad_top_bg    = style_bg->body.padding.top;
        lv_coord_t pad_bottom_bg = style_bg->body.padding.bottom;
        lv_coord_t pad_left_bg   = style_bg->body.padding.left;
        lv_coord_t pad_right_bg  = style_bg->body.padding.right;
        if(pad_top_bg + pad_bottom_bg + LV_SLIDER_SIZE_MIN > lv_area_get_height(&area_bg)) {
            pad_top_bg    = (lv_area_get_height(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
            pad_bottom_bg = pad_top_bg;
        }
        if(pad_left_bg + pad_right_bg + LV_SLIDER_SIZE_MIN > lv_area_get_width(&area_bg)) {
            pad_left_bg  = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
            pad_right_bg = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
        }

        if(ext->knob_in) { /*Enable extra size if the knob is inside */
            area_bg.x1 += pad_left_bg;
            area_bg.x2 -= pad_right_bg;
            area_bg.y1 += pad_top_bg;
            area_bg.y2 -= pad_bottom_bg;
        } else {                                                   /*Let space only in the perpendicular directions*/
            area_bg.x1 += slider_w < slider_h ? pad_left_bg : 0;   /*Pad only for vertical slider*/
            area_bg.x2 -= slider_w < slider_h ? pad_right_bg : 0;  /*Pad only for vertical slider*/
            area_bg.y1 += slider_w > slider_h ? pad_top_bg : 0;    /*Pad only for horizontal slider*/
            area_bg.y2 -= slider_w > slider_h ? pad_bottom_bg : 0; /*Pad only for horizontal slider*/
        }

#if LV_USE_GROUP == 0
        lv_draw_rect(&area_bg, mask, style_bg, lv_obj_get_opa_scale(slider));
#else
        /* Draw the borders later if the slider is focused.
         * At value = 100% the indicator can cover to whole background and the focused style won't
         * be visible*/
        if(lv_obj_is_focused(slider)) {
            lv_style_t style_tmp;
            lv_style_copy(&style_tmp, style_bg);
            style_tmp.body.border.width = 0;
            lv_draw_rect(&area_bg, mask, &style_tmp, opa_scale);
        } else {
            lv_draw_rect(&area_bg, mask, style_bg, opa_scale);
        }
#endif

        /*Draw the indicator*/
        lv_area_t area_indic;
        lv_area_copy(&area_indic, &area_bg);

        /*Be sure at least ver pad/hor pad width indicator will remain*/
        lv_coord_t pad_top_indic    = style_indic->body.padding.top;
        lv_coord_t pad_bottom_indic = style_indic->body.padding.bottom;
        lv_coord_t pad_left_indic   = style_indic->body.padding.left;
        lv_coord_t pad_right_indic  = style_indic->body.padding.right;
        if(pad_top_indic + pad_bottom_indic + LV_SLIDER_SIZE_MIN > lv_area_get_height(&area_bg)) {
            pad_top_indic    = (lv_area_get_height(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
            pad_bottom_indic = pad_top_indic;
        }
        if(pad_left_indic + pad_right_indic + LV_SLIDER_SIZE_MIN > lv_area_get_width(&area_bg)) {
            pad_left_indic  = (lv_area_get_width(&area_bg) - LV_SLIDER_SIZE_MIN) >> 1;
            pad_right_indic = pad_left_indic;
        }

        area_indic.x1 += pad_left_indic;
        area_indic.x2 -= pad_right_indic;
        area_indic.y1 += pad_top_indic;
        area_indic.y2 -= pad_bottom_indic;

        lv_coord_t cur_value = lv_slider_get_value(slider);
        lv_coord_t min_value = lv_slider_get_min_value(slider);
        lv_coord_t max_value = lv_slider_get_max_value(slider);

        /*If dragged draw to the drag position*/
        if(ext->drag_value != LV_SLIDER_NOT_PRESSED) cur_value = ext->drag_value;
        bool sym = false;
        if(ext->bar.sym && ext->bar.min_value < 0 && ext->bar.max_value > 0) sym = true;

        if(slider_w >= slider_h) {
            lv_coord_t indic_w = lv_area_get_width(&area_indic);
#if LV_USE_ANIMATION
            if(ext->bar.anim_state != LV_BAR_ANIM_STATE_INV) {
                /*Calculate the coordinates of anim. start and end*/
                lv_coord_t anim_start_x =
                    (int32_t)((int32_t)indic_w * (ext->bar.anim_start - min_value)) / (max_value - min_value);
                lv_coord_t anim_end_x =
                    (int32_t)((int32_t)indic_w * (ext->bar.anim_end - min_value)) / (max_value - min_value);

                /*Calculate the real position based on `anim_state` (between `anim_start` and
                 * `anim_end`)*/
                area_indic.x2 = anim_start_x + (((anim_end_x - anim_start_x) * ext->bar.anim_state) >> 8);
            } else
#endif
            {
                area_indic.x2 = (int32_t)((int32_t)indic_w * (cur_value - min_value)) / (max_value - min_value);
            }

            area_indic.x2 = area_indic.x1 + area_indic.x2 - 1;
            if(sym) {
                /*Calculate the coordinate of the zero point*/
                lv_coord_t zero;
                zero = area_indic.x1 + (-ext->bar.min_value * slider_w) / (ext->bar.max_value - ext->bar.min_value);
                if(area_indic.x2 > zero)
                    area_indic.x1 = zero;
                else {
                    area_indic.x1 = area_indic.x2;
                    area_indic.x2 = zero;
                }
            }

            /*Draw the indicator but don't draw an ugly 1px wide rectangle on the left on min.
             * value*/
            if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, mask, style_indic, opa_scale);

        } else {
            lv_coord_t indic_h = lv_area_get_height(&area_indic);
#if LV_USE_ANIMATION
            if(ext->bar.anim_state != LV_BAR_ANIM_STATE_INV) {
                /*Calculate the coordinates of anim. start and end*/
                lv_coord_t anim_start_y =
                    (int32_t)((int32_t)indic_h * (ext->bar.anim_start - min_value)) / (max_value - min_value);
                lv_coord_t anim_end_y =
                    (int32_t)((int32_t)indic_h * (ext->bar.anim_end - min_value)) / (max_value - min_value);

                /*Calculate the real position based on `anim_state` (between `anim_start` and
                 * `anim_end`)*/
                area_indic.y1 = anim_start_y + (((anim_end_y - anim_start_y) * ext->bar.anim_state) >> 8);
            } else
#endif
            {
                area_indic.y1 = (int32_t)((int32_t)indic_h * (cur_value - min_value)) / (max_value - min_value);
            }

            area_indic.y1 = area_indic.y2 - area_indic.y1 + 1;

            if(sym) {
                /*Calculate the coordinate of the zero point*/
                lv_coord_t zero;
                zero = area_indic.y2 - (-ext->bar.min_value * slider_h) / (ext->bar.max_value - ext->bar.min_value);
                if(area_indic.y1 < zero)
                    area_indic.y2 = zero;
                else {
                    area_indic.y2 = area_indic.y1;
                    area_indic.y1 = zero;
                }
            }

            /*Draw the indicator but don't draw an ugly 1px height rectangle on the bottom on min.
             * value*/
            if(area_indic.x1 != area_indic.x2) lv_draw_rect(&area_indic, mask, style_indic, opa_scale);
        }

        /*Before the knob add the border if required*/
#if LV_USE_GROUP
        /* Draw the borders later if the bar is focused.
         * At value = 100% the indicator can cover to whole background and the focused style won't
         * be visible*/
        if(lv_obj_is_focused(slider)) {
            lv_style_t style_tmp;
            lv_style_copy(&style_tmp, style_bg);
            style_tmp.body.opa          = LV_OPA_TRANSP;
            style_tmp.body.shadow.width = 0;
            lv_draw_rect(&area_bg, mask, &style_tmp, opa_scale);
        }
#endif

        /*Draw the knob*/
        lv_area_t knob_area;
        lv_area_copy(&knob_area, &slider->coords);

        if(slider_w >= slider_h) {
            if(ext->knob_in == 0) {
                if(sym == false) {
                    knob_area.x1 = area_indic.x2 - slider_h / 2;
                } else {
                    if(cur_value > 0) knob_area.x1 = area_indic.x2 - slider_h / 2;
                    else knob_area.x1 = area_indic.x1 - slider_h / 2;
                }
                knob_area.x2 = knob_area.x1 + slider_h - 1;
            } else {
#if LV_USE_ANIMATION
                if(ext->bar.anim_state != LV_BAR_ANIM_STATE_INV) {
                    lv_coord_t w = slider_w - slider_h - 1;
                    lv_coord_t anim_start_x =
                        (int32_t)((int32_t)w * (ext->bar.anim_start - min_value)) / (max_value - min_value);
                    lv_coord_t anim_end_x =
                        (int32_t)((int32_t)w * (ext->bar.anim_end - min_value)) / (max_value - min_value);

                    /*Calculate the real position based on `anim_state` (between `anim_start` and
                     * `anim_end`)*/
                    knob_area.x1 = anim_start_x + (((anim_end_x - anim_start_x) * ext->bar.anim_state) >> 8);
                } else
#endif
                {
                    knob_area.x1 = (int32_t)((int32_t)(slider_w - slider_h - 1) * (cur_value - min_value)) /
                                   (max_value - min_value);
                }

                knob_area.x1 += slider->coords.x1;
                knob_area.x2 = knob_area.x1 + slider_h - 1;
            }

            knob_area.y1 = slider->coords.y1;
            knob_area.y2 = slider->coords.y2;
        } else {
            if(ext->knob_in == 0) {
                if(sym == false) {
                    knob_area.y1 = area_indic.y1 - slider_w / 2;
                } else {
                    if(cur_value > 0)  knob_area.y1 = area_indic.y1 - slider_w / 2;
                    else  knob_area.y1 = area_indic.y2 - slider_w / 2;
                }
                knob_area.y2 = knob_area.y1 + slider_w - 1;
            } else {
#if LV_USE_ANIMATION
                if(ext->bar.anim_state != LV_BAR_ANIM_STATE_INV) {
                    lv_coord_t h = slider_h - slider_w - 1;
                    lv_coord_t anim_start_x =
                        (int32_t)((int32_t)h * (ext->bar.anim_start - min_value)) / (max_value - min_value);
                    lv_coord_t anim_end_x =
                        (int32_t)((int32_t)h * (ext->bar.anim_end - min_value)) / (max_value - min_value);

                    /*Calculate the real position based on `anim_state` (between `anim_start` and
                     * `anim_end`)*/
                    knob_area.y2 = anim_start_x + (((anim_end_x - anim_start_x) * ext->bar.anim_state) >> 8);
                } else
#endif
                {
                    knob_area.y2 = (int32_t)((int32_t)(slider_h - slider_w - 1) * (cur_value - min_value)) /
                                   (max_value - min_value);
                }

                knob_area.y2 = slider->coords.y2 - knob_area.y2;
                knob_area.y1 = knob_area.y2 - slider_w - 1;
            }
            knob_area.x1 = slider->coords.x1;
            knob_area.x2 = slider->coords.x2;
        }
        lv_draw_rect(&knob_area, mask, style_knob, opa_scale);
    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
    }

    return true;
}

// Assembly:
testl %edx, %edx
jne 0x1d7ca
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r15
movq %rsi, 0x40(%rsp)
movl %edx, 0x4c(%rsp)
callq 0x6ad8
movq %rax, %r13
movq %r15, %rdi
xorl %esi, %esi
callq 0x1d944
movq %rax, %r14
movq %r15, %rdi
movl $0x2, %esi
callq 0x1d944
movq %rax, 0xa0(%rsp)
movq %r15, %rdi
movl $0x1, %esi
callq 0x1d944
movq %rax, 0x50(%rsp)
movq %r15, %rdi
callq 0x69cc
movb %al, 0x1c(%rsp)
movzwl 0x24(%r15), %ebx
movzwl 0x26(%r15), %r12d
subw 0x20(%r15), %bx
incl %ebx
subw 0x22(%r15), %r12w
incl %r12d
movq 0x20(%r15), %rdi
movq %rdi, 0x10(%rsp)
movswl 0x16(%r14), %r9d
movswl 0x18(%r14), %eax
movswl 0x1a(%r14), %r11d
leal 0x4(%r9,%rax), %r10d
movzwl 0x16(%rsp), %ecx
movzwl 0x12(%rsp), %edx
movl %ecx, %esi
subl %edx, %esi
incl %esi
movswl %si, %ebp
movl $0x1fffc, %r8d          # imm = 0x1FFFC
leal (%r8,%rbp), %esi
shrl %esi
cmpl %ebp, %r10d
cmovgl %esi, %eax
cmovlel %r9d, %esi
movq %r14, 0x38(%rsp)
movswl 0x1c(%r14), %r9d
leal (%r11,%r9), %ebp
addl $0x4, %ebp
movl 0x14(%rsp), %r14d
movl %r14d, %r10d
subl %edi, %r10d
incl %r10d
movswl %r10w, %r10d
addl %r10d, %r8d
shrl %r8d
cmpl %r10d, %ebp
cmovgl %r8d, %r9d
cmovlel %r11d, %r8d
testb $0x1, 0x22(%r13)
jne 0x1d24e
cmpw %r12w, %bx
movl $0x0, %r10d
cmovgel %r10d, %r8d
cmovgel %r10d, %r9d
cmovlel %r10d, %esi
cmovlel %r10d, %eax
addl %r8d, %edi
movw %di, 0x10(%rsp)
subl %r9d, %r14d
movw %r14w, 0x14(%rsp)
addl %esi, %edx
movw %dx, 0x12(%rsp)
jmp 0x1d267
addl %edi, %r8d
movw %r8w, 0x10(%rsp)
subl %r9d, %r14d
movw %r14w, 0x14(%rsp)
addl %edx, %esi
movw %si, 0x12(%rsp)
subl %eax, %ecx
movw %cx, 0x16(%rsp)
movq %r15, %rdi
callq 0x6bbc
movzbl 0x1c(%rsp), %ecx
testb %al, %al
movq 0x40(%rsp), %rbp
movl %ecx, 0x1c(%rsp)
je 0x1d2d4
leaq 0x58(%rsp), %r14
movq %r14, %rdi
movq 0x38(%rsp), %rsi
movq %r15, 0x20(%rsp)
movl %ebx, %r15d
movq %r13, %rbx
movq %r12, %r13
movq %rbp, %r12
movl %ecx, %ebp
callq 0x798d
movw $0x0, 0xc(%r14)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movq %r12, %rbp
movq %r13, %r12
movq %rbx, %r13
movl %r15d, %ebx
movq 0x20(%rsp), %r15
jmp 0x1d2e1
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rdx
callq 0x365ac
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movq 0x50(%rsp), %r11
movswl 0x16(%r11), %r8d
movswl 0x18(%r11), %ecx
movswl 0x1a(%r11), %edx
leal (%r8,%rcx), %r9d
addl $0x4, %r9d
movzwl 0x16(%rsp), %esi
subw 0x12(%rsp), %si
incl %esi
movswl %si, %r10d
movl $0x1fffc, %edi          # imm = 0x1FFFC
leal (%r10,%rdi), %esi
shrl %esi
cmpl %r10d, %r9d
cmovgl %esi, %ecx
cmovlel %r8d, %esi
movswl 0x1c(%r11), %r8d
movzwl 0x14(%rsp), %r9d
subw 0x10(%rsp), %r9w
leal (%rdx,%r8), %r10d
addl $0x4, %r10d
incl %r9d
movswl %r9w, %r9d
addl %r9d, %edi
shrl %edi
cmpl %r9d, %r10d
cmovgl %edi, %r8d
cmovlel %edx, %edi
addl %edi, %eax
movw %ax, (%rsp)
subw %r8w, 0x4(%rsp)
addw %si, 0x2(%rsp)
subw %cx, 0x6(%rsp)
movq %r15, %rdi
callq 0x1d8aa
movl %eax, %r14d
movq %r15, %rdi
callq 0x955b
movw %ax, 0x20(%rsp)
movq %r15, %rdi
callq 0x9587
movl %eax, %ecx
movzwl 0x20(%r13), %eax
cmpl $0x8000, %eax           # imm = 0x8000
cmovnel %eax, %r14d
testb $0x1, 0xe(%r13)
je 0x1d3b8
cmpw $0x0, 0x2(%r13)
js 0x1d495
xorl %r11d, %r11d
movswl %bx, %eax
movl %eax, 0x30(%rsp)
movswl %r12w, %eax
movl %eax, 0x34(%rsp)
movswl 0xa(%r13), %edi
cmpw %r12w, %bx
movw %cx, 0xe(%rsp)
movl %r14d, 0x2c(%rsp)
jge 0x1d43d
movzwl 0x6(%rsp), %esi
movl %esi, %eax
subw 0x2(%rsp), %ax
incl %eax
movswl %ax, %r8d
cmpw $-0x1, %di
je 0x1d4a4
movswl 0x6(%r13), %eax
movswl 0x20(%rsp), %r9d
subl %r9d, %eax
imull %r8d, %eax
movswl %cx, %r10d
subl %r9d, %r10d
cltd
idivl %r10d
movl %eax, %ecx
movswl 0x8(%r13), %eax
subl %r9d, %eax
imull %r8d, %eax
cltd
idivl %r10d
movswl %cx, %ecx
cwtl
subl %ecx, %eax
imull %edi, %eax
sarl $0x8, %eax
addl %ecx, %eax
jmp 0x1d4bd
movl (%rsp), %esi
movl 0x4(%rsp), %eax
subl %esi, %eax
incl %eax
movswl %ax, %r9d
movswl 0x20(%rsp), %r10d
movswl %cx, %r8d
cmpw $-0x1, %di
je 0x1d4f1
movswl 0x6(%r13), %eax
subl %r10d, %eax
imull %r9d, %eax
subl %r10d, %r8d
cltd
idivl %r8d
movl %eax, %ecx
movswl 0x8(%r13), %eax
subl %r10d, %eax
imull %r9d, %eax
cltd
idivl %r8d
movswl %cx, %ecx
cwtl
subl %ecx, %eax
imull %edi, %eax
sarl $0x8, %eax
addl %ecx, %eax
jmp 0x1d503
cmpw $0x0, 0x4(%r13)
setg %r11b
jmp 0x1d3bb
movswl %r14w, %eax
movl %ecx, %edx
movswl 0x20(%rsp), %ecx
subl %ecx, %eax
imull %r8d, %eax
movswl %dx, %edi
subl %ecx, %edi
cltd
idivl %edi
movl %esi, %ecx
subl %eax, %ecx
incl %ecx
movw %cx, 0x2(%rsp)
testb %r11b, %r11b
je 0x1d54c
movswl 0x2(%r13), %edx
movl 0x34(%rsp), %eax
imull %edx, %eax
movswl 0x4(%r13), %edi
subl %edx, %edi
cltd
idivl %edi
addl %eax, %esi
cmpw %si, %cx
jge 0x1d535
leaq 0x6(%rsp), %rax
jmp 0x1d53e
movswl %r14w, %eax
subl %r10d, %eax
imull %r9d, %eax
subl %r10d, %r8d
cltd
idivl %r8d
leal (%rsi,%rax), %ecx
decl %ecx
movw %cx, 0x4(%rsp)
testb %r11b, %r11b
je 0x1d54c
movswl 0x2(%r13), %edx
movl 0x30(%rsp), %eax
imull %edx, %eax
movswl 0x4(%r13), %edi
subl %edx, %edi
cltd
idivl %edi
subl %eax, %esi
cmpw %si, %cx
jle 0x1d543
movw %si, (%rsp)
jmp 0x1d54c
leaq 0x2(%rsp), %rax
movw %cx, 0x4(%rax)
movw %si, (%rax)
jmp 0x1d54c
movw %cx, (%rsp)
movw %si, 0x4(%rsp)
movl %r11d, %r14d
movzwl (%rsp), %eax
cmpw 0x4(%rsp), %ax
je 0x1d56e
movq %rsp, %rdi
movq %rbp, %rsi
movq 0x50(%rsp), %rdx
movl 0x1c(%rsp), %ecx
callq 0x365ac
movq %r15, %rdi
callq 0x6bbc
testb %al, %al
je 0x1d5b1
leaq 0x58(%rsp), %rbp
movq %rbp, %rdi
movq 0x38(%rsp), %rsi
callq 0x798d
movb $0x0, 0x8(%rbp)
movw $0x0, 0x12(%rbp)
leaq 0x10(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %rbp, %rdx
movq 0x40(%rsp), %rbp
movl 0x1c(%rsp), %ecx
callq 0x365ac
movq 0x20(%r15), %rax
movq %rax, 0x58(%rsp)
movb 0x22(%r13), %al
cmpw %r12w, %bx
jge 0x1d606
testb $0x1, %al
movl 0x1c(%rsp), %ecx
jne 0x1d646
movl 0x30(%rsp), %edx
movl %edx, %eax
shrl $0x1f, %eax
addl %edx, %eax
shrl %eax
negl %eax
testb %r14b, %r14b
je 0x1d5ec
cmpw $0x0, 0x2c(%rsp)
jle 0x1d7d1
addw 0x2(%rsp), %ax
movw %ax, 0x5a(%rsp)
leaq 0x5e(%rsp), %rsi
addw -0x4(%rsi), %bx
decl %ebx
jmp 0x1d737
testb $0x1, %al
movl 0x1c(%rsp), %ecx
jne 0x1d6a1
movl 0x34(%rsp), %edx
movl %edx, %eax
shrl $0x1f, %eax
addl %edx, %eax
shrl %eax
negl %eax
testb %r14b, %r14b
je 0x1d632
cmpw $0x0, 0x2c(%rsp)
jle 0x1d7db
addw 0x4(%rsp), %ax
movw %ax, 0x58(%rsp)
movzwl 0x58(%rsp), %eax
jmp 0x1d782
movswl 0xa(%r13), %esi
cmpl $-0x1, %esi
je 0x1d6fa
movl %ebx, %eax
notl %eax
addl %eax, %r12d
movswl %r12w, %edi
movswl 0x6(%r13), %eax
movswl 0x20(%rsp), %r8d
subl %r8d, %eax
imull %edi, %eax
movswl 0xe(%rsp), %r9d
subl %r8d, %r9d
cltd
idivl %r9d
movl %eax, %r10d
movswl 0x8(%r13), %eax
subl %r8d, %eax
imull %edi, %eax
cltd
idivl %r9d
movswl %r10w, %edx
cwtl
subl %edx, %eax
imull %esi, %eax
shrl $0x8, %eax
addl %r10d, %eax
jmp 0x1d71f
movswl 0xa(%r13), %esi
cmpl $-0x1, %esi
je 0x1d750
movl %r12d, %eax
notl %eax
addl %eax, %ebx
movswl %bx, %edi
movswl 0x6(%r13), %eax
movswl 0x20(%rsp), %r8d
subl %r8d, %eax
imull %edi, %eax
movswl 0xe(%rsp), %r9d
subl %r8d, %r9d
cltd
idivl %r9d
movl %eax, %r10d
movswl 0x8(%r13), %eax
subl %r8d, %eax
imull %edi, %eax
cltd
idivl %r9d
movswl %r10w, %edx
cwtl
subl %edx, %eax
imull %esi, %eax
sarl $0x8, %eax
addl %edx, %eax
jmp 0x1d773
movl 0x30(%rsp), %eax
notl %eax
movl 0x34(%rsp), %esi
addl %eax, %esi
movswl 0x2c(%rsp), %eax
movswl 0x20(%rsp), %edx
subl %edx, %eax
imull %esi, %eax
movswl 0xe(%rsp), %esi
subl %edx, %esi
cltd
idivl %esi
leaq 0x5a(%rsp), %rsi
movw %ax, 0x4(%rsi)
movzwl 0x26(%r15), %edx
subl %eax, %edx
movw %dx, 0x4(%rsi)
notl %ebx
addl %edx, %ebx
movw %bx, (%rsi)
movzwl 0x20(%r15), %eax
movw %ax, 0x58(%rsp)
movzwl 0x24(%r15), %eax
movw %ax, 0x5c(%rsp)
jmp 0x1d7a0
movl 0x34(%rsp), %esi
notl %esi
addl 0x30(%rsp), %esi
movswl 0x2c(%rsp), %eax
movswl 0x20(%rsp), %edx
subl %edx, %eax
imull %esi, %eax
movswl 0xe(%rsp), %esi
subl %edx, %esi
cltd
idivl %esi
movw %ax, 0x58(%rsp)
addw 0x20(%r15), %ax
movw %ax, 0x58(%rsp)
addl %r12d, %eax
decl %eax
movw %ax, 0x5c(%rsp)
movzwl 0x22(%r15), %eax
movw %ax, 0x5a(%rsp)
movzwl 0x26(%r15), %eax
movw %ax, 0x5e(%rsp)
leaq 0x58(%rsp), %rdi
movq %rbp, %rsi
movq 0xa0(%rsp), %rdx
callq 0x365ac
movl 0x4c(%rsp), %edx
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
cmpb $0x2, %dl
setne %al
retq
addw 0x6(%rsp), %ax
jmp 0x1d5f1
addw (%rsp), %ax
jmp 0x1d637