// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/src/patch/Zipper.cpp
// Function: Zipper_file_append_end
bool Zipper_file_append_end(Zipper* self){
    Zipper_file_append_stream* append_state=&self->_append_stream;
    if (append_state->self==0) { assert(false); return false; }
    
    bool result=true;
    const bool isCompressedFile=(append_state->compressHandle!=0);
    if (isCompressedFile){
        if ((append_state->inputPos==0)&&(append_state->outputPos==0)){
            Byte emptyBuf=0; //compress empty file
            check(append_state->write(append_state,0,&emptyBuf,&emptyBuf));
        }
        void* compressHandle=append_state->compressHandle;
        append_state->compressHandle=0;
        check_clear(append_state->compressor->closeCompressHandle(append_state->compressor,compressHandle));
    }
    
    check_clear(append_state->inputPos==append_state->streamSize);
#if (_IS_USED_MULTITHREAD)
    if (isUsedMT(self)) {
        if (append_state->threadWork){
            self->_threadWorks->dispatchWork(append_state->threadWork);
            append_state->threadWork=0;
        }
        check_clear(_dispose_filishedThreadWork(self,false));
    }
#endif
    if (isCompressedFile){
        assert(append_state->outputPos==(ZipFilePos_t)append_state->outputPos);
        ZipFilePos_t compressedSize=(ZipFilePos_t)append_state->outputPos;
        check_clear(_zipper_file_update_compressedSize(self,append_state->curFileIndex,compressedSize));
    }
clear:
    memset(append_state,0,sizeof(Zipper_file_append_stream));
    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpq $0x0, 0xf0(%rdi)
je 0x397e0
movq %rdi, %r14
leaq 0xc0(%rdi), %rbx
movq 0x108(%rdi), %r15
testq %r15, %r15
je 0x396d0
cmpq $0x0, 0xe0(%r14)
movq %r15, %rsi
jne 0x396b6
cmpq $0x0, 0xe8(%r14)
movq %r15, %rsi
jne 0x396b6
leaq 0xb(%rsp), %rcx
movb $0x0, (%rcx)
movq %rbx, %rdi
xorl %esi, %esi
movq %rcx, %rdx
callq *0xd8(%r14)
testl %eax, %eax
je 0x3989a
movq 0x108(%r14), %rsi
andq $0x0, 0x108(%r14)
movq 0x100(%r14), %rdi
callq *0x18(%rdi)
testb %al, %al
je 0x3981e
movq 0xe0(%r14), %rax
cmpq 0xc8(%r14), %rax
jne 0x397ff
cmpl $0x2, 0x154(%r14)
jl 0x39720
movq 0xf8(%r14), %rsi
testq %rsi, %rsi
je 0x3970e
movq 0x158(%r14), %rdi
callq 0x3a48c
andq $0x0, 0xf8(%r14)
movq %r14, %rdi
xorl %esi, %esi
callq 0x398b9
testb %al, %al
je 0x3987b
testq %r15, %r15
je 0x397b1
movq 0xe8(%r14), %rax
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x3983d
movslq 0x130(%r14), %rcx
cmpl %ecx, 0x60(%r14)
jle 0x3985c
movq 0xb0(%r14), %rdx
cmpl %eax, (%rdx,%rcx,4)
je 0x397b1
movl %eax, (%rdx,%rcx,4)
movq 0xa8(%r14), %rdx
movl (%rdx,%rcx,4), %edx
leal 0x12(%rdx), %r15d
movl 0x58(%r14), %ecx
subq 0x140(%r14), %rcx
cmpq %r15, %rcx
jbe 0x397a4
movl %eax, 0xc(%rsp)
addl $0x16, %edx
cmpq %rdx, %rcx
jae 0x3978f
movq %r14, %rdi
callq 0x39c30
leaq 0xc(%rsp), %rdx
pushq $0x4
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3a374
jmp 0x397b1
addq 0x138(%r14), %r15
subq %rcx, %r15
movl %eax, (%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
andq $0x0, 0x70(%rbx)
movb $0x1, %al
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x15869(%rip), %rdi     # 0x4f050
leaq 0x1bb93(%rip), %rsi     # 0x55381
leaq 0x1c325(%rip), %rcx     # 0x55b1a
movl $0x596, %edx            # imm = 0x596
callq 0x4230
leaq 0x1584a(%rip), %rdi     # 0x4f050
leaq 0x1bb74(%rip), %rsi     # 0x55381
leaq 0x1c306(%rip), %rcx     # 0x55b1a
movl $0x5a4, %edx            # imm = 0x5A4
callq 0x4230
leaq 0x1582b(%rip), %rdi     # 0x4f050
leaq 0x1bb55(%rip), %rsi     # 0x55381
leaq 0x1c2e7(%rip), %rcx     # 0x55b1a
movl $0x5a1, %edx            # imm = 0x5A1
callq 0x4230
leaq 0x1c2fc(%rip), %rdi     # 0x55b40
leaq 0x1bb36(%rip), %rsi     # 0x55381
leaq 0x1c2c8(%rip), %rcx     # 0x55b1a
movl $0x5af, %edx            # imm = 0x5AF
callq 0x4230
leaq 0x157ed(%rip), %rdi     # 0x4f050
leaq 0x1bb17(%rip), %rsi     # 0x55381
leaq 0x1cacb(%rip), %rcx     # 0x5633c
movl $0x56e, %edx            # imm = 0x56E
callq 0x4230
leaq 0x157ce(%rip), %rdi     # 0x4f050
leaq 0x1baf8(%rip), %rsi     # 0x55381
leaq 0x1c28a(%rip), %rcx     # 0x55b1a
movl $0x5ab, %edx            # imm = 0x5AB
callq 0x4230
leaq 0x157af(%rip), %rdi     # 0x4f050
leaq 0x1bad9(%rip), %rsi     # 0x55381
leaq 0x1c26b(%rip), %rcx     # 0x55b1a
movl $0x59d, %edx            # imm = 0x59D
callq 0x4230