// File: /workspace/github_c_makefile_star2_O1/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 0x1008b(%rip), %eax     # 0x1d388
cmpl $0x2, %eax
jl 0xd42c
movl 0x10048(%rip), %ebp     # 0x1d354
movq 0x100a5(%rip), %rdi     # 0x1d3b8
callq 0xdb40
movq %rax, %rbx
movq 0x1007e(%rip), %rdi     # 0x1d3a0
testq %rdi, %rdi
jne 0xd32e
movq 0x1007a(%rip), %rdi     # 0x1d3a8
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 0xd98b
addq $0x80, %rsp
movl %eax, %ebx
movl 0xffae(%rip), %ebp      # 0x1d354
movq 0xfff3(%rip), %r15      # 0x1d3a0
testq %r15, %r15
jne 0xd3b9
movq 0xffef(%rip), %r15      # 0x1d3a8
movq %r15, %rdi
callq 0x31a0
movq %rax, %r14
movl %ebp, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0xbcde
movl 0xff7d(%rip), %edi      # 0x1d354
movl $0x1, %edx
movl $0x10, %r8d
movl $0x2, %esi
movl $0x2, %ecx
movl $0x8, %r9d
xorl %eax, %eax
xorl %r10d, %r10d
pushq %r10
pushq 0xffb9(%rip)            # 0x1d3b8
pushq %r12
pushq $0x1
pushq $0x1
pushq $0x5
pushq %r13
pushq $0x5455                 # imm = 0x5455
pushq %r13
pushq %r10
pushq $0x8
pushq %r10
callq 0xd98b
addq $0x60, %rsp
movl %eax, %eax
addq %rax, %rbx
addq %r14, %rbx
jmp 0xd59f
testl %eax, %eax
je 0xd4b4
cmpq $0x0, 0xff74(%rip)      # 0x1d3b0
je 0xd44c
leaq 0x94ab(%rip), %rdi      # 0x168f0
xorl %eax, %eax
callq 0x476b
movl 0xff7a(%rip), %ecx      # 0x1d3cc
movl $0x78c0, %eax           # imm = 0x78C0
cmpl $0x8, %ecx
jg 0xd47e
movl $0x7800, %eax           # imm = 0x7800
cmpl $0x1, %ecx
je 0xd47e
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
movl %eax, %ecx
imulq $0x8421085, %rcx, %rdx  # imm = 0x8421085
shrq $0x20, %rdx
movl %edx, %ecx
shll $0x5, %ecx
subl %ecx, %edx
addl %eax, %edx
orl %eax, %edx
xorl $0x1f, %edx
movl 0xfeb5(%rip), %edi      # 0x1d354
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xd98b
movl %eax, %ebx
jmp 0xd59f
movl 0xfe9a(%rip), %edi      # 0x1d354
xorl %eax, %eax
cmpq $0x0, 0xfedc(%rip)      # 0x1d3a0
setne %al
xorl %ecx, %ecx
cmpq $0x0, 0xfedf(%rip)      # 0x1d3b0
setne %cl
shll $0x4, %ecx
leal (%rcx,%rax,8), %r10d
movl 0xfeeb(%rip), %eax      # 0x1d3cc
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 0xfe8e(%rip)            # 0x1d3b8
pushq $0x4
pushq %r10
pushq %r11
pushq $0x8
callq 0xd98b
addq $0x50, %rsp
movl %eax, %ebx
movq 0xfe5c(%rip), %r14      # 0x1d3a0
testq %r14, %r14
je 0xd56e
movl 0xfe05(%rip), %ebp      # 0x1d354
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xbcde
addq %r15, %rbx
incq %rbx
movq 0xfe3b(%rip), %r14      # 0x1d3b0
testq %r14, %r14
je 0xd59f
movl 0xfdd4(%rip), %ebp      # 0x1d354
movq %r14, %rdi
callq 0x31a0
movq %rax, %r15
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0xbcde
addq %r15, %rbx
incq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq