// File: /workspace/github_c_makefile_star2_O3/Paxa[P]fast_excel/libxlsxwriter/src/worksheet.c
// Function: get_drawing_rel_index
STATIC uint32_t
_get_drawing_rel_index(lxw_worksheet *self, char *target)
{
    lxw_drawing_rel_id tmp_drawing_rel_id;
    lxw_drawing_rel_id *found_duplicate_target = NULL;
    lxw_drawing_rel_id *new_drawing_rel_id = NULL;

    if (target) {
        tmp_drawing_rel_id.target = target;
        found_duplicate_target = RB_FIND(lxw_drawing_rel_ids,
                                         self->drawing_rel_ids,
                                         &tmp_drawing_rel_id);
    }

    if (found_duplicate_target) {
        return found_duplicate_target->id;
    }
    else {
        self->drawing_rel_id++;

        if (target) {
            new_drawing_rel_id = calloc(1, sizeof(lxw_drawing_rel_id));

            if (new_drawing_rel_id) {
                new_drawing_rel_id->id = self->drawing_rel_id;
                new_drawing_rel_id->target = lxw_strdup(target);

                RB_INSERT(lxw_drawing_rel_ids, self->drawing_rel_ids,
                          new_drawing_rel_id);
            }
        }

        return self->drawing_rel_id;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
testq %rsi, %rsi
je 0x31a3e
movq %rsi, %r12
movq 0x70(%r15), %rdi
callq 0x3de97
movq %rax, %rbx
testq %rax, %rax
jne 0x31a64
leaq 0x20c(%r15), %rbx
movl 0x20c(%r15), %ebp
incl %ebp
movl %ebp, 0x20c(%r15)
movl $0x1, %edi
movl $0x30, %esi
callq 0xc7f0
testq %rax, %rax
je 0x31a64
movq %rax, %r14
movl %ebp, (%rax)
movq %r12, %rdi
callq 0xcce0
movq %rax, 0x8(%r14)
movq 0x70(%r15), %r15
movq (%r15), %rcx
testq %rcx, %rcx
je 0x31a51
movq %rax, %r12
movq %rcx, %r13
movq 0x8(%rcx), %rsi
movq %r12, %rdi
callq 0xc800
movl $0x10, %ecx
testl %eax, %eax
js 0x3185f
movl $0x18, %ecx
je 0x31a64
movq (%r13,%rcx), %rcx
testq %rcx, %rcx
jne 0x3183c
movq %r13, 0x20(%r14)
movl $0x1, 0x28(%r14)
notl %eax
shrl $0x1f, %eax
movq %r14, 0x10(%r13,%rax,8)
xorl %eax, %eax
cmpl $0x1, 0x28(%r13)
jne 0x31a39
movq 0x20(%r13), %rcx
movq 0x10(%rcx), %rdx
cmpq %rdx, %r13
je 0x318bd
testq %rdx, %rdx
je 0x318a9
cmpl $0x1, 0x28(%rdx)
jne 0x318a9
movl %eax, 0x28(%rdx)
jmp 0x318cf
movq 0x10(%r13), %rdx
cmpq %r14, %rdx
je 0x318f6
movq %r13, %rdx
movq %r14, %r13
jmp 0x31969
movq 0x18(%rcx), %rsi
testq %rsi, %rsi
je 0x318e2
cmpl $0x1, 0x28(%rsi)
jne 0x318e2
movl %eax, 0x28(%rsi)
movl %eax, 0x28(%r13)
movl $0x1, 0x28(%rcx)
movq %rcx, %r13
jmp 0x31a29
movq 0x18(%r13), %rsi
cmpq %r14, %rsi
je 0x31919
movq %r13, %rsi
movq %r14, %r13
jmp 0x319df
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%r13)
testq %rsi, %rsi
je 0x31943
movq %r13, 0x20(%rsi)
movq 0x20(%r13), %rsi
movq %rsi, 0x20(%rdx)
movq %r15, %rdi
testq %rsi, %rsi
jne 0x3194b
jmp 0x3195b
movq 0x10(%rsi), %rdx
movq %rdx, 0x18(%r13)
testq %rdx, %rdx
je 0x319b5
movq %r13, 0x20(%rdx)
movq 0x20(%r13), %rdx
movq %rdx, 0x20(%rsi)
movq %r15, %rdi
testq %rdx, %rdx
jne 0x319bd
jmp 0x319cd
movq %rcx, 0x20(%rdx)
movq 0x20(%r13), %rsi
leaq 0x10(%rsi), %r8
leaq 0x18(%rsi), %rdi
cmpq 0x10(%rsi), %r13
cmoveq %r8, %rdi
movq %rdx, (%rdi)
movq %r13, 0x18(%rdx)
movq %rdx, 0x20(%r13)
movq %r14, %rdx
movl $0x0, 0x28(%rdx)
movl $0x1, 0x28(%rcx)
movq 0x18(%rcx), %rdx
movq 0x10(%rdx), %rsi
movq %rsi, 0x18(%rcx)
testq %rsi, %rsi
je 0x3198c
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r15, %rsi
testq %rdi, %rdi
je 0x319ac
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x10(%rdx)
jmp 0x31a25
movq %rcx, 0x20(%rsi)
movq 0x20(%r13), %rdx
leaq 0x10(%rdx), %r8
leaq 0x18(%rdx), %rdi
cmpq 0x10(%rdx), %r13
cmoveq %r8, %rdi
movq %rsi, (%rdi)
movq %r13, 0x10(%rsi)
movq %rsi, 0x20(%r13)
movq 0x10(%rcx), %rdx
movq %r14, %rsi
movl $0x0, 0x28(%rsi)
movl $0x1, 0x28(%rcx)
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rcx)
testq %rsi, %rsi
je 0x319fe
movq %rcx, 0x20(%rsi)
movq 0x20(%rcx), %rdi
movq %rdi, 0x20(%rdx)
movq %r15, %rsi
testq %rdi, %rdi
je 0x31a1e
leaq 0x10(%rdi), %r8
leaq 0x18(%rdi), %rsi
cmpq 0x10(%rdi), %rcx
cmoveq %r8, %rsi
movq %rdx, (%rsi)
movq %rcx, 0x18(%rdx)
movq %rdx, 0x20(%rcx)
movq %r13, %r14
movq 0x20(%r13), %r13
testq %r13, %r13
jne 0x31881
movq (%r15), %r14
jmp 0x31a5c
incl 0x20c(%r15)
addq $0x20c, %r15            # imm = 0x20C
movq %r15, %rbx
jmp 0x31a64
movl $0x1, 0x28(%r14)
movq %r14, (%r15)
movl $0x0, 0x28(%r14)
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq