// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: worksheet_write_string
lxw_error
worksheet_write_string(lxw_worksheet *self,
                       lxw_row_t row_num,
                       lxw_col_t col_num, const char *string,
                       lxw_format *format)
{
    lxw_cell *cell;
    int32_t string_id;
    char *string_copy;
    struct sst_element *sst_element;
    lxw_error err;

    if (!string || !*string) {
        /* Treat a NULL or empty string with formatting as a blank cell. */
        /* Null strings without formats should be ignored.      */
        if (format)
            return worksheet_write_blank(self, row_num, col_num, format);
        else
            return LXW_NO_ERROR;
    }

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

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

    if (!self->optimize) {
        /* Get the SST element and string id. */
        sst_element = lxw_get_sst_index(self->sst, string, LXW_FALSE);

        if (!sst_element)
            return LXW_ERROR_SHARED_STRING_INDEX_NOT_FOUND;

        string_id = sst_element->index;
        cell = _new_string_cell(row_num, col_num, string_id,
                                sst_element->string, format);
    }
    else {
        /* Look for and escape control chars in the string. */
        if (lxw_has_control_characters(string)) {
            string_copy = lxw_escape_control_characters(string);
        }
        else {
            string_copy = lxw_strdup(string);
        }
        cell = _new_inline_string_cell(row_num, col_num, string_copy, format);
    }

    _insert_cell(self, row_num, col_num, cell);

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movw %dx, %ax
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movw %ax, -0x16(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x4829e
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x482d0
cmpq $0x0, -0x28(%rbp)
je 0x482c4
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movq -0x28(%rbp), %rcx
movzwl %ax, %edx
callq 0xc5f0
movl %eax, -0x4(%rbp)
jmp 0x483e0
movl $0x0, -0x4(%rbp)
jmp 0x483e0
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
xorl %r8d, %r8d
movzwl -0x16(%rbp), %edx
movl %r8d, %ecx
callq 0x4ff90
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x482fa
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x483e0
movq -0x20(%rbp), %rdi
callq 0xd180
cmpq $0x7fff, %rax           # imm = 0x7FFF
jbe 0x48317
movl $0x15, -0x4(%rbp)
jmp 0x483e0
movq -0x10(%rbp), %rax
cmpb $0x0, 0x11c(%rax)
jne 0x4837e
movq -0x10(%rbp), %rax
movq 0xb0(%rax), %rdi
movq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0xc380
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x48351
movl $0x16, -0x4(%rbp)
jmp 0x483e0
movq -0x48(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %edi
movw -0x16(%rbp), %ax
movl -0x34(%rbp), %edx
movq -0x48(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x28(%rbp), %r8
movzwl %ax, %esi
callq 0x502b0
movq %rax, -0x30(%rbp)
jmp 0x483c2
movq -0x20(%rbp), %rdi
callq 0xc9a0
cmpb $0x0, %al
je 0x4839a
movq -0x20(%rbp), %rdi
callq 0xca20
movq %rax, -0x40(%rbp)
jmp 0x483a7
movq -0x20(%rbp), %rdi
callq 0xcd80
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %edi
movw -0x16(%rbp), %ax
movq -0x40(%rbp), %rdx
movq -0x28(%rbp), %rcx
movzwl %ax, %esi
callq 0x50370
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %esi
movw -0x16(%rbp), %ax
movq -0x30(%rbp), %rcx
movzwl %ax, %edx
callq 0x50170
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)