// File: /workspace/github_c_makefile_star2_O3/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 %r12d, %r12d
movq %r12, (%rsp)
movq %r12, 0x8(%rsp)
movq 0x8(%rax), %rax
movq (%rax), %r14
testq %r14, %r14
je 0x211d0
movq %rdi, %rbx
movl $0x1, %ebp
cmpb $0x0, (%r14)
jne 0x2118b
movq 0x8(%r14), %r15
cmpb $0x0, 0x2a0(%r15)
je 0x20fb5
callq 0xce20
movl $0x1, %r12d
testq %rax, %rax
je 0x211d0
movq %rax, %r13
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x220b5(%rip), %rdx     # 0x42fba
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq 0x70(%rbx), %rdx
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xce00
movq %rax, (%r13)
testq %rax, %rax
je 0x2119d
movq 0x80(%r15), %rcx
movq %rcx, 0x18(%r13)
movq 0x90(%r15), %rcx
movq %rcx, 0x10(%r13)
movl 0x2e0(%r15), %ecx
movl %ecx, 0x30(%r13)
movb 0x2ec(%r15), %cl
movb %cl, 0x34(%r13)
movq 0x2d0(%r15), %rcx
testq %rcx, %rcx
je 0x211a7
movq %rcx, 0x28(%r13)
movq %r13, %rdi
callq 0xc620
movq (%r13), %rsi
movq %rbx, %rdi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x224f6
movl %eax, %r12d
movq (%r13), %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movq %r13, %rdi
callq 0xc850
testl %r12d, %r12d
jne 0x211d0
incl %ebp
cmpb $0x0, 0x2a2(%r15)
je 0x2118b
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, %r13
movq 0x70(%rbx), %rdx
leaq 0x10(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0xce00
movq %rax, (%r13)
testq %rax, %rax
je 0x211c2
movq 0x230(%r15), %rax
movq (%rax), %r12
testq %r12, %r12
je 0x21066
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq 0x10(%r12), %rcx
movq %r13, %rdi
callq 0xca10
movq 0x18(%r12), %r12
jmp 0x21044
movl $0x80, %esi
leaq 0xa0(%rsp), %r12
movq %r12, %rdi
leaq 0x21f5a(%rip), %rdx     # 0x42fd7
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq %r13, %rdi
callq 0xc310
movq (%r13), %rsi
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %r12, %r8
callq 0x224f6
movl %eax, %r12d
movq (%r13), %rdi
callq 0xc420
movq 0x10(%rsp), %rdi
callq 0xc0c0
movq %r13, %rdi
callq 0xc290
testl %r12d, %r12d
jne 0x211d0
callq 0xce20
movl $0x1, %r12d
testq %rax, %rax
je 0x211d0
movq %rax, %r13
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x21ec4(%rip), %rdx     # 0x42fba
movl %ebp, %ecx
xorl %eax, %eax
callq 0xc570
movq 0x70(%rbx), %rdx
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0xce00
movq %rax, (%r13)
testq %rax, %rax
je 0x2119d
movq 0x88(%r15), %rcx
movq %rcx, 0x20(%r13)
movl 0x2e4(%r15), %ecx
shll $0xa, %ecx
movl %ecx, 0x30(%r13)
movq 0x2d8(%r15), %rcx
testq %rcx, %rcx
je 0x211a7
movq %rcx, 0x28(%r13)
movq %r13, %rdi
callq 0xc620
movq (%r13), %rsi
movq %rbx, %rdi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x20(%rsp), %r8
callq 0x224f6
movl %eax, %r12d
movq (%r13), %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movq %r13, %rdi
callq 0xc850
testl %r12d, %r12d
jne 0x211d0
incl %ebp
movq 0x10(%r14), %r14
testq %r14, %r14
jne 0x20ec1
xorl %r12d, %r12d
jmp 0x211d0
movq %r13, %rdi
callq 0xc850
jmp 0x211ca
movq %rax, %rdi
callq 0xc420
movq (%rsp), %rdi
callq 0xc0c0
movq %r13, %rdi
callq 0xc850
jmp 0x211d0
movq %r13, %rdi
callq 0xc290
movl $0x3, %r12d
movl %r12d, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq