// File: /workspace/github_c_makefile_star2_O1/Paxa[P]fast_excel/libxlsxwriter/src/packager.c
// Function: write_vml_files
STATIC lxw_error
_write_vml_files(lxw_packager *self)
{
    lxw_workbook *workbook = self->workbook;
    lxw_sheet *sheet;
    lxw_worksheet *worksheet;
    lxw_vml *vml;
    char filename[LXW_FILENAME_LENGTH] = { 0 };
    char *buffer = NULL;
    size_t buffer_size = 0;
    uint32_t index = 1;
    lxw_error err;

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

        if (!worksheet->has_vml && !worksheet->has_header_vml)
            continue;

        if (worksheet->has_vml) {

            vml = lxw_vml_new();
            if (!vml)
                return LXW_ERROR_MEMORY_MALLOC_FAILED;

            lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                         "xl/drawings/vmlDrawing%d.vml", index++);

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

            vml->comment_objs = worksheet->comment_objs;
            vml->button_objs = worksheet->button_objs;
            vml->vml_shape_id = worksheet->vml_shape_id;
            vml->comment_display_default = worksheet->comment_display_default;

            if (worksheet->vml_data_id_str) {
                vml->vml_data_id_str = worksheet->vml_data_id_str;
            }
            else {
                fclose(vml->file);
                free(buffer);
                lxw_vml_free(vml);
                return LXW_ERROR_MEMORY_MALLOC_FAILED;
            }

            lxw_vml_assemble_xml_file(vml);

            err = _add_to_zip(self, vml->file, &buffer, &buffer_size,
                              filename);

            fclose(vml->file);
            free(buffer);
            lxw_vml_free(vml);

            RETURN_ON_ERROR(err);
        }

        if (worksheet->has_header_vml) {

            err = _write_vml_drawing_rels_file(self, worksheet, index);
            RETURN_ON_ERROR(err);

            vml = lxw_vml_new();
            if (!vml)
                return LXW_ERROR_MEMORY_MALLOC_FAILED;

            lxw_snprintf(filename, LXW_FILENAME_LENGTH,
                         "xl/drawings/vmlDrawing%d.vml", index++);

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

            vml->image_objs = worksheet->header_image_objs;
            vml->vml_shape_id = worksheet->vml_header_id * 1024;

            if (worksheet->vml_header_id_str) {
                vml->vml_data_id_str = worksheet->vml_header_id_str;
            }
            else {
                fclose(vml->file);
                free(buffer);
                lxw_vml_free(vml);
                return LXW_ERROR_MEMORY_MALLOC_FAILED;
            }

            lxw_vml_assemble_xml_file(vml);

            err = _add_to_zip(self, vml->file, &buffer, &buffer_size,
                              filename);

            fclose(vml->file);
            free(buffer);
            lxw_vml_free(vml);

            RETURN_ON_ERROR(err);
        }
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq 0x8(%rdi), %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
xorl %r13d, %r13d
movq %r13, (%rsp)
movq %r13, 0x8(%rsp)
movq 0x8(%rax), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x21142
movq %rdi, %rbx
movl $0x1, %ebp
cmpb $0x0, (%r14)
je 0x20e2c
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x20e18
jmp 0x2110e
movq 0x8(%r14), %r15
movb 0x2a0(%r15), %al
testb %al, %al
je 0x20fc4
callq 0xce20
testq %rax, %rax
je 0x21113
movq %rax, %r12
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x22149(%rip), %rdx     # 0x42faa
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq 0x70(%rbx), %rdx
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xce00
movq %rax, (%r12)
testq %rax, %rax
je 0x2111b
movq 0x80(%r15), %rcx
movq %rcx, 0x18(%r12)
movq 0x90(%r15), %rcx
movq %rcx, 0x10(%r12)
movl 0x2e0(%r15), %ecx
movl %ecx, 0x30(%r12)
movb 0x2ec(%r15), %cl
movb %cl, 0x34(%r12)
movq 0x2d0(%r15), %rcx
testq %rcx, %rcx
je 0x21123
movq %rcx, 0x28(%r12)
movq %r12, %rdi
callq 0xc620
movq (%r12), %rsi
movq %rbx, %rdi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x22482
movl %eax, %r13d
movq (%r12), %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movq %r12, %rdi
callq 0xc850
testl %r13d, %r13d
jne 0x21142
incl %ebp
cmpb $0x0, 0x2a2(%r15)
je 0x20e1e
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x110(%rsp)
movaps %xmm0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movaps %xmm0, 0xe0(%rsp)
movaps %xmm0, 0xd0(%rsp)
movaps %xmm0, 0xc0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
callq 0xcf00
movq %rax, %r12
movq 0x70(%rbx), %rdx
leaq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xce00
movq %rax, (%r12)
testq %rax, %rax
je 0x21038
movq 0x230(%r15), %rax
movq (%rax), %r13
testq %r13, %r13
je 0x20fdf
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0x10(%r13), %rcx
movq %r12, %rdi
callq 0xca10
movq 0x18(%r13), %r13
jmp 0x20fa5
cmpb $0x0, 0x2a2(%r15)
je 0x20e1e
testb %al, %al
jne 0x20e3f
jmp 0x20f16
movl $0x80, %esi
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
leaq 0x21fd1(%rip), %rdx     # 0x42fc7
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq %r12, %rdi
callq 0xc310
movq (%r12), %rsi
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %r13, %r8
callq 0x22482
movl %eax, %r13d
movq (%r12), %rdi
callq 0xc420
movq 0x10(%rsp), %rdi
callq 0xc0c0
jmp 0x2103e
movl $0x3, %r13d
movq %r12, %rdi
callq 0xc290
testl %r13d, %r13d
jne 0x21142
callq 0xce20
testq %rax, %rax
je 0x21113
movq %rax, %r12
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x21f39(%rip), %rdx     # 0x42faa
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq 0x70(%rbx), %rdx
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xce00
movq %rax, (%r12)
testq %rax, %rax
je 0x2111b
movq 0x88(%r15), %rcx
movq %rcx, 0x20(%r12)
movl 0x2e4(%r15), %ecx
shll $0xa, %ecx
movl %ecx, 0x30(%r12)
movq 0x2d8(%r15), %rcx
testq %rcx, %rcx
je 0x21123
movq %rcx, 0x28(%r12)
movq %r12, %rdi
callq 0xc620
movq (%r12), %rsi
movq %rbx, %rdi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x22482
movl %eax, %r13d
movq (%r12), %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movq %r12, %rdi
callq 0xc850
testl %r13d, %r13d
jne 0x21142
incl %ebp
jmp 0x20e1e
xorl %r13d, %r13d
jmp 0x21142
movl $0x1, %r13d
jmp 0x21142
movl $0x3, %r13d
jmp 0x2113a
movq %rax, %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movl $0x1, %r13d
movq %r12, %rdi
callq 0xc850
movl %r13d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq