// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/packager.c
// Function: write_worksheet_rels_file
STATIC lxw_error
_write_worksheet_rels_file(lxw_packager *self)
{
    lxw_relationships *rels;
    char *buffer = NULL;
    size_t buffer_size = 0;
    lxw_rel_tuple *rel;
    lxw_workbook *workbook = self->workbook;
    lxw_sheet *sheet;
    lxw_worksheet *worksheet;
    char sheetname[LXW_FILENAME_LENGTH] = { 0 };
    uint32_t index = 0;
    lxw_error err;

    STAILQ_FOREACH(sheet, workbook->sheets, list_pointers) {
        if (sheet->is_chartsheet)
            continue;
        else
            worksheet = sheet->u.worksheet;

        index++;

        if (STAILQ_EMPTY(worksheet->external_hyperlinks) &&
            STAILQ_EMPTY(worksheet->external_drawing_links) &&
            STAILQ_EMPTY(worksheet->external_table_links) &&
            !worksheet->external_vml_header_link &&
            !worksheet->external_vml_comment_link &&
            !worksheet->external_background_link &&
            !worksheet->external_comment_link)
            continue;

        rels = lxw_relationships_new();

        rels->file = lxw_get_filehandle(&buffer, &buffer_size, self->tmpdir);
        if (!rels->file) {
            lxw_free_relationships(rels);
            return LXW_ERROR_CREATING_TMPFILE;
        }

        STAILQ_FOREACH(rel, worksheet->external_hyperlinks, list_pointers) {
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);
        }

        STAILQ_FOREACH(rel, worksheet->external_drawing_links, list_pointers) {
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);
        }

        rel = worksheet->external_vml_comment_link;
        if (rel)
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);

        rel = worksheet->external_vml_header_link;
        if (rel)
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);

        rel = worksheet->external_background_link;
        if (rel)
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);

        STAILQ_FOREACH(rel, worksheet->external_table_links, list_pointers) {
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);
        }

        rel = worksheet->external_comment_link;
        if (rel)
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);

        lxw_snprintf(sheetname, LXW_FILENAME_LENGTH,
                     "xl/worksheets/_rels/sheet%d.xml.rels", index);

        lxw_relationships_assemble_xml_file(rels);

        err = _add_to_zip(self, rels->file, &buffer, &buffer_size, sheetname);

        fclose(rels->file);
        free(buffer);
        lxw_free_relationships(rels);

        RETURN_ON_ERROR(err);
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xc6a0
movl $0x0, -0xd4(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x2efe4
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2ecd0
jmp 0x2efd3
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movq -0x48(%rbp), %rax
movq 0x218(%rax), %rax
cmpq $0x0, (%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
movq 0x220(%rax), %rax
cmpq $0x0, (%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
movq 0x238(%rax), %rax
cmpq $0x0, (%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
cmpq $0x0, 0x2b8(%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
cmpq $0x0, 0x2a8(%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
cmpq $0x0, 0x2c0(%rax)
jne 0x2ed5b
movq -0x48(%rbp), %rax
cmpq $0x0, 0x2b0(%rax)
jne 0x2ed5b
jmp 0x2efd3
callq 0xcfb0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xceb0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2eda2
movq -0x18(%rbp), %rdi
callq 0xc2c0
movl $0x3, -0x4(%rbp)
jmp 0x2efeb
movq -0x48(%rbp), %rax
movq 0x218(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ede9
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x2edb4
movq -0x48(%rbp), %rax
movq 0x220(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ee30
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x2edfb
movq -0x48(%rbp), %rax
movq 0x2a8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ee66
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x48(%rbp), %rax
movq 0x2b8(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ee9c
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x48(%rbp), %rax
movq 0x2c0(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2eed2
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x48(%rbp), %rax
movq 0x238(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ef19
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x2eee4
movq -0x48(%rbp), %rax
movq 0x2b0(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2ef4f
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
callq 0xcaa0
leaq -0xd0(%rbp), %rdi
movl -0xd4(%rbp), %ecx
movl $0x80, %esi
leaq 0x39ebb(%rip), %rdx     # 0x68e23
movb $0x0, %al
callq 0xc5d0
movq -0x18(%rbp), %rdi
callq 0xc340
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
leaq -0xd0(%rbp), %r8
leaq -0x20(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x2fd50
movl %eax, -0xd8(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0x20(%rbp), %rdi
callq 0xc0d0
movq -0x18(%rbp), %rdi
callq 0xc2c0
cmpl $0x0, -0xd8(%rbp)
je 0x2efcf
movl -0xd8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2efeb
jmp 0x2efd1
jmp 0x2efd3
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2ecb7
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)