// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0xc6a0
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xc0(%rbp)
movl $0x1, -0xc4(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x2e30a
movq -0x20(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2df76
jmp 0x2e2f9
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, 0x2a0(%rax)
jne 0x2dfa1
movq -0x28(%rbp), %rax
cmpb $0x0, 0x2a2(%rax)
jne 0x2dfa1
jmp 0x2e2f9
movq -0x28(%rbp), %rax
cmpb $0x0, 0x2a0(%rax)
je 0x2e145
callq 0xced0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x2dfce
movl $0x1, -0x4(%rbp)
jmp 0x2e311
leaq -0xb0(%rbp), %rdi
movl -0xc4(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
movl $0x80, %esi
leaq 0x3adec(%rip), %rdx     # 0x68dde
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xceb0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2e03d
movq -0x30(%rbp), %rdi
callq 0xc8d0
movl $0x3, -0x4(%rbp)
jmp 0x2e311
movq -0x28(%rbp), %rax
movq 0x80(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x90(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movl 0x2e0(%rax), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
movb 0x2ec(%rax), %cl
movq -0x30(%rbp), %rax
movb %cl, 0x34(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x2d0(%rax)
je 0x2e0a8
movq -0x28(%rbp), %rax
movq 0x2d0(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2e0d5
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0xb8(%rbp), %rdi
callq 0xc0d0
movq -0x30(%rbp), %rdi
callq 0xc8d0
movl $0x1, -0x4(%rbp)
jmp 0x2e311
movq -0x30(%rbp), %rdi
callq 0xc680
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
leaq -0xb0(%rbp), %r8
leaq -0xb8(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x2fd50
movl %eax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0xb8(%rbp), %rdi
callq 0xc0d0
movq -0x30(%rbp), %rdi
callq 0xc8d0
cmpl $0x0, -0xc8(%rbp)
je 0x2e141
movl -0xc8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2e311
jmp 0x2e143
jmp 0x2e145
movq -0x28(%rbp), %rax
cmpb $0x0, 0x2a2(%rax)
je 0x2e2f7
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0xc4(%rbp), %edx
callq 0x30410
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
je 0x2e186
movl -0xc8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2e311
jmp 0x2e188
callq 0xced0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x2e1a4
movl $0x1, -0x4(%rbp)
jmp 0x2e311
leaq -0xb0(%rbp), %rdi
movl -0xc4(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
movl $0x80, %esi
leaq 0x3ac16(%rip), %rdx     # 0x68dde
movb $0x0, %al
callq 0xc5d0
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdx
leaq -0xb8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xceb0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x2e213
movq -0x30(%rbp), %rdi
callq 0xc8d0
movl $0x3, -0x4(%rbp)
jmp 0x2e311
movq -0x28(%rbp), %rax
movq 0x88(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rax
movl 0x2e4(%rax), %ecx
shll $0xa, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x2d8(%rax)
je 0x2e25d
movq -0x28(%rbp), %rax
movq 0x2d8(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x2e28a
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0xb8(%rbp), %rdi
callq 0xc0d0
movq -0x30(%rbp), %rdi
callq 0xc8d0
movl $0x1, -0x4(%rbp)
jmp 0x2e311
movq -0x30(%rbp), %rdi
callq 0xc680
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
leaq -0xb0(%rbp), %r8
leaq -0xb8(%rbp), %rdx
leaq -0xc0(%rbp), %rcx
callq 0x2fd50
movl %eax, -0xc8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0xc460
movq -0xb8(%rbp), %rdi
callq 0xc0d0
movq -0x30(%rbp), %rdi
callq 0xc8d0
cmpl $0x0, -0xc8(%rbp)
je 0x2e2f3
movl -0xc8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x2e311
jmp 0x2e2f5
jmp 0x2e2f7
jmp 0x2e2f9
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x2df5d
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax)