// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/packager.c
// Function: write_drawing_rels_file
STATIC lxw_error
_write_drawing_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 = 1;
    lxw_error err;

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

        if (STAILQ_EMPTY(worksheet->drawing_links))
            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->drawing_links, list_pointers) {
            lxw_add_worksheet_relationship(rels, rel->type, rel->target,
                                           rel->target_mode);

        }

        lxw_snprintf(sheetname, LXW_FILENAME_LENGTH,
                     "xl/drawings/_rels/drawing%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 $0x1, -0xd4(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x2f3fd
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2f2ad
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2f2b9
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x228(%rax), %rax
cmpq $0x0, (%rax)
jne 0x2f2cf
jmp 0x2f3ec
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 0x2f316
movq -0x18(%rbp), %rdi
callq 0xc2c0
movl $0x3, -0x4(%rbp)
jmp 0x2f404
movq -0x48(%rbp), %rax
movq 0x228(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2f35d
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 0x2f328
leaq -0xd0(%rbp), %rdi
movl -0xd4(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
movl $0x80, %esi
leaq 0x39aed(%rip), %rdx     # 0x68e6e
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 0x2f3e8
movl -0xd8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2f404
jmp 0x2f3ea
jmp 0x2f3ec
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2f287
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq