// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: get_comment_params
void
_get_comment_params(lxw_vml_obj *comment, lxw_comment_options *options)
{

    lxw_row_t start_row;
    lxw_col_t start_col;
    int32_t x_offset;
    int32_t y_offset;
    uint32_t height = 74;
    uint32_t width = 128;
    double x_scale = 1.0;
    double y_scale = 1.0;
    lxw_row_t row = comment->row;
    lxw_col_t col = comment->col;;

    /* Set the default start cell and offsets for the comment. These are
     * generally fixed in relation to the parent cell. However there are some
     * edge cases for cells at the, well yes, edges. */
    if (row == 0)
        y_offset = 2;
    else if (row == LXW_ROW_MAX - 3)
        y_offset = 16;
    else if (row == LXW_ROW_MAX - 2)
        y_offset = 16;
    else if (row == LXW_ROW_MAX - 1)
        y_offset = 14;
    else
        y_offset = 10;

    if (col == LXW_COL_MAX - 3)
        x_offset = 49;
    else if (col == LXW_COL_MAX - 2)
        x_offset = 49;
    else if (col == LXW_COL_MAX - 1)
        x_offset = 49;
    else
        x_offset = 15;

    if (row == 0)
        start_row = 0;
    else if (row == LXW_ROW_MAX - 3)
        start_row = LXW_ROW_MAX - 7;
    else if (row == LXW_ROW_MAX - 2)
        start_row = LXW_ROW_MAX - 6;
    else if (row == LXW_ROW_MAX - 1)
        start_row = LXW_ROW_MAX - 5;
    else
        start_row = row - 1;

    if (col == LXW_COL_MAX - 3)
        start_col = LXW_COL_MAX - 6;
    else if (col == LXW_COL_MAX - 2)
        start_col = LXW_COL_MAX - 5;
    else if (col == LXW_COL_MAX - 1)
        start_col = LXW_COL_MAX - 4;
    else
        start_col = col + 1;

    /* Set the default font properties. */
    comment->font_size = 8;
    comment->font_family = 2;

    /* Set any user defined options. */
    if (options) {

        if (options->width > 0.0)
            width = options->width;

        if (options->height > 0.0)
            height = options->height;

        if (options->x_scale > 0.0)
            x_scale = options->x_scale;

        if (options->y_scale > 0.0)
            y_scale = options->y_scale;

        if (options->x_offset != 0)
            x_offset = options->x_offset;

        if (options->y_offset != 0)
            y_offset = options->y_offset;

        if (options->start_row > 0 || options->start_col > 0) {
            start_row = options->start_row;
            start_col = options->start_col;
        }

        if (options->font_size > 0.0)
            comment->font_size = options->font_size;

        if (options->font_family > 0)
            comment->font_family = options->font_family;

        comment->visible = options->visible;
        comment->color = options->color;
        comment->author = lxw_strdup(options->author);
        comment->font_name = lxw_strdup(options->font_name);
    }

    /* Scale the width/height to the default/user scale and round to the
     * nearest pixel. */
    width = (uint32_t) (0.5 + x_scale * width);
    height = (uint32_t) (0.5 + y_scale * height);

    comment->width = width;
    comment->height = height;
    comment->start_col = start_col;
    comment->start_row = start_row;
    comment->x_offset = x_offset;
    comment->y_offset = y_offset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdi), %r15d
movzwl 0x4(%rdi), %eax
movl $0x10, %ebp
leal -0xffffd(%r15), %ecx
cmpl $0x2, %ecx
jb 0x3082c
testl %r15d, %r15d
je 0x307f0
cmpl $0xfffff, %r15d         # imm = 0xFFFFF
jne 0x30827
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x3ffe, %ecx           # imm = 0x3FFE
movl $0x31, %r12d
movl $0xf, %ecx
cmovel %r12d, %ecx
movw $0x3ffa, %r13w          # imm = 0x3FFA
movl $0xe, %ebp
movl $0xffffb, %r15d         # imm = 0xFFFFB
jmp 0x30817
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x3ffe, %ecx           # imm = 0x3FFE
movl $0x31, %r12d
movl $0xf, %ecx
cmovel %r12d, %ecx
xorl %r15d, %r15d
movw $0x3ffa, %r13w          # imm = 0x3FFA
movl $0x2, %ebp
cmpl $0x3ffd, %eax           # imm = 0x3FFD
cmovel %r12d, %ecx
jne 0x3088e
jmp 0x308b5
movl $0xa, %ebp
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x3ffe, %ecx           # imm = 0x3FFE
movl $0x31, %r12d
movl $0xf, %ecx
cmovel %r12d, %ecx
cmpl $0x3ffd, %eax           # imm = 0x3FFD
cmovel %r12d, %ecx
cmpl $0xffffd, %r15d         # imm = 0xFFFFD
je 0x30869
cmpl $0xffffe, %r15d         # imm = 0xFFFFE
jne 0x3087d
movl $0xffffa, %r15d         # imm = 0xFFFFA
jmp 0x30880
movw $0x3ffa, %r13w          # imm = 0x3FFA
movl $0xffff9, %r15d         # imm = 0xFFFF9
cmpl $0x3ffd, %eax           # imm = 0x3FFD
je 0x308b5
jmp 0x3088e
decl %r15d
cmpl $0x3ffd, %eax           # imm = 0x3FFD
jne 0x3088e
movw $0x3ffa, %r13w          # imm = 0x3FFA
jmp 0x308b5
cmpl $0x3ffe, %eax           # imm = 0x3FFE
je 0x308a3
cmpl $0x3fff, %eax           # imm = 0x3FFF
jne 0x308ad
movw $0x3ffc, %r13w          # imm = 0x3FFC
jmp 0x308a8
movw $0x3ffb, %r13w          # imm = 0x3FFB
movl %ecx, %r12d
jmp 0x308b5
incl %eax
movl %ecx, %r12d
movl %eax, %r13d
movabsq $0x4020000000000000, %rax # imm = 0x4020000000000000
movq %rax, 0x50(%rbx)
movb $0x2, 0x44(%rbx)
testq %r14, %r14
je 0x308db
movzwl 0x10(%r14), %eax
testl %eax, %eax
je 0x308f8
cvtsi2sd %eax, %xmm0
jmp 0x30900
movapd 0x15d3d(%rip), %xmm3    # 0x46620
movsd 0x15df5(%rip), %xmm1    # 0x466e0
movsd 0x15df5(%rip), %xmm2    # 0x466e8
jmp 0x309e2
movsd 0x15de0(%rip), %xmm0    # 0x466e0
movzwl 0x12(%r14), %eax
testl %eax, %eax
movsd %xmm0, 0x8(%rsp)
je 0x30918
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
jmp 0x30920
movsd 0x15dc8(%rip), %xmm0    # 0x466e8
movsd %xmm0, (%rsp)
movupd 0x18(%r14), %xmm3
xorpd %xmm0, %xmm0
movl 0x4c(%r14), %eax
testl %eax, %eax
cmovnel %eax, %r12d
movl 0x50(%r14), %eax
testl %eax, %eax
cmovnel %eax, %ebp
cmpltpd %xmm3, %xmm0
movl 0x44(%r14), %eax
movl 0x48(%r14), %ecx
xorl %edx, %edx
testw %cx, %cx
sete %sil
cmovnel %edx, %r15d
testb $0x1, %sil
cmovel %ecx, %r13d
testl %eax, %eax
cmovnel %ecx, %r13d
cmovnel %eax, %r15d
movsd 0x38(%r14), %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x30983
movsd %xmm1, 0x50(%rbx)
andpd %xmm0, %xmm3
andnpd 0x15c91(%rip), %xmm0    # 0x46620
movb 0x40(%r14), %al
testb %al, %al
je 0x3099a
movb %al, 0x44(%rbx)
orpd %xmm0, %xmm3
movapd %xmm3, 0x10(%rsp)
movb (%r14), %al
movb %al, 0x45(%rbx)
movl 0x28(%r14), %eax
movl %eax, 0x40(%rbx)
movq 0x8(%r14), %rdi
callq 0xcce0
movq %rax, 0x88(%rbx)
movq 0x30(%r14), %rdi
callq 0xcce0
movapd 0x10(%rsp), %xmm3
movq %rax, 0x90(%rbx)
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm2
mulsd %xmm3, %xmm1
movsd 0xfada(%rip), %xmm0     # 0x404c8
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
mulsd %xmm2, %xmm3
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %rcx
movl %eax, 0x28(%rbx)
movl %ecx, 0x2c(%rbx)
movw %r13w, 0xc(%rbx)
movl %r15d, 0x8(%rbx)
movl %r12d, 0x10(%rbx)
movl %ebp, 0x14(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq