// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdx, %r12
movq %rdi, %rbp
movl 0xfdbd(%rip), %eax      # 0x1d388
cmpl $0x2, %eax
jl 0xd6a7
movq %rsi, %r13
movq %rcx, 0x40(%rsp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl 0xfd6d(%rip), %edi      # 0x1d354
movl $0x8074b50, %edx        # imm = 0x8074B50
movl $0x4, %esi
movl $0x4, %ecx
movq %r12, %r8
movl $0x8, %r9d
xorl %eax, %eax
pushq $0x0
pushq %rbp
pushq $0x8
pushq %r13
callq 0xd98b
addq $0x20, %rsp
leaq -0x1(%rbx), %rdx
cmpq %rdx, %rbp
seta %cl
movq %rdx, 0x38(%rsp)
cmpq %rdx, %r13
seta %r14b
movl %eax, 0x8(%rsp)
orb %cl, %r14b
movl 0xfd20(%rip), %eax      # 0x1d354
movl %eax, 0x14(%rsp)
movq 0xfd79(%rip), %rdi      # 0x1d3b8
callq 0xdb40
movq %rax, 0x30(%rsp)
movq 0xfd50(%rip), %rdi      # 0x1d3a0
testq %rdi, %rdi
jne 0xd65c
movq 0xfd4c(%rip), %rdi      # 0x1d3a8
callq 0x31a0
movq %rax, 0x28(%rsp)
movb %r14b, 0x7(%rsp)
testb %r14b, %r14b
movq %r13, %r15
cmovneq %rbx, %r15
movq %rbp, 0x20(%rsp)
cmovneq %rbx, %rbp
movl $0x1d, %eax
movl $0x9, %ebx
cmovneq %rax, %rbx
movq 0xfd1d(%rip), %rdi      # 0x1d3b0
testq %rdi, %rdi
movq %r13, 0x18(%rsp)
je 0xd6d4
callq 0x31a0
movq %rax, %r14
jmp 0xd6d7
movl 0xfca7(%rip), %edi      # 0x1d354
testl %eax, %eax
je 0xd966
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
movq %r12, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd98b
xorl %r14d, %r14d
xorl %r13d, %r13d
movl $0x4, %r11d
movl $0x2, %r10d
movl $0x2014b50, %edx        # imm = 0x2014B50
movl $0x2d, %r8d
movl 0x14(%rsp), %edi
movl $0x4, %esi
movl $0x1, %ecx
movl $0x1, %r9d
movl $0x0, %eax
pushq $0x0
pushq %r13
pushq %r11
pushq %r13
pushq %r11
pushq %r13
pushq %r10
pushq %r13
pushq %r10
pushq %r14
pushq %r10
pushq %rbx
pushq %r10
pushq 0x90(%rsp)
pushq %r10
pushq %rbp
pushq %r11
pushq %r15
pushq %r11
pushq %r12
pushq %r11
pushq 0xd8(%rsp)
pushq %r11
movl $0x8, %r11d
pushq %r11
pushq %r10
pushq %r11
pushq %r10
pushq $0x2d
pushq %r10
pushq $0xff
callq 0xd98b
addq $0xf0, %rsp
movl %eax, %r15d
movl 0xfbe8(%rip), %ebp      # 0x1d354
movq 0xfc2d(%rip), %r12      # 0x1d3a0
testq %r12, %r12
jne 0xd77f
movq 0xfc29(%rip), %r12      # 0x1d3a8
movl 0x8(%rsp), %eax
movq %rax, 0x8(%rsp)
movq %r12, %rdi
callq 0x31a0
movq %rax, %r13
movl %ebp, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0xbcde
addq %r13, %r15
cmpb $0x0, 0x7(%rsp)
je 0xd7eb
movl 0xfba4(%rip), %edi      # 0x1d354
movl $0x1, %edx
movl $0x10, %r8d
movl $0x2, %esi
movl $0x2, %ecx
movl $0x8, %r9d
xorl %eax, %eax
pushq $0x0
movq 0x20(%rsp), %rbx
pushq %rbx
pushq $0x8
pushq 0x38(%rsp)
callq 0xd98b
addq $0x20, %rsp
movl %eax, %eax
addq %rax, %r15
jmp 0xd7f0
movq 0x18(%rsp), %rbx
movl 0xfb5e(%rip), %edi      # 0x1d354
movl $0x5455, %edx           # imm = 0x5455
movl $0x5, %r8d
movl $0x2, %esi
movl $0x2, %ecx
movl $0x1, %r9d
xorl %eax, %eax
pushq $0x0
pushq 0xfb9d(%rip)            # 0x1d3b8
pushq $0x4
pushq $0x1
callq 0xd98b
addq $0x20, %rsp
movl %eax, %r14d
addq %r15, %r14
movq 0xfb7b(%rip), %r15      # 0x1d3b0
testq %r15, %r15
je 0xd85b
movl 0xfb14(%rip), %ebp      # 0x1d354
movq %r15, %rdi
callq 0x31a0
movq %rax, %r12
movl %ebp, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0xbcde
addq %r12, %r14
movq 0x40(%rsp), %rbp
addq %rbx, %rbp
addq 0x8(%rsp), %rbp
movl $0x1, %r10d
cmpq 0x38(%rsp), %rbp
jbe 0xd909
movl 0xfad5(%rip), %edi      # 0x1d354
leaq (%r14,%rbp), %r13
movl $0x1, %r12d
movl $0x4, %r11d
movl $0x8, %r15d
xorl %ebx, %ebx
movl $0x2d, %r10d
movl $0x6064b50, %edx        # imm = 0x6064B50
movl $0x2c, %r8d
movl $0x4, %esi
movl $0x8, %ecx
movl $0x2, %r9d
xorl %eax, %eax
pushq $0x0
pushq %r12
pushq %r11
pushq %r13
pushq %r15
pushq %rbx
pushq %r11
pushq $0x7064b50              # imm = 0x7064B50
pushq %r11
pushq %rbp
pushq %r15
pushq %r14
pushq %r15
pushq %r12
pushq %r15
pushq %r12
pushq %r15
pushq %rbx
pushq %r11
pushq %rbx
pushq %r11
pushq %r10
pushq $0x2
pushq %r10
callq 0xd98b
addq $0xc0, %rsp
movl $0xffff, %r10d          # imm = 0xFFFF
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
jmp 0xd90c
movq %rbp, %r12
movl 0xfa42(%rip), %edi      # 0x1d354
xorl %r11d, %r11d
movl $0x2, %ebx
movl $0x4, %r15d
movl $0x6054b50, %edx        # imm = 0x6054B50
movl $0x4, %esi
movl $0x2, %ecx
xorl %r8d, %r8d
movl $0x2, %r9d
xorl %eax, %eax
pushq $0x0
pushq %r11
pushq %rbx
pushq %r12
pushq %r15
pushq %r14
pushq %r15
pushq %r10
pushq %rbx
pushq %r10
pushq %rbx
pushq %r11
callq 0xd98b
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %esi
movq %r12, %rdx
movl $0x4, %ecx
movq %rbp, %r8
xorl %r9d, %r9d
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd98b