// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/pigz.c
// Function: put_header
local length_t put_header(void) {
    length_t len;

    if (g.form > 1) {               // zip
        // write local header -- we don't know yet whether the lengths will fit
        // in 32 bits or not, so we have to assume that they might not and put
        // in a Zip64 extra field so that the data descriptor that appears
        // after the compressed data is interpreted with 64-bit lengths
        len = put(g.outd,
            4, (val_t)0x04034b50,   // local header signature
            2, (val_t)45,           // version needed to extract (4.5)
            2, (val_t)8,            // flags: data descriptor follows data
            2, (val_t)8,            // deflate
            4, (val_t)time2dos(g.mtime),
            4, (val_t)0,            // crc (not here)
            4, (val_t)LOW32,        // compressed length (not here)
            4, (val_t)LOW32,        // uncompressed length (not here)
            2, (val_t)(strlen(g.name == NULL ? g.alias : g.name)),  // name len
            2, (val_t)29,           // length of extra field (see below)
            0);

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

        // write Zip64 and extended timestamp extra field blocks (29 bytes)
        len += 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)0,            // uncompressed length (not here)
            8, (val_t)0,            // compressed length (not here)
            2, (val_t)0x5455,       // extended timestamp ID
            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);
    }
    else if (g.form) {              // zlib
        if (g.comment != NULL)
            complain("can't store comment in zlib format -- ignoring");
        unsigned head;
        head = (0x78 << 8) +        // deflate, 32K window
               (g.level >= 9 ? 3 << 6 :
                g.level == 1 ? 0 << 6:
                g.level >= 6 || g.level == Z_DEFAULT_COMPRESSION ? 1 << 6 :
                2 << 6);            // optional compression level clue
        head += 31 - (head % 31);   // make it a multiple of 31
        len = put(g.outd,
            -2, (val_t)head,        // zlib format uses big-endian order
            0);
    }
    else {                          // gzip
        len = put(g.outd,
            1, (val_t)31,
            1, (val_t)139,
            1, (val_t)8,            // deflate
            1, (val_t)((g.name != NULL ? 8 : 0) +
                       (g.comment != NULL ? 16 : 0)),
            4, (val_t)g.mtime,
            1, (val_t)(g.level >= 9 ? 2 : g.level == 1 ? 4 : 0),
            1, (val_t)3,            // unix
            0);
        if (g.name != NULL)
            len += writen(g.outd, g.name, strlen(g.name) + 1);
        if (g.comment != NULL)
            len += writen(g.outd, g.comment, strlen(g.comment) + 1);
    }
    return len;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0xfd00(%rip), %eax      # 0x1d398
cmpl $0x2, %eax
jl 0xd7c7
movl 0xfcbd(%rip), %ebp      # 0x1d364
movq 0xfd1a(%rip), %rdi      # 0x1d3c8
callq 0xdece
movq %rax, %rbx
movq 0xfcf3(%rip), %rdi      # 0x1d3b0
testq %rdi, %rdi
jne 0xd6c9
movq 0xfcef(%rip), %rdi      # 0x1d3b8
callq 0x31a0
movq %rax, %r10
xorl %r15d, %r15d
movl $0x2, %r13d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0x4, %r12d
movl $0x8, %r11d
movl $0x4034b50, %edx        # imm = 0x4034B50
movl $0x2d, %r8d
movl %ebp, %edi
movl $0x4, %esi
movl $0x2, %ecx
movl $0x2, %r9d
movl $0x0, %eax
pushq %r15
pushq $0x1d
pushq %r13
pushq %r10
pushq %r13
pushq %r14
pushq %r12
pushq %r14
pushq %r12
pushq %r15
pushq %r12
pushq %rbx
pushq %r12
pushq %r11
pushq %r13
pushq %r11
callq 0xdd21
addq $0x80, %rsp
movl %eax, %ebx
movl 0xfc23(%rip), %ebp      # 0x1d364
movq 0xfc68(%rip), %r15      # 0x1d3b0
testq %r15, %r15
jne 0xd754
movq 0xfc64(%rip), %r15      # 0x1d3b8
movq %r15, %rdi
callq 0x31a0
movq %rax, %r14
movl %ebp, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0xc0bf
movl 0xfbf2(%rip), %edi      # 0x1d364
movl $0x1, %edx
movl $0x10, %r8d
movl $0x2, %esi
movl $0x2, %ecx
movl $0x8, %r9d
xorl %eax, %eax
xorl %r10d, %r10d
pushq %r10
pushq 0xfc2e(%rip)            # 0x1d3c8
pushq %r12
pushq $0x1
pushq $0x1
pushq $0x5
pushq %r13
pushq $0x5455                 # imm = 0x5455
pushq %r13
pushq %r10
pushq $0x8
pushq %r10
callq 0xdd21
addq $0x60, %rsp
movl %eax, %eax
addq %rax, %rbx
addq %r14, %rbx
jmp 0xd935
testl %eax, %eax
je 0xd84a
cmpq $0x0, 0xfbed(%rip)      # 0x1d3c0
je 0xd7e3
leaq 0x9114(%rip), %rdi      # 0x168f0
xorl %eax, %eax
callq 0x479d
movl 0xfbf3(%rip), %ecx      # 0x1d3dc
movl $0x78c0, %eax           # imm = 0x78C0
cmpl $0x8, %ecx
jg 0xd815
movl $0x7800, %eax           # imm = 0x7800
cmpl $0x1, %ecx
je 0xd815
xorl %eax, %eax
cmpl $-0x1, %ecx
setne %al
shll $0x6, %eax
movl $0x7840, %edx           # imm = 0x7840
addl %edx, %eax
cmpl $0x6, %ecx
cmovgel %edx, %eax
imull $0x4211, %eax, %ecx     # imm = 0x4211
shrl $0x13, %ecx
movl %ecx, %edx
shll $0x5, %edx
subl %edx, %ecx
addl %eax, %ecx
movzwl %cx, %edx
orl %eax, %edx
xorl $0x1f, %edx
movl 0xfb2f(%rip), %edi      # 0x1d364
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xdd21
movl %eax, %ebx
jmp 0xd935
movl 0xfb14(%rip), %edi      # 0x1d364
xorl %eax, %eax
cmpq $0x0, 0xfb56(%rip)      # 0x1d3b0
setne %al
xorl %ecx, %ecx
cmpq $0x0, 0xfb59(%rip)      # 0x1d3c0
setne %cl
shll $0x4, %ecx
leal (%rcx,%rax,8), %r10d
movl 0xfb65(%rip), %eax      # 0x1d3dc
movl $0x1, %r11d
xorl %ecx, %ecx
cmpl %r11d, %eax
sete %cl
shll $0x2, %ecx
cmpl $0x9, %eax
movl $0x2, %ebx
cmovlq %rcx, %rbx
movl $0x1f, %edx
movl $0x8b, %r8d
movl $0x1, %esi
movl $0x1, %ecx
movl $0x1, %r9d
xorl %eax, %eax
pushq $0x0
pushq $0x3
pushq %r11
pushq %rbx
pushq %r11
pushq 0xfb08(%rip)            # 0x1d3c8
pushq $0x4
pushq %r10
pushq %r11
pushq $0x8
callq 0xdd21
addq $0x50, %rsp
movl %eax, %ebx
movq 0xfad6(%rip), %r14      # 0x1d3b0
testq %r14, %r14
je 0xd904
movl 0xfa7f(%rip), %ebp      # 0x1d364
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xc0bf
addq %r15, %rbx
incq %rbx
movq 0xfab5(%rip), %r14      # 0x1d3c0
testq %r14, %r14
je 0xd935
movl 0xfa4e(%rip), %ebp      # 0x1d364
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xc0bf
addq %r15, %rbx
incq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq