// File: /workspace/github_c_makefile_star2_O2/madler[P]pigz/pigz.c
// Function: put_trailer
local void put_trailer(length_t ulen, length_t clen,
                       unsigned long check, length_t head) {
    if (g.form > 1) {               // zip
        // write Zip64 data descriptor, as promised in the local header
        length_t desc = put(g.outd,
            4, (val_t)0x08074b50,
            4, (val_t)check,
            8, (val_t)clen,
            8, (val_t)ulen,
            0);

        // zip64 is true if either the compressed or the uncompressed length
        // does not fit in 32 bits, in which case there needs to be a Zip64
        // extra block in the central directory entry
        int zip64 = ulen >= LOW32 || clen >= LOW32;

        // write central file header
        length_t cent = put(g.outd,
            4, (val_t)0x02014b50,   // central header signature
            1, (val_t)45,           // made by 4.5 for Zip64 V1 end record
            1, (val_t)255,          // ignore external attributes
            2, (val_t)45,           // version needed to extract (4.5)
            2, (val_t)8,            // data descriptor is present
            2, (val_t)8,            // deflate
            4, (val_t)time2dos(g.mtime),
            4, (val_t)check,        // crc
            4, (val_t)(zip64 ? LOW32 : clen),   // compressed length
            4, (val_t)(zip64 ? LOW32 : ulen),   // uncompressed length
            2, (val_t)(strlen(g.name == NULL ? g.alias : g.name)),  // name len
            2, (val_t)(zip64 ? 29 : 9), // extra field size (see below)
            2, (val_t)(g.comment == NULL ? 0 : strlen(g.comment)),  // comment
            2, (val_t)0,            // disk number 0
            2, (val_t)0,            // internal file attributes
            4, (val_t)0,            // external file attributes (ignored)
            4, (val_t)0,            // offset of local header
            0);

        // write file name (use g.alias for stdin)
        cent += writen(g.outd, g.name == NULL ? g.alias : g.name,
                       strlen(g.name == NULL ? g.alias : g.name));

        // write Zip64 extra field block (20 bytes)
        if (zip64)
            cent += put(g.outd,
                2, (val_t)0x0001,   // Zip64 extended information ID
                2, (val_t)16,       // number of data bytes in this block
                8, (val_t)ulen,     // uncompressed length
                8, (val_t)clen,     // compressed length
                0);

        // write extended timestamp extra field block (9 bytes)
        cent += put(g.outd,
            2, (val_t)0x5455,       // extended timestamp signature
            2, (val_t)5,            // number of data bytes in this block
            1, (val_t)1,            // flag presence of mod time
            4, (val_t)g.mtime,      // mod time
            0);

        // write comment, if requested
        if (g.comment != NULL)
            cent += writen(g.outd, g.comment, strlen(g.comment));

        // here zip64 is true if the offset of the central directory does not
        // fit in 32 bits, in which case insert the Zip64 end records to
        // provide a 64-bit offset
        zip64 = head + clen + desc >= LOW32;
        if (zip64) {
            // write Zip64 end of central directory record and locator
            put(g.outd,
                4, (val_t)0x06064b50,   // Zip64 end of central dir sig
                8, (val_t)44,       // size of the remainder of this record
                2, (val_t)45,       // version made by
                2, (val_t)45,       // version needed to extract
                4, (val_t)0,        // number of this disk
                4, (val_t)0,        // disk with start of central directory
                8, (val_t)1,        // number of entries on this disk
                8, (val_t)1,        // total number of entries
                8, (val_t)cent,     // size of central directory
                8, (val_t)(head + clen + desc), // central dir offset
                4, (val_t)0x07064b50,   // Zip64 end locator signature
                4, (val_t)0,        // disk with Zip64 end of central dir
                8, (val_t)(head + clen + desc + cent),  // location
                4, (val_t)1,        // total number of disks
                0);
        }

        // write end of central directory record
        put(g.outd,
            4, (val_t)0x06054b50,   // end of central directory signature
            2, (val_t)0,            // number of this disk
            2, (val_t)0,            // disk with start of central directory
            2, (val_t)(zip64 ? 0xffff : 1), // entries on this disk
            2, (val_t)(zip64 ? 0xffff : 1), // total number of entries
            4, (val_t)(zip64 ? LOW32 : cent),   // size of central directory
            4, (val_t)(zip64 ? LOW32 : head + clen + desc), // offset
            2, (val_t)0,            // no zip file comment
            0);
    }
    else if (g.form)                // zlib
        put(g.outd,
            -4, (val_t)check,       // zlib format uses big-endian order
            0);
    else                            // gzip
        put(g.outd,
            4, (val_t)check,
            4, (val_t)ulen,
            0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdx, %r13
movq %rdi, %r14
movl 0xf608(%rip), %eax      # 0x1c388
cmpl $0x2, %eax
jl 0xce70
movq %rsi, %rbx
movq %rcx, 0x120(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl 0xf5b5(%rip), %edi      # 0x1c354
movq %r14, 0x10(%rsp)
andl $0x0, 0x18(%rsp)
movq %rsi, (%rsp)
movl $0x8, 0x8(%rsp)
pushq $0x4
popq %rcx
pushq $0x8
popq %r9
movl $0x8074b50, %edx        # imm = 0x8074B50
movl %ecx, %esi
movq %r13, %r8
xorl %eax, %eax
callq 0xd21e
leaq -0x1(%rbp), %rdx
cmpq %rdx, %r14
seta %cl
movq %rdx, 0x118(%rsp)
cmpq %rdx, %rbx
seta %r12b
movl %eax, 0xf0(%rsp)
orb %cl, %r12b
movl 0xf55e(%rip), %eax      # 0x1c354
movl %eax, 0xfc(%rsp)
movq 0xf5b4(%rip), %rdi      # 0x1c3b8
callq 0xd3c9
movq %rax, 0x110(%rsp)
movq 0xf588(%rip), %rdi      # 0x1c3a0
testq %rdi, %rdi
jne 0xce24
movq 0xf584(%rip), %rdi      # 0x1c3a8
callq 0x31a0
movq %rax, %r15
testb %r12b, %r12b
movq %rbx, 0x100(%rsp)
cmovneq %rbp, %rbx
movq %r14, 0x108(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %r14, %rbp
cmovneq %rax, %rbp
pushq $0x1d
popq %rax
pushq $0x9
popq %r14
cmovneq %rax, %r14
movq 0xf54f(%rip), %rdi      # 0x1c3b0
testq %rdi, %rdi
je 0xce9e
callq 0x31a0
movq %rax, %rdx
jmp 0xcea0
movl 0xf4de(%rip), %edi      # 0x1c354
testl %eax, %eax
je 0xd1fb
pushq $-0x4
popq %rsi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd21e
xorl %edx, %edx
pushq $0x4
popq %rcx
movl %ecx, 0xd8(%rsp)
movl %ecx, 0xc8(%rsp)
pushq $0x2
popq %rax
movl %eax, 0xb8(%rsp)
movl %eax, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movl %eax, 0x98(%rsp)
movq %r14, 0x90(%rsp)
movl %ecx, %r14d
movl %eax, 0x88(%rsp)
movq %r15, 0x80(%rsp)
movl %eax, 0x78(%rsp)
movq %rbp, 0x70(%rsp)
movl %ecx, 0x68(%rsp)
movq %rbx, 0x60(%rsp)
movl %ecx, 0x58(%rsp)
movq %r13, 0x50(%rsp)
movl %ecx, 0x48(%rsp)
movq 0x110(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movl %r14d, 0x38(%rsp)
pushq $0x8
popq %rcx
andl $0x0, 0xe8(%rsp)
movq %rcx, 0x30(%rsp)
andq $0x0, 0xe0(%rsp)
movl %eax, 0x28(%rsp)
andq $0x0, 0xd0(%rsp)
movq %rcx, 0x20(%rsp)
andq $0x0, 0xc0(%rsp)
movl %eax, 0x18(%rsp)
andq $0x0, 0xb0(%rsp)
movl %eax, 0x8(%rsp)
movq $0x2d, 0x10(%rsp)
movq $0xff, (%rsp)
pushq $0x2d
popq %r8
pushq $0x1
popq %rcx
movl $0x2014b50, %edx        # imm = 0x2014B50
movl 0xfc(%rsp), %edi
movl %r14d, %esi
movl %ecx, %r9d
xorl %eax, %eax
callq 0xd21e
movl %eax, %r13d
movl 0xf3b9(%rip), %ebx      # 0x1c354
movq 0xf3fe(%rip), %r15      # 0x1c3a0
testq %r15, %r15
jne 0xcfae
movq 0xf3fa(%rip), %r15      # 0x1c3a8
movl 0xf0(%rsp), %eax
movq %rax, 0xf0(%rsp)
movq %r15, %rdi
callq 0x31a0
movq %rax, %rbp
movl %ebx, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0xb58d
addq %rbp, %r13
testb %r12b, %r12b
je 0xd025
movl 0xf371(%rip), %edi      # 0x1c354
movq 0x100(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x108(%rsp), %rax
movq %rax, (%rsp)
andl $0x0, 0x18(%rsp)
movl $0x8, 0x8(%rsp)
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
pushq $0x10
popq %r8
pushq $0x8
popq %r9
movl %ecx, %esi
xorl %eax, %eax
callq 0xd21e
movl %eax, %eax
addq %rax, %r13
movl 0xf329(%rip), %edi      # 0x1c354
movq 0xf386(%rip), %rax      # 0x1c3b8
movq %rax, 0x10(%rsp)
andl $0x0, 0x18(%rsp)
movl $0x4, 0x8(%rsp)
movq $0x1, (%rsp)
pushq $0x2
popq %rcx
pushq $0x5
popq %r8
pushq $0x1
popq %r9
movl $0x5455, %edx           # imm = 0x5455
movl %ecx, %esi
xorl %eax, %eax
callq 0xd21e
movl %eax, %r12d
addq %r13, %r12
movq 0xf33e(%rip), %rbx      # 0x1c3b0
testq %rbx, %rbx
je 0xd098
movl 0xf2d7(%rip), %ebp      # 0x1c354
movq %rbx, %rdi
callq 0x31a0
movq %rax, %r15
movl %ebp, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xb58d
addq %r15, %r12
movq 0x120(%rsp), %rdx
addq 0x100(%rsp), %rdx
addq 0xf0(%rsp), %rdx
cmpq 0x118(%rsp), %rdx
jbe 0xd18e
movl 0xf290(%rip), %edi      # 0x1c354
leaq (%r12,%rdx), %rax
pushq $0x1
popq %rsi
movq %rsi, 0xb0(%rsp)
movl %r14d, 0xa8(%rsp)
movq %rax, 0xa0(%rsp)
pushq $0x8
popq %rcx
movl %ecx, 0x98(%rsp)
movl %r14d, 0x88(%rsp)
movl %r14d, 0x78(%rsp)
movq %rdx, 0x70(%rsp)
movl %ecx, 0x68(%rsp)
movq %r12, 0x60(%rsp)
movl %ecx, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movl %ecx, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movl %ecx, 0x38(%rsp)
andl $0x0, 0xb8(%rsp)
movl %r14d, 0x28(%rsp)
andq $0x0, 0x90(%rsp)
movl %r14d, 0x18(%rsp)
andq $0x0, 0x30(%rsp)
pushq $0x2d
popq %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %rax, (%rsp)
movq $0x7064b50, 0x80(%rsp) # imm = 0x7064B50
movl $0x2, 0x8(%rsp)
pushq $0x2c
popq %r8
pushq $0x2
popq %r9
movl $0x6064b50, %edx        # imm = 0x6064B50
movl %r14d, %esi
xorl %eax, %eax
callq 0xd21e
movl $0xffff, %eax           # imm = 0xFFFF
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0xd191
pushq $0x1
popq %rax
movl 0xf1bd(%rip), %edi      # 0x1c354
pushq $0x2
popq %rcx
movl %ecx, 0x48(%rsp)
movq %rdx, 0x40(%rsp)
movl %r14d, 0x38(%rsp)
movq %r12, 0x30(%rsp)
movl %r14d, 0x28(%rsp)
movq %rax, 0x20(%rsp)
andl $0x0, 0x58(%rsp)
movl %ecx, 0x18(%rsp)
andq $0x0, 0x50(%rsp)
movq %rax, 0x10(%rsp)
andq $0x0, (%rsp)
movl %ecx, 0x8(%rsp)
movl $0x6054b50, %edx        # imm = 0x6054B50
movl %r14d, %esi
xorl %r8d, %r8d
movl %ecx, %r9d
xorl %eax, %eax
callq 0xd21e
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rcx
movl %ecx, %esi
movq %r13, %rdx
movq %r14, %r8
xorl %r9d, %r9d
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd21e