// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl (%rdi), %r15d
movzwl 0x4(%rdi), %eax
testl %r15d, %r15d
je 0x3066c
leal -0xffffd(%r15), %ecx
movl $0xa, %ebp
cmpl $0x2, %ecx
ja 0x30671
movl %ecx, %ecx
leaq 0x16229(%rip), %rdx     # 0x46890
movl (%rdx,%rcx,4), %ebp
jmp 0x30671
movl $0x2, %ebp
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x3ffe, %ecx           # imm = 0x3FFE
movl $0x31, %ecx
movl $0xf, %r12d
cmovel %ecx, %r12d
cmpl $0x3ffd, %eax           # imm = 0x3FFD
cmovel %ecx, %r12d
testl %r15d, %r15d
je 0x306ab
leal -0xffffd(%r15), %ecx
cmpl $0x3, %ecx
jae 0x306b0
addl $-0x4, %r15d
jmp 0x306b3
xorl %r15d, %r15d
jmp 0x306b3
decl %r15d
movw $0x3ffa, %r13w          # imm = 0x3FFA
cmpl $0x3ffd, %eax           # imm = 0x3FFD
je 0x306e0
cmpl $0x3ffe, %eax           # imm = 0x3FFE
je 0x306d4
cmpl $0x3fff, %eax           # imm = 0x3FFF
jne 0x306db
movw $0x3ffc, %r13w          # imm = 0x3FFC
jmp 0x306e0
movw $0x3ffb, %r13w          # imm = 0x3FFB
jmp 0x306e0
incl %eax
movl %eax, %r13d
movabsq $0x4020000000000000, %rax # imm = 0x4020000000000000
movq %rax, 0x50(%rbx)
movb $0x2, 0x44(%rbx)
testq %r14, %r14
je 0x30706
movzwl 0x10(%r14), %eax
testl %eax, %eax
je 0x30727
cvtsi2sd %eax, %xmm0
jmp 0x3072f
movsd 0x12332(%rip), %xmm0    # 0x42a40
movsd 0x15ec2(%rip), %xmm1    # 0x465d8
movsd 0x15ec2(%rip), %xmm2    # 0x465e0
movapd %xmm0, %xmm3
jmp 0x3082d
movsd 0x15ea9(%rip), %xmm0    # 0x465d8
movzwl 0x12(%r14), %eax
testl %eax, %eax
movsd %xmm0, 0x8(%rsp)
je 0x30747
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
jmp 0x3074f
movsd 0x15e91(%rip), %xmm0    # 0x465e0
movsd %xmm0, (%rsp)
movsd 0x18(%r14), %xmm1
movsd 0x20(%r14), %xmm0
xorpd %xmm4, %xmm4
xorpd %xmm3, %xmm3
cmpltsd %xmm1, %xmm3
andpd %xmm3, %xmm1
movsd 0x122c7(%rip), %xmm2    # 0x42a40
andnpd %xmm2, %xmm3
cmpltsd %xmm0, %xmm4
andpd %xmm4, %xmm0
andnpd %xmm2, %xmm4
movl 0x4c(%r14), %eax
testl %eax, %eax
cmovnel %eax, %r12d
movl 0x50(%r14), %eax
testl %eax, %eax
cmovnel %eax, %ebp
movl 0x44(%r14), %eax
testl %eax, %eax
jne 0x307ad
cmpw $0x0, 0x48(%r14)
je 0x307b5
movzwl 0x48(%r14), %r13d
movl %eax, %r15d
orpd %xmm1, %xmm3
orpd %xmm0, %xmm4
movsd 0x38(%r14), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x307d2
movsd %xmm0, 0x50(%rbx)
movapd %xmm4, 0x10(%rsp)
movapd %xmm3, 0x20(%rsp)
movb 0x40(%r14), %al
testb %al, %al
je 0x307e9
movb %al, 0x44(%rbx)
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
movq %rax, 0x90(%rbx)
movsd 0x8(%rsp), %xmm1
movsd (%rsp), %xmm2
movapd 0x20(%rsp), %xmm0
movapd 0x10(%rsp), %xmm3
mulsd %xmm3, %xmm2
mulsd %xmm0, %xmm1
movsd 0xfc93(%rip), %xmm0     # 0x404d0
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %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 $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq