// File: /workspace/github_c_makefile_star2_O0/Paxa[P]fast_excel/libxlsxwriter/src/packager.c
// Function: add_file_to_zip
STATIC lxw_error
_add_file_to_zip(lxw_packager *self, FILE * file, const char *filename)
{
    int16_t error = ZIP_OK;
    size_t size_read;

    error = zipOpenNewFileInZip4_64(self->zipfile,
                                    filename,
                                    &self->zipfile_info,
                                    NULL, 0, NULL, 0, NULL,
                                    Z_DEFLATED, Z_DEFAULT_COMPRESSION, 0,
                                    -MAX_WBITS, DEF_MEM_LEVEL,
                                    Z_DEFAULT_STRATEGY, NULL, 0, 0, 0,
                                    self->use_zip64);

    if (error != ZIP_OK) {
        LXW_ERROR("Error adding member to zipfile");
        RETURN_ON_ZIP_ERROR(error, LXW_ERROR_ZIP_FILE_ADD);
    }

    fflush(file);
    rewind(file);

    size_read = fread((void *) self->buffer, 1, self->buffer_size, file);

    while (size_read) {

        if (size_read < self->buffer_size) {
            if (ferror(file)) {
                LXW_ERROR("Error reading member file data");
                RETURN_ON_ZIP_ERROR(error, LXW_ERROR_ZIP_FILE_ADD);
            }
        }

        error = zipWriteInFileInZip(self->zipfile,
                                    self->buffer, (unsigned int) size_read);

        if (error < 0) {
            LXW_ERROR("Error in writing member in the zipfile");
            RETURN_ON_ZIP_ERROR(error, LXW_ERROR_ZIP_FILE_ADD);
        }

        size_read =
            fread((void *) (void *) self->buffer, 1, self->buffer_size, file);
    }

    error = zipCloseFileInZip(self->zipfile);
    if (error != ZIP_OK) {
        LXW_ERROR("Error in closing member in the zipfile");
        RETURN_ON_ZIP_ERROR(error, LXW_ERROR_ZIP_FILE_ADD);
    }

    return LXW_NO_ERROR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movw $0x0, -0x22(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x20(%rbp), %rsi
movq -0x10(%rbp), %rdx
addq $0x28, %rdx
movq -0x10(%rbp), %rax
movzbl 0x78(%rax), %eax
xorl %ecx, %ecx
movl %ecx, %r9d
xorl %r8d, %r8d
movq %r9, %rcx
movl $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x8, 0x10(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x20(%rsp)
movl $0xfffffff1, 0x28(%rsp) # imm = 0xFFFFFFF1
movl $0x8, 0x30(%rsp)
movl $0x0, 0x38(%rsp)
movq $0x0, 0x40(%rsp)
movq $0x0, 0x48(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movl %eax, 0x60(%rsp)
callq 0xc7a0
movw %ax, -0x22(%rbp)
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
je 0x301a6
movq 0x4cecf(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x38b2c(%rip), %rsi     # 0x68c5f
leaq 0x3894a(%rip), %rdx     # 0x68a84
movl $0x6fc, %ecx            # imm = 0x6FC
movb $0x0, %al
callq 0xc8f0
movswl -0x22(%rbp), %eax
cmpl $-0x1, %eax
jne 0x3015b
movl $0x5, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x66, %eax
jne 0x30170
movl $0x6, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x67, %eax
jne 0x30185
movl $0x7, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x68, %eax
jne 0x3019a
movl $0x8, -0x4(%rbp)
jmp 0x303fc
movl $0x9, -0x4(%rbp)
jmp 0x303fc
movq -0x18(%rbp), %rdi
callq 0xcb00
movq -0x18(%rbp), %rdi
callq 0xc560
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0xc320
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x30366
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jae 0x3028f
movq -0x18(%rbp), %rdi
callq 0xc2e0
cmpl $0x0, %eax
je 0x3028d
movq 0x4cde8(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x38ae5(%rip), %rsi     # 0x68cff
leaq 0x38863(%rip), %rdx     # 0x68a84
movl $0x709, %ecx            # imm = 0x709
movb $0x0, %al
callq 0xc8f0
movswl -0x22(%rbp), %eax
cmpl $-0x1, %eax
jne 0x30242
movl $0x5, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x66, %eax
jne 0x30257
movl $0x6, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x67, %eax
jne 0x3026c
movl $0x7, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x68, %eax
jne 0x30281
movl $0x8, -0x4(%rbp)
jmp 0x303fc
movl $0x9, -0x4(%rbp)
jmp 0x303fc
jmp 0x3028f
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
movq -0x30(%rbp), %rax
movl %eax, %edx
callq 0xc120
movw %ax, -0x22(%rbp)
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
jge 0x3033f
movq 0x4cd36(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x389c3(%rip), %rsi     # 0x68c8f
leaq 0x387b1(%rip), %rdx     # 0x68a84
movl $0x712, %ecx            # imm = 0x712
movb $0x0, %al
callq 0xc8f0
movswl -0x22(%rbp), %eax
cmpl $-0x1, %eax
jne 0x302f4
movl $0x5, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x66, %eax
jne 0x30309
movl $0x6, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x67, %eax
jne 0x3031e
movl $0x7, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x68, %eax
jne 0x30333
movl $0x8, -0x4(%rbp)
jmp 0x303fc
movl $0x9, -0x4(%rbp)
jmp 0x303fc
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
movl $0x1, %esi
callq 0xc320
movq %rax, -0x30(%rbp)
jmp 0x301da
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0xc220
movw %ax, -0x22(%rbp)
movswl -0x22(%rbp), %eax
cmpl $0x0, %eax
je 0x303f5
movq 0x4cc71(%rip), %rax     # 0x7cff8
movq (%rax), %rdi
leaq 0x38936(%rip), %rsi     # 0x68cc7
leaq 0x386ec(%rip), %rdx     # 0x68a84
movl $0x71c, %ecx            # imm = 0x71C
movb $0x0, %al
callq 0xc8f0
movswl -0x22(%rbp), %eax
cmpl $-0x1, %eax
jne 0x303b6
movl $0x5, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x66, %eax
jne 0x303c8
movl $0x6, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x67, %eax
jne 0x303da
movl $0x7, -0x4(%rbp)
jmp 0x303fc
movswl -0x22(%rbp), %eax
cmpl $-0x68, %eax
jne 0x303ec
movl $0x8, -0x4(%rbp)
jmp 0x303fc
movl $0x9, -0x4(%rbp)
jmp 0x303fc
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax,%rax)