// File: /workspace/github_c_makefile_star2_O2/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 0xf8ff(%rip), %eax      # 0x1c388
cmpl $0x2, %eax
jl 0xcbd0
movl 0xf8bc(%rip), %ebx      # 0x1c354
movq 0xf919(%rip), %rdi      # 0x1c3b8
callq 0xd3c9
movq %rax, %r12
movq 0xf8f2(%rip), %rdi      # 0x1c3a0
testq %rdi, %rdi
jne 0xcaba
movq 0xf8ee(%rip), %rdi      # 0x1c3a8
callq 0x31a0
subq $0x80, %rsp
pushq $0x2
popq %r14
movl %r14d, 0x68(%rsp)
movq %rax, 0x60(%rsp)
movl %r14d, 0x58(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x50(%rsp)
pushq $0x4
popq %r15
movl %r15d, 0x48(%rsp)
movq %rax, 0x40(%rsp)
movl %r15d, 0x38(%rsp)
movl %r15d, 0x28(%rsp)
movq %r12, 0x20(%rsp)
movl %r15d, 0x18(%rsp)
pushq $0x8
popq %rax
movq %rax, 0x10(%rsp)
movl %r14d, 0x8(%rsp)
movq %rax, (%rsp)
andl $0x0, 0x78(%rsp)
movq $0x1d, 0x70(%rsp)
andq $0x0, 0x30(%rsp)
pushq $0x2d
popq %r8
movl $0x4034b50, %edx        # imm = 0x4034B50
movl %ebx, %edi
movl %r15d, %esi
movl %r14d, %ecx
movl %r14d, %r9d
xorl %eax, %eax
callq 0xd21e
addq $0x80, %rsp
movl %eax, %ebx
movl 0xf800(%rip), %ebp      # 0x1c354
movq 0xf845(%rip), %r13      # 0x1c3a0
testq %r13, %r13
jne 0xcb67
movq 0xf841(%rip), %r13      # 0x1c3a8
movq %r13, %rdi
callq 0x31a0
movq %rax, %r12
movl %ebp, %edi
movq %r13, %rsi
movq %rax, %rdx
callq 0xb58d
movl 0xf7cf(%rip), %edi      # 0x1c354
pushq $0x1
popq %rdx
pushq $0x10
popq %r8
pushq $0x8
popq %r9
movl %r14d, %esi
movl %r14d, %ecx
movl $0x0, %eax
pushq $0x0
pushq 0xf815(%rip)            # 0x1c3b8
pushq %r15
pushq $0x1
pushq $0x1
pushq $0x5
pushq %r14
pushq $0x5455                 # imm = 0x5455
pushq %r14
pushq $0x0
pushq $0x8
pushq $0x0
callq 0xd21e
addq $0x60, %rsp
movl %eax, %eax
addq %rax, %rbx
addq %r12, %rbx
jmp 0xcd51
testl %eax, %eax
je 0xcc4a
cmpq $0x0, 0xf7d4(%rip)      # 0x1c3b0
je 0xcbec
leaq 0x8d13(%rip), %rdi      # 0x158f8
xorl %eax, %eax
callq 0x4419
movl 0xf7da(%rip), %eax      # 0x1c3cc
movl $0x78c0, %ecx           # imm = 0x78C0
cmpl $0x8, %eax
jg 0xcc1e
movl $0x7800, %ecx           # imm = 0x7800
cmpl $0x1, %eax
je 0xcc1e
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
shll $0x6, %ecx
movl $0x7840, %edx           # imm = 0x7840
addl %edx, %ecx
cmpl $0x6, %eax
cmovgel %edx, %ecx
movw $0x1f, %si
movl %ecx, %eax
xorl %edx, %edx
divw %si
movzwl %dx, %edx
orl %ecx, %edx
xorl $0x1f, %edx
movl 0xf71d(%rip), %edi      # 0x1c354
pushq $-0x2
popq %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xd21e
movl %eax, %ebx
jmp 0xcd51
movl 0xf704(%rip), %edi      # 0x1c354
xorl %eax, %eax
cmpq $0x0, 0xf746(%rip)      # 0x1c3a0
setne %al
xorl %ecx, %ecx
cmpq $0x0, 0xf749(%rip)      # 0x1c3b0
setne %cl
shll $0x4, %ecx
leal (%rcx,%rax,8), %eax
movq 0xf741(%rip), %rdx      # 0x1c3b8
movl 0xf74f(%rip), %esi      # 0x1c3cc
pushq $0x1
popq %rcx
xorl %r8d, %r8d
cmpl %ecx, %esi
sete %r8b
shll $0x2, %r8d
cmpl $0x9, %esi
pushq $0x2
popq %rsi
cmovlq %r8, %rsi
subq $0x50, %rsp
movl %ecx, 0x38(%rsp)
movl %ecx, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
movl %ecx, 0x8(%rsp)
movq %rsi, 0x30(%rsp)
andl $0x0, 0x48(%rsp)
movq %rax, 0x10(%rsp)
movq $0x3, 0x40(%rsp)
movl $0x4, 0x18(%rsp)
movq $0x8, (%rsp)
pushq $0x1f
popq %rdx
movl $0x8b, %r8d
movl %ecx, %esi
movl %ecx, %r9d
xorl %eax, %eax
callq 0xd21e
addq $0x50, %rsp
movl %eax, %ebx
movq 0xf6aa(%rip), %r14      # 0x1c3a0
testq %r14, %r14
je 0xcd20
movl 0xf653(%rip), %ebp      # 0x1c354
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xb58d
addq %r15, %rbx
incq %rbx
movq 0xf689(%rip), %r14      # 0x1c3b0
testq %r14, %r14
je 0xcd51
movl 0xf622(%rip), %ebp      # 0x1c354
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xb58d
addq %r15, %rbx
incq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq