// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/packager.c
// Function: write_content_types_file
STATIC lxw_error
_write_content_types_file(lxw_packager *self)
{
    lxw_content_types *content_types = lxw_content_types_new();
    char *buffer = NULL;
    size_t buffer_size = 0;
    lxw_workbook *workbook = self->workbook;
    lxw_sheet *sheet;
    char filename[LXW_MAX_ATTRIBUTE_LENGTH] = { 0 };
    uint32_t index = 1;
    uint32_t worksheet_index = 1;
    uint32_t chartsheet_index = 1;
    uint32_t drawing_count = _get_drawing_count(self);
    uint32_t chart_count = _get_chart_count(self);
    uint32_t table_count = _get_table_count(self);
    lxw_error err = LXW_NO_ERROR;

    if (!content_types) {
        err = LXW_ERROR_MEMORY_MALLOC_FAILED;
        goto mem_error;
    }

    content_types->file = lxw_get_filehandle(&buffer, &buffer_size,
                                             self->tmpdir);
    if (!content_types->file) {
        err = LXW_ERROR_CREATING_TMPFILE;
        goto mem_error;
    }

    if (workbook->has_png)
        lxw_ct_add_default(content_types, "png", "image/png");

    if (workbook->has_jpeg)
        lxw_ct_add_default(content_types, "jpeg", "image/jpeg");

    if (workbook->has_bmp)
        lxw_ct_add_default(content_types, "bmp", "image/bmp");

    if (workbook->has_gif)
        lxw_ct_add_default(content_types, "gif", "image/gif");

    if (workbook->vba_project)
        lxw_ct_add_default(content_types, "bin",
                           "application/vnd.ms-office.vbaProject");

    if (workbook->vba_project)
        lxw_ct_add_override(content_types, "/xl/workbook.xml",
                            LXW_APP_MSEXCEL "sheet.macroEnabled.main+xml");
    else
        lxw_ct_add_override(content_types, "/xl/workbook.xml",
                            LXW_APP_DOCUMENT "spreadsheetml.sheet.main+xml");

    if (workbook->vba_project_signature)
        lxw_ct_add_override(content_types, "/xl/vbaProjectSignature.bin",
                            "application/vnd.ms-office.vbaProjectSignature");

    STAILQ_FOREACH(sheet, workbook->sheets, list_pointers) {
        if (sheet->is_chartsheet) {
            lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                         "/xl/chartsheets/sheet%d.xml", chartsheet_index++);
            lxw_ct_add_chartsheet_name(content_types, filename);
        }
        else {
            lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                         "/xl/worksheets/sheet%d.xml", worksheet_index++);
            lxw_ct_add_worksheet_name(content_types, filename);
        }
    }

    for (index = 1; index <= chart_count; index++) {
        lxw_snprintf(filename, LXW_FILENAME_LENGTH, "/xl/charts/chart%d.xml",
                     index);
        lxw_ct_add_chart_name(content_types, filename);
    }

    for (index = 1; index <= drawing_count; index++) {
        lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                     "/xl/drawings/drawing%d.xml", index);
        lxw_ct_add_drawing_name(content_types, filename);
    }

    for (index = 1; index <= table_count; index++) {
        lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                     "/xl/tables/table%d.xml", index);
        lxw_ct_add_table_name(content_types, filename);
    }

    if (workbook->has_vml)
        lxw_ct_add_vml_name(content_types);

    for (index = 1; index <= workbook->comment_count; index++) {
        lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                     "/xl/comments%d.xml", index);
        lxw_ct_add_comment_name(content_types, filename);
    }

    if (workbook->sst->string_count)
        lxw_ct_add_shared_strings(content_types);

    if (!STAILQ_EMPTY(self->workbook->custom_properties))
        lxw_ct_add_custom_properties(content_types);

    if (workbook->has_metadata)
        lxw_ct_add_metadata(content_types);

    lxw_content_types_assemble_xml_file(content_types);

    err = _add_to_zip(self, content_types->file, &buffer, &buffer_size,
                      "[Content_Types].xml");

    fclose(content_types->file);
    free(buffer);

mem_error:
    lxw_content_types_free(content_types);

    return err;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x870, %rsp            # imm = 0x870
movq %rdi, -0x8(%rbp)
callq 0xccc0
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
leaq -0x850(%rbp), %rdi
xorl %esi, %esi
movl $0x820, %edx            # imm = 0x820
callq 0xc6a0
movl $0x1, -0x854(%rbp)
movl $0x1, -0x858(%rbp)
movl $0x1, -0x85c(%rbp)
movq -0x8(%rbp), %rdi
callq 0xcb60
movl %eax, -0x860(%rbp)
movq -0x8(%rbp), %rdi
callq 0xc4a0
movl %eax, -0x864(%rbp)
movq -0x8(%rbp), %rdi
callq 0xc6c0
movl %eax, -0x868(%rbp)
movl $0x0, -0x86c(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x2d062
movl $0x1, -0x86c(%rbp)
jmp 0x2d46c
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rdx
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xceb0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2d09a
movl $0x3, -0x86c(%rbp)
jmp 0x2d46c
movq -0x28(%rbp), %rax
cmpb $0x0, 0xcf(%rax)
je 0x2d0be
movq -0x10(%rbp), %rdi
leaq 0x3b9e3(%rip), %rsi     # 0x68a95
leaq 0x3b9d6(%rip), %rdx     # 0x68a8f
callq 0xc4f0
movq -0x28(%rbp), %rax
cmpb $0x0, 0xd0(%rax)
je 0x2d0e2
movq -0x10(%rbp), %rdi
leaq 0x3b9c9(%rip), %rsi     # 0x68a9f
leaq 0x3b9bc(%rip), %rdx     # 0x68a99
callq 0xc4f0
movq -0x28(%rbp), %rax
cmpb $0x0, 0xd1(%rax)
je 0x2d106
movq -0x10(%rbp), %rdi
leaq 0x3b9b0(%rip), %rsi     # 0x68aaa
leaq 0x3b9a3(%rip), %rdx     # 0x68aa4
callq 0xc4f0
movq -0x28(%rbp), %rax
cmpb $0x0, 0xd2(%rax)
je 0x2d12a
movq -0x10(%rbp), %rdi
leaq 0x3b996(%rip), %rsi     # 0x68ab4
leaq 0x3b989(%rip), %rdx     # 0x68aae
callq 0xc4f0
movq -0x28(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
je 0x2d14f
movq -0x10(%rbp), %rdi
leaq 0x3ba43(%rip), %rsi     # 0x68b86
leaq 0x3b96e(%rip), %rdx     # 0x68ab8
callq 0xc4f0
movq -0x28(%rbp), %rax
cmpq $0x0, 0xe8(%rax)
je 0x2d176
movq -0x10(%rbp), %rdi
leaq 0x3b975(%rip), %rsi     # 0x68add
leaq 0x3b97f(%rip), %rdx     # 0x68aee
callq 0xcd40
jmp 0x2d18d
movq -0x10(%rbp), %rdi
leaq 0x3b95c(%rip), %rsi     # 0x68add
leaq 0x3b99b(%rip), %rdx     # 0x68b23
callq 0xcd40
movq -0x28(%rbp), %rax
cmpq $0x0, 0xf0(%rax)
je 0x2d1b2
movq -0x10(%rbp), %rdi
leaq 0x3b9c8(%rip), %rsi     # 0x68b6e
leaq 0x3b9dd(%rip), %rdx     # 0x68b8a
callq 0xcd40
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2d260
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2d212
leaq -0x850(%rbp), %rdi
movl -0x85c(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x85c(%rbp)
movl $0x80, %esi
leaq 0x3b9bf(%rip), %rdx     # 0x68bb8
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xc130
jmp 0x2d24d
leaq -0x850(%rbp), %rdi
movl -0x858(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0x858(%rbp)
movl $0x80, %esi
leaq 0x3b99e(%rip), %rdx     # 0x68bd4
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xce80
jmp 0x2d24f
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x2d1c1
movl $0x1, -0x854(%rbp)
movl -0x854(%rbp), %eax
cmpl -0x864(%rbp), %eax
ja 0x2d2b9
leaq -0x850(%rbp), %rdi
movl -0x854(%rbp), %ecx
movl $0x80, %esi
leaq 0x3b95e(%rip), %rdx     # 0x68bef
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xc5b0
movl -0x854(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x854(%rbp)
jmp 0x2d26a
movl $0x1, -0x854(%rbp)
movl -0x854(%rbp), %eax
cmpl -0x860(%rbp), %eax
ja 0x2d312
leaq -0x850(%rbp), %rdi
movl -0x854(%rbp), %ecx
movl $0x80, %esi
leaq 0x3b91c(%rip), %rdx     # 0x68c06
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xc7d0
movl -0x854(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x854(%rbp)
jmp 0x2d2c3
movl $0x1, -0x854(%rbp)
movl -0x854(%rbp), %eax
cmpl -0x868(%rbp), %eax
ja 0x2d36b
leaq -0x850(%rbp), %rdi
movl -0x854(%rbp), %ecx
movl $0x80, %esi
leaq 0x3b8de(%rip), %rdx     # 0x68c21
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xc440
movl -0x854(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x854(%rbp)
jmp 0x2d31c
movq -0x28(%rbp), %rax
cmpb $0x0, 0xd3(%rax)
je 0x2d381
movq -0x10(%rbp), %rdi
callq 0xd090
movl $0x1, -0x854(%rbp)
movl -0x854(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0xc2(%rcx), %ecx
cmpl %ecx, %eax
ja 0x2d3e1
leaq -0x850(%rbp), %rdi
movl -0x854(%rbp), %ecx
movl $0x80, %esi
leaq 0x3b87f(%rip), %rdx     # 0x68c38
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rdi
leaq -0x850(%rbp), %rsi
callq 0xcee0
movl -0x854(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x854(%rbp)
jmp 0x2d38b
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rax
cmpl $0x0, 0x8(%rax)
je 0x2d3f8
movq -0x10(%rbp), %rdi
callq 0xc3e0
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x78(%rax), %rax
cmpq $0x0, (%rax)
je 0x2d413
movq -0x10(%rbp), %rdi
callq 0xd100
movq -0x28(%rbp), %rax
cmpb $0x0, 0xd5(%rax)
je 0x2d429
movq -0x10(%rbp), %rdi
callq 0xcae0
movq -0x10(%rbp), %rdi
callq 0xc510
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq -0x18(%rbp), %rdx
leaq -0x20(%rbp), %rcx
leaq 0x3b7ff(%rip), %r8      # 0x68c4b
callq 0x2fd50
movl %eax, -0x86c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0x18(%rbp), %rdi
callq 0xc0d0
movq -0x10(%rbp), %rdi
callq 0xce10
movl -0x86c(%rbp), %eax
addq $0x870, %rsp            # imm = 0x870
popq %rbp
retq
nopw %cs:(%rax,%rax)