// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_position_object_pixels
STATIC void
_worksheet_position_object_pixels(lxw_worksheet *self,
                                  lxw_object_properties *object_props,
                                  lxw_drawing_object *drawing_object)
{
    lxw_col_t col_start;        /* Column containing upper left corner.  */
    int32_t x1;                 /* Distance to left side of object.      */

    lxw_row_t row_start;        /* Row containing top left corner.       */
    int32_t y1;                 /* Distance to top of object.            */

    lxw_col_t col_end;          /* Column containing lower right corner. */
    double x2;                  /* Distance to right side of object.     */

    lxw_row_t row_end;          /* Row containing bottom right corner.   */
    double y2;                  /* Distance to bottom of object.         */

    double width;               /* Width of object frame.                */
    double height;              /* Height of object frame.               */

    uint32_t x_abs = 0;         /* Abs. distance to left side of object. */
    uint32_t y_abs = 0;         /* Abs. distance to top  side of object. */

    uint32_t i;
    uint8_t anchor = drawing_object->anchor;
    uint8_t ignore_anchor = LXW_OBJECT_POSITION_DEFAULT;

    col_start = object_props->col;
    row_start = object_props->row;
    x1 = object_props->x_offset;
    y1 = object_props->y_offset;
    width = object_props->width;
    height = object_props->height;

    /* Adjust start column for negative offsets. */
    while (x1 < 0 && col_start > 0) {
        x1 += _worksheet_size_col(self, col_start - 1, ignore_anchor);
        col_start--;
    }

    /* Adjust start row for negative offsets. */
    while (y1 < 0 && row_start > 0) {
        y1 += _worksheet_size_row(self, row_start - 1, ignore_anchor);
        row_start--;
    }

    /* Ensure that the image isn't shifted off the page at top left. */
    if (x1 < 0)
        x1 = 0;

    if (y1 < 0)
        y1 = 0;

    /* Calculate the absolute x offset of the top-left vertex. */
    if (self->col_size_changed) {
        for (i = 0; i < col_start; i++)
            x_abs += _worksheet_size_col(self, i, ignore_anchor);
    }
    else {
        /* Optimization for when the column widths haven't changed. */
        x_abs += self->default_col_pixels * col_start;
    }

    x_abs += x1;

    /* Calculate the absolute y offset of the top-left vertex. */
    /* Store the column change to allow optimizations. */
    if (self->row_size_changed) {
        for (i = 0; i < row_start; i++)
            y_abs += _worksheet_size_row(self, i, ignore_anchor);
    }
    else {
        /* Optimization for when the row heights haven"t changed. */
        y_abs += self->default_row_pixels * row_start;
    }

    y_abs += y1;

    /* Adjust start col for offsets that are greater than the col width. */
    while (x1 >= _worksheet_size_col(self, col_start, anchor)) {
        x1 -= _worksheet_size_col(self, col_start, ignore_anchor);
        col_start++;
    }

    /* Adjust start row for offsets that are greater than the row height. */
    while (y1 >= _worksheet_size_row(self, row_start, anchor)) {
        y1 -= _worksheet_size_row(self, row_start, ignore_anchor);
        row_start++;
    }

    /* Initialize end cell to the same as the start cell. */
    col_end = col_start;
    row_end = row_start;

    /* Only offset the image in the cell if the row/col is hidden. */
    if (_worksheet_size_col(self, col_start, anchor) > 0)
        width = width + x1;
    if (_worksheet_size_row(self, row_start, anchor) > 0)
        height = height + y1;

    /* Subtract the underlying cell widths to find the end cell. */
    while (width >= _worksheet_size_col(self, col_end, anchor)) {
        width -= _worksheet_size_col(self, col_end, anchor);
        col_end++;
    }

    /* Subtract the underlying cell heights to find the end cell. */
    while (height >= _worksheet_size_row(self, row_end, anchor)) {
        height -= _worksheet_size_row(self, row_end, anchor);
        row_end++;
    }

    /* The end vertices are whatever is left from the width and height. */
    x2 = width;
    y2 = height;

    /* Add the dimensions to the drawing object. */
    drawing_object->from.col = col_start;
    drawing_object->from.row = row_start;
    drawing_object->from.col_offset = x1;
    drawing_object->from.row_offset = y1;
    drawing_object->to.col = col_end;
    drawing_object->to.row = row_end;
    drawing_object->to.col_offset = x2;
    drawing_object->to.row_offset = y2;
    drawing_object->col_absolute = x_abs;
    drawing_object->row_absolute = y_abs;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x5c(%rbp)
movl $0x0, -0x60(%rbp)
movq -0x18(%rbp), %rax
movb 0x1(%rax), %al
movb %al, -0x65(%rbp)
movb $0x0, -0x66(%rbp)
movq -0x10(%rbp), %rax
movw 0x1c(%rax), %ax
movw %ax, -0x1a(%rbp)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movsd 0x68(%rax), %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x10(%rbp), %rax
movsd 0x70(%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x20(%rbp)
movb %al, -0x67(%rbp)
jge 0x48f90
movzwl -0x1a(%rbp), %eax
cmpl $0x0, %eax
setg %al
movb %al, -0x67(%rbp)
movb -0x67(%rbp), %al
testb $0x1, %al
jne 0x48f99
jmp 0x48fc4
movq -0x8(%rbp), %rdi
movzwl -0x1a(%rbp), %eax
subl $0x1, %eax
movzwl %ax, %esi
movzbl -0x66(%rbp), %edx
callq 0x59960
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movw -0x1a(%rbp), %ax
addw $-0x1, %ax
movw %ax, -0x1a(%rbp)
jmp 0x48f78
jmp 0x48fc6
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x68(%rbp)
jge 0x48fdb
cmpl $0x0, -0x24(%rbp)
seta %al
movb %al, -0x68(%rbp)
movb -0x68(%rbp), %al
testb $0x1, %al
jne 0x48fe4
jmp 0x49008
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
subl $0x1, %esi
movzbl -0x66(%rbp), %edx
callq 0x59ac0
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x48fc6
cmpl $0x0, -0x20(%rbp)
jge 0x49015
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0x28(%rbp)
jge 0x49022
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x11a(%rax)
je 0x49067
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movzwl -0x1a(%rbp), %ecx
cmpl %ecx, %eax
jae 0x49065
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %eax
movzwl %ax, %esi
movzbl -0x66(%rbp), %edx
callq 0x59960
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x49036
jmp 0x4907e
movq -0x8(%rbp), %rax
movl 0x1a4(%rax), %eax
movzwl -0x1a(%rbp), %ecx
imull %ecx, %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movl -0x20(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x11b(%rax)
je 0x490c6
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x24(%rbp), %eax
jae 0x490c4
movq -0x8(%rbp), %rdi
movl -0x64(%rbp), %esi
movzbl -0x66(%rbp), %edx
callq 0x59ac0
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x4909b
jmp 0x490da
movq -0x8(%rbp), %rax
movl 0x1a0(%rax), %eax
imull -0x24(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x28(%rbp), %eax
addl -0x60(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
movw -0x1a(%rbp), %ax
movzwl %ax, %esi
movzbl -0x65(%rbp), %edx
callq 0x59960
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jl 0x49132
movq -0x8(%rbp), %rdi
movw -0x1a(%rbp), %ax
movzwl %ax, %esi
movzbl -0x66(%rbp), %edx
callq 0x59960
movl %eax, %ecx
movl -0x20(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x20(%rbp)
movw -0x1a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1a(%rbp)
jmp 0x490e3
jmp 0x49134
movl -0x28(%rbp), %eax
movl %eax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movzbl -0x65(%rbp), %edx
callq 0x59ac0
movl %eax, %ecx
movl -0x70(%rbp), %eax
cmpl %ecx, %eax
jl 0x49178
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movzbl -0x66(%rbp), %edx
callq 0x59ac0
movl %eax, %ecx
movl -0x28(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x49134
movw -0x1a(%rbp), %ax
movw %ax, -0x2a(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movw -0x1a(%rbp), %ax
movzwl %ax, %esi
movzbl -0x65(%rbp), %edx
callq 0x59960
cmpl $0x0, %eax
jle 0x491b2
movsd -0x50(%rbp), %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
movzbl -0x65(%rbp), %edx
callq 0x59ac0
cmpl $0x0, %eax
jle 0x491da
movsd -0x58(%rbp), %xmm0
cvtsi2sdl -0x28(%rbp), %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
jmp 0x491dc
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movw -0x2a(%rbp), %ax
movzwl %ax, %esi
movzbl -0x65(%rbp), %edx
callq 0x59960
movsd -0x78(%rbp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4923d
movq -0x8(%rbp), %rdi
movw -0x2a(%rbp), %ax
movzwl %ax, %esi
movzbl -0x65(%rbp), %edx
callq 0x59960
cvtsi2sd %eax, %xmm1
movsd -0x50(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x50(%rbp)
movw -0x2a(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x2a(%rbp)
jmp 0x491dc
jmp 0x4923f
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
movzbl -0x65(%rbp), %edx
callq 0x59ac0
movsd -0x80(%rbp), %xmm0
cvtsi2sd %eax, %xmm1
ucomisd %xmm1, %xmm0
jb 0x49295
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %esi
movzbl -0x65(%rbp), %edx
callq 0x59ac0
cvtsi2sd %eax, %xmm1
movsd -0x58(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x4923f
movsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movzwl -0x1a(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x24(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0xc(%rax)
cvtsi2sdl -0x20(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x10(%rax)
cvtsi2sdl -0x28(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x18(%rax)
movzwl -0x2a(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x3c(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movsd -0x48(%rbp), %xmm0
movq -0x18(%rbp), %rax
movsd %xmm0, 0x30(%rax)
movl -0x5c(%rbp), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, 0x38(%rax)
movl -0x60(%rbp), %eax
movl %eax, %ecx
movq -0x18(%rbp), %rax
movq %rcx, 0x40(%rax)
addq $0x80, %rsp
popq %rbp
retq
nop