// File: /workspace/github_c_makefile_star2_O3/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, %r14
movl $0x1, %edi
movl $0x40, %esi
callq 0xc7f0
testq %rax, %rax
je 0x23322
movq %rax, %rbx
movl 0xc(%r14), %eax
movl %eax, (%rbx)
movq %r15, %rdi
callq 0xcce0
movq %rax, 0x8(%rbx)
movb %bpl, 0x10(%rbx)
movq 0x18(%r14), %r12
movq (%r12), %rcx
testq %rcx, %rcx
je 0x23326
movq %rax, %r15
movq %rcx, %r13
movq 0x8(%rcx), %rsi
movq %r15, %rdi
callq 0xc800
movl $0x20, %ecx
testl %eax, %eax
js 0x23138
movl $0x28, %ecx
je 0x23373
movq (%r13,%rcx), %rcx
testq %rcx, %rcx
jne 0x23115
movq %r13, 0x30(%rbx)
movl $0x1, 0x38(%rbx)
notl %eax
shrl $0x1f, %eax
movq %rbx, 0x20(%r13,%rax,8)
xorl %eax, %eax
movq %rbx, %rdx
cmpl $0x1, 0x38(%r13)
jne 0x2331c
movq 0x30(%r13), %rcx
movq 0x20(%rcx), %rsi
cmpq %rsi, %r13
je 0x23198
testq %rsi, %rsi
je 0x23184
cmpl $0x1, 0x38(%rsi)
jne 0x23184
movl %eax, 0x38(%rsi)
jmp 0x231aa
movq 0x20(%r13), %rsi
cmpq %rdx, %rsi
je 0x231d1
movq %r13, %rsi
movq %rdx, %r13
jmp 0x23248
movq 0x28(%rcx), %rdi
testq %rdi, %rdi
je 0x231bd
cmpl $0x1, 0x38(%rdi)
jne 0x231bd
movl %eax, 0x38(%rdi)
movl %eax, 0x38(%r13)
movl $0x1, 0x38(%rcx)
movq %rcx, %r13
jmp 0x2330c
movq 0x28(%r13), %rdi
cmpq %rdx, %rdi
je 0x231f4
movq %r13, %rdi
movq %rdx, %r13
jmp 0x232c2
movq 0x28(%rsi), %rdi
movq %rdi, 0x20(%r13)
testq %rdi, %rdi
je 0x23222
movq %r13, 0x30(%rdi)
movq 0x30(%r13), %rdi
movq %rdi, 0x30(%rsi)
movq %r12, %r8
testq %rdi, %rdi
jne 0x2322a
jmp 0x2323a
movq 0x20(%rdi), %rsi
movq %rsi, 0x28(%r13)
testq %rsi, %rsi
je 0x23298
movq %r13, 0x30(%rsi)
movq 0x30(%r13), %rsi
movq %rsi, 0x30(%rdi)
movq %r12, %r8
testq %rsi, %rsi
jne 0x232a0
jmp 0x232b0
movq %rcx, 0x30(%rsi)
movq 0x30(%r13), %rdi
leaq 0x20(%rdi), %r9
leaq 0x28(%rdi), %r8
cmpq 0x20(%rdi), %r13
cmoveq %r9, %r8
movq %rsi, (%r8)
movq %r13, 0x28(%rsi)
movq %rsi, 0x30(%r13)
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 0x2326b
movq %rcx, 0x30(%rsi)
movq 0x30(%rcx), %rdi
movq %rdi, 0x30(%rdx)
movq %r12, %rsi
testq %rdi, %rdi
je 0x2328b
leaq 0x20(%rdi), %r8
leaq 0x28(%rdi), %rsi
cmpq 0x20(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x20(%rdx)
movq %rdx, 0x30(%rcx)
jmp 0x2330c
movq %rcx, 0x30(%rdi)
movq 0x30(%r13), %rsi
leaq 0x20(%rsi), %r9
leaq 0x28(%rsi), %r8
cmpq 0x20(%rsi), %r13
cmoveq %r9, %r8
movq %rdi, (%r8)
movq %r13, 0x20(%rdi)
movq %rdi, 0x30(%r13)
movq 0x20(%rcx), %rsi
movq %rdx, %rdi
movl $0x0, 0x38(%rdi)
movl $0x1, 0x38(%rcx)
movq 0x28(%rsi), %rdx
movq %rdx, 0x20(%rcx)
testq %rdx, %rdx
je 0x232e1
movq %rcx, 0x30(%rdx)
movq 0x30(%rcx), %rdi
movq %rdi, 0x30(%rsi)
movq %r12, %rdx
testq %rdi, %rdi
je 0x23301
leaq 0x20(%rdi), %r8
leaq 0x28(%rdi), %rdx
cmpq 0x20(%rdi), %rcx
cmoveq %r8, %rdx
movq %rsi, (%rdx)
movq %rcx, 0x28(%rsi)
movq %rsi, 0x30(%rcx)
movq %r13, %rdx
movq 0x30(%r13), %r13
testq %r13, %r13
jne 0x2315c
movq (%r12), %rax
jmp 0x23334
xorl %ebx, %ebx
jmp 0x2338a
movl $0x1, 0x38(%rbx)
movq %rbx, (%r12)
movq %rbx, %rax
movl $0x0, 0x38(%rax)
movq %rbx, %rax
addq $0x18, %rax
movq $0x0, 0x18(%rbx)
movq 0x10(%r14), %rcx
movq 0x8(%rcx), %rcx
movq %rbx, (%rcx)
movq 0x10(%r14), %rcx
movq %rax, 0x8(%rcx)
movq 0x8(%r14), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x8(%r14)
jmp 0x2338a
movq %r15, %rdi
callq 0xc0c0
movq %rbx, %rdi
callq 0xc0c0
incl 0x8(%r14)
movq %r13, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq