// File: /workspace/github_c_makefile_star2_O1/Paxa[P]fast_excel/libxlsxwriter/src/shared_strings.c
// Function: lxw_get_sst_index
struct sst_element *
lxw_get_sst_index(lxw_sst *sst, const char *string, uint8_t is_rich_string)
{
    struct sst_element *element;
    struct sst_element *existing_element;

    /* Create an sst element to potentially add to the table. */
    element = calloc(1, sizeof(struct sst_element));
    if (!element)
        return NULL;

    /* Create potential new element with the string and its index. */
    element->index = sst->unique_count;
    element->string = lxw_strdup(string);
    element->is_rich_string = is_rich_string;

    /* Try to insert it and see whether we already have that string. */
    existing_element = RB_INSERT(sst_rb_tree, sst->rb_tree, element);

    /* If existing_element is not NULL, then it already existed. */
    /* Free new created element. */
    if (existing_element) {
        free(element->string);
        free(element);
        sst->string_count++;
        return existing_element;
    }

    /* If it didn't exist, also add it to the insertion order linked list. */
    STAILQ_INSERT_TAIL(sst->order_list, element, sst_order_pointers);

    /* Update SST string counts. */
    sst->string_count++;
    sst->unique_count++;
    return element;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %rbx
movl $0x1, %edi
movl $0x40, %esi
callq 0xc7f0
testq %rax, %rax
je 0x230e8
movq %rax, %r14
movl 0xc(%rbx), %eax
movl %eax, (%r14)
movq %r15, %rdi
callq 0xcce0
movq %rax, 0x8(%r14)
movb %bpl, 0x10(%r14)
movq 0x18(%rbx), %r13
movq (%r13), %rcx
testq %rcx, %rcx
je 0x230f0
movq %rax, %r12
movq %rcx, %r15
movq 0x8(%rcx), %rsi
movq %r12, %rdi
callq 0xc800
movl $0x20, %ecx
testl %eax, %eax
js 0x230d0
movl $0x28, %ecx
je 0x232e1
movq (%r15,%rcx), %rcx
testq %rcx, %rcx
jne 0x230ad
notl %eax
shrl $0x1f, %eax
leaq 0x20(,%rax,8), %rax
jmp 0x230f8
xorl %r15d, %r15d
jmp 0x23327
movl $0x28, %eax
xorl %r15d, %r15d
movq %r15, 0x30(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movl $0x1, 0x38(%r14)
testq %r15, %r15
je 0x232cf
movq %r14, (%r15,%rax)
xorl %eax, %eax
movq %r14, %rdx
cmpl $0x1, 0x38(%r15)
jne 0x232d3
movq 0x30(%r15), %rcx
movq 0x20(%rcx), %rsi
cmpq %rsi, %r15
je 0x23155
testq %rsi, %rsi
je 0x23141
cmpl $0x1, 0x38(%rsi)
je 0x23164
movq 0x20(%r15), %rsi
cmpq %rdx, %rsi
je 0x23192
movq %r15, %rsi
movq %rdx, %r15
jmp 0x231d5
movq 0x28(%rcx), %rsi
testq %rsi, %rsi
je 0x2317a
cmpl $0x1, 0x38(%rsi)
jne 0x2317a
movl %eax, 0x38(%rsi)
movl %eax, 0x38(%r15)
movl $0x1, 0x38(%rcx)
movq %rcx, %r15
jmp 0x232bd
movq 0x28(%r15), %rsi
cmpq %rdx, %rsi
je 0x23228
movq %r15, %rsi
movq %rdx, %r15
jmp 0x2326b
movq 0x28(%rsi), %rdi
movq %rdi, 0x20(%r15)
testq %rdi, %rdi
je 0x231a3
movq %r15, 0x30(%rdi)
movq 0x30(%r15), %r8
movq %r8, 0x30(%rsi)
movq %r13, %rdi
testq %r8, %r8
je 0x231c7
movq 0x30(%r15), %r8
leaq 0x20(%r8), %r9
leaq 0x28(%r8), %rdi
cmpq 0x20(%r8), %r15
cmoveq %r9, %rdi
movq %rsi, (%rdi)
movq %r15, 0x28(%rsi)
movq %rsi, 0x30(%r15)
movq %rdx, %rsi
movl $0x0, 0x38(%rsi)
movl $0x1, 0x38(%rcx)
movq 0x28(%rcx), %rdx
movq 0x20(%rdx), %rsi
movq %rsi, 0x28(%rcx)
testq %rsi, %rsi
je 0x231f8
movq %rcx, 0x30(%rsi)
movq 0x30(%rcx), %rdi
movq %rdi, 0x30(%rdx)
movq %r13, %rsi
testq %rdi, %rdi
je 0x2321c
movq 0x30(%rcx), %rdi
leaq 0x20(%rdi), %r8
leaq 0x28(%rdi), %rsi
cmpq 0x20(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x20(%rdx)
jmp 0x232b9
movq 0x20(%rsi), %rdi
movq %rdi, 0x28(%r15)
testq %rdi, %rdi
je 0x23239
movq %r15, 0x30(%rdi)
movq 0x30(%r15), %r8
movq %r8, 0x30(%rsi)
movq %r13, %rdi
testq %r8, %r8
je 0x2325d
movq 0x30(%r15), %r8
leaq 0x20(%r8), %r9
leaq 0x28(%r8), %rdi
cmpq 0x20(%r8), %r15
cmoveq %r9, %rdi
movq %rsi, (%rdi)
movq %r15, 0x20(%rsi)
movq %rsi, 0x30(%r15)
movq %rdx, %rsi
movl $0x0, 0x38(%rsi)
movl $0x1, 0x38(%rcx)
movq 0x20(%rcx), %rdx
movq 0x28(%rdx), %rsi
movq %rsi, 0x20(%rcx)
testq %rsi, %rsi
je 0x2328e
movq %rcx, 0x30(%rsi)
movq 0x30(%rcx), %rdi
movq %rdi, 0x30(%rdx)
movq %r13, %rsi
testq %rdi, %rdi
je 0x232b2
movq 0x30(%rcx), %rdi
leaq 0x20(%rdi), %r8
leaq 0x28(%rdi), %rsi
cmpq 0x20(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x28(%rdx)
movq %rdx, 0x30(%rcx)
movq %r15, %rdx
movq 0x30(%r15), %r15
testq %r15, %r15
jne 0x2311e
jmp 0x232d3
movq %r14, (%r13)
movq (%r13), %rax
movl $0x0, 0x38(%rax)
xorl %r15d, %r15d
testq %r15, %r15
je 0x232fc
movq 0x8(%r14), %rdi
callq 0xc0c0
movq %r14, %rdi
callq 0xc0c0
incl 0x8(%rbx)
jmp 0x23327
movq %r14, %rax
addq $0x18, %rax
movq $0x0, 0x18(%r14)
movq 0x10(%rbx), %rcx
movq 0x8(%rcx), %rcx
movq %r14, (%rcx)
movq 0x10(%rbx), %rcx
movq %rax, 0x8(%rcx)
incl 0x8(%rbx)
incl 0xc(%rbx)
movq %r14, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)