// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_write_comment_opt
lxw_error
worksheet_write_comment_opt(lxw_worksheet *self,
                            lxw_row_t row_num, lxw_col_t col_num,
                            const char *text, lxw_comment_options *options)
{
    lxw_cell *cell;
    lxw_error err;
    lxw_vml_obj *comment;

    err = _check_dimensions(self, row_num, col_num, LXW_FALSE, LXW_FALSE);
    if (err)
        return err;

    if (!text)
        return LXW_ERROR_NULL_PARAMETER_IGNORED;

    if (lxw_utf8_strlen(text) > LXW_STR_MAX)
        return LXW_ERROR_MAX_STRING_LENGTH_EXCEEDED;

    comment = calloc(1, sizeof(lxw_vml_obj));
    GOTO_LABEL_ON_MEM_ERROR(comment, mem_error);

    comment->text = lxw_strdup(text);
    GOTO_LABEL_ON_MEM_ERROR(comment->text, mem_error);

    comment->row = row_num;
    comment->col = col_num;

    cell = _new_comment_cell(row_num, col_num, comment);
    GOTO_LABEL_ON_MEM_ERROR(cell, mem_error);

    _insert_comment(self, row_num, col_num, cell);

    /* Set user and default parameters for the comment. */
    _get_comment_params(comment, options);

    self->has_vml = LXW_TRUE;
    self->has_comments = LXW_TRUE;

    /* Insert a placeholder in the cell RB table in the same position so
     * that the worksheet row "spans" calculations are correct. */
    _insert_cell_placeholder(self, row_num, col_num);

    return LXW_NO_ERROR;

mem_error:
    if (comment)
        _free_vml_object(comment);

    return LXW_ERROR_MEMORY_MALLOC_FAILED;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r13
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x39d04
movl %eax, %r12d
testl %eax, %eax
je 0x3acf1
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r13, %r13
je 0x3ae1b
movq %r13, %rdi
callq 0xd0d0
movl $0x15, %r12d
cmpq $0x7fff, %rax           # imm = 0x7FFF
ja 0x3acdf
movl $0x1, %edi
movl $0xc0, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3ae26
movq %rax, %r12
movq %r13, %rdi
callq 0xcce0
movq %rax, 0x98(%r12)
testq %rax, %rax
je 0x3ae2d
movl %ebx, (%r12)
movw %bp, 0x4(%r12)
movl $0x1, %edi
movl $0x68, %esi
callq 0xc7f0
testq %rax, %rax
je 0x3ae34
movq %rax, %r13
movl %ebx, (%rax)
movw %bp, 0x4(%rax)
movl $0xa, 0x8(%rax)
movq %r12, 0x18(%rax)
movq 0x30(%r14), %rdi
movl %ebx, %esi
callq 0x3f05b
movq 0x20(%rax), %rdi
movzwl %bp, %ebp
movq %r13, %rsi
movl %ebp, %edx
callq 0x3edcf
movq %r12, %rdi
movq %r15, %rsi
callq 0xce90
movw $0x101, 0x2a0(%r14)     # imm = 0x101
xorl %r12d, %r12d
cmpb $0x0, 0x11c(%r14)
jne 0x3acdf
xorl %r12d, %r12d
movl %ebx, %edi
movl %ebp, %esi
xorl %edx, %edx
callq 0x3a30f
testq %rax, %rax
je 0x3acdf
movq %rax, %r15
movq %r14, %rdi
movl %ebx, %esi
callq 0x3b2d7
movq 0x20(%rax), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x3ae0c
movzwl 0x4(%r15), %ecx
movl $0x48, %edx
cmpw 0x4(%rax), %cx
jb 0x3ae03
movl $0x50, %edx
je 0x3ae51
movq (%rax,%rdx), %rax
testq %rax, %rax
jne 0x3adf1
movq %r15, %rsi
movl %ebp, %edx
callq 0x3edcf
jmp 0x3acdf
movl $0xc, %r12d
jmp 0x3acdf
callq 0xf5db
jmp 0x3ae46
movl $0x2184, %edi           # imm = 0x2184
jmp 0x3ae3e
callq 0xf589
movl $0x218a, %edi           # imm = 0x218A
movq %r12, %rsi
callq 0xf5ad
movl $0x1, %r12d
jmp 0x3acdf
movq %r15, %rdi
callq 0x2fd13
jmp 0x3acdf