// File: /workspace/github_c_makefile_star2_O0/KhronosGroup[P]dfdutils/createdfd.c
// Function: createDFDPackedPadded
uint32_t *createDFDPackedPadded(int bigEndian, int numChannels,
                                int bits[], int paddings[], int channels[],
                                enum VkSuffix suffix)
{
    uint32_t *DFD = 0;
    if (numChannels == 6) {
        /* Special case E5B9G9R9 */
        DFD = writeHeader(numChannels, 4, s_UFLOAT, i_COLOR);
        writeSample(DFD, 0, 0,
                    9, 0,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 0, SAMPLEUPPER, 8448);
        writeSample(DFD, 1, 0 | KHR_DF_SAMPLE_DATATYPE_EXPONENT,
                    5, 27,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 1, SAMPLELOWER, 15);
        KHR_DFDSETSVAL((DFD+1), 1, SAMPLEUPPER, 31);
        writeSample(DFD, 2, 1,
                    9, 9,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 2, SAMPLEUPPER, 8448);
        writeSample(DFD, 3, 1 | KHR_DF_SAMPLE_DATATYPE_EXPONENT,
                    5, 27,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 3, SAMPLELOWER, 15);
        KHR_DFDSETSVAL((DFD+1), 3, SAMPLEUPPER, 31);
        writeSample(DFD, 4, 2,
                    9, 18,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 4, SAMPLEUPPER, 8448);
        writeSample(DFD, 5, 2 | KHR_DF_SAMPLE_DATATYPE_EXPONENT,
                    5, 27,
                    1, 1, s_UNORM);
        KHR_DFDSETSVAL((DFD+1), 5, SAMPLELOWER, 15);
        KHR_DFDSETSVAL((DFD+1), 5, SAMPLEUPPER, 31);
    } else if (bigEndian) {
        /* No packed format is larger than 32 bits. */
        /* No packed channel crosses more than two bytes. */
        int totalBits = 0;
        int bitChannel[32];
        int beChannelStart[4];
        int channelCounter;
        int bitOffset = 0;
        int BEMask;
        int numSamples = numChannels;
        int sampleCounter;
        for (channelCounter = 0; channelCounter < numChannels; ++channelCounter) {
            beChannelStart[channelCounter] = totalBits;
            totalBits += bits[channelCounter] + paddings[channelCounter];
        }
        BEMask = (totalBits - 1) & 0x18;
        for (channelCounter = 0; channelCounter < numChannels; ++channelCounter) {
            bitChannel[bitOffset ^ BEMask] = channelCounter;
            if (((bitOffset + bits[channelCounter] - 1) & ~7) != (bitOffset & ~7)) {
                /* Continuation sample */
                bitChannel[((bitOffset + bits[channelCounter] - 1) & ~7) ^ BEMask] = channelCounter;
                numSamples++;
            }
            bitOffset += bits[channelCounter] + paddings[channelCounter];
        }
        DFD = writeHeader(numSamples, totalBits >> 3, suffix, i_COLOR);

        sampleCounter = 0;
        for (bitOffset = 0; bitOffset < totalBits;) {
            if (bitChannel[bitOffset] == -1) {
                /* Done this bit, so this is the lower half of something. */
                /* We must therefore jump to the end of the byte and continue. */
                bitOffset = (bitOffset + 8) & ~7;
            } else {
                /* Start of a channel? */
                int thisChannel = bitChannel[bitOffset];
                if ((beChannelStart[thisChannel] ^ BEMask) == bitOffset) {
                    /* Must be just one sample if we hit it first. */
                    writeSample(DFD, sampleCounter++, channels[thisChannel],
                                    bits[thisChannel], bitOffset,
                                    1, 1, suffix);
                    bitOffset += bits[thisChannel];
                } else {
                    /* Two samples. Move to the end of the first one we hit when we're done. */
                    int firstSampleBits = 8 - (beChannelStart[thisChannel] & 0x7); /* Rest of the byte */
                    int secondSampleBits = bits[thisChannel] - firstSampleBits; /* Rest of the bits */
                    writeSample(DFD, sampleCounter++, channels[thisChannel],
                                firstSampleBits, beChannelStart[thisChannel] ^ BEMask,
                                0, 1, suffix);
                    /* Mark that we've already handled this sample */
                    bitChannel[beChannelStart[thisChannel] ^ BEMask] = -1;
                    writeSample(DFD, sampleCounter++, channels[thisChannel],
                                secondSampleBits, bitOffset,
                                1, 0, suffix);
                    bitOffset += secondSampleBits;
                }
            }
        }

    } else { /* Little-endian */

        int sampleCounter;
        int totalBits = 0;
        int bitOffset = 0;
        for (sampleCounter = 0; sampleCounter < numChannels; ++sampleCounter) {
            totalBits += bits[sampleCounter] + paddings[sampleCounter];
        }

        /* One sample per channel */
        DFD = writeHeader(numChannels, totalBits >> 3, suffix, i_COLOR);
        for (sampleCounter = 0; sampleCounter < numChannels; ++sampleCounter) {
            writeSample(DFD, sampleCounter, channels[sampleCounter],
                        bits[sampleCounter], bitOffset,
                        1, 1, suffix);
            bitOffset += bits[sampleCounter] + paddings[sampleCounter];
        }
    }
    return DFD;
}

// Assembly:
subq $0x108, %rsp            # imm = 0x108
movl %edi, 0x104(%rsp)
movl %esi, 0x100(%rsp)
movq %rdx, 0xf8(%rsp)
movq %rcx, 0xf0(%rsp)
movq %r8, 0xe8(%rsp)
movl %r9d, 0xe4(%rsp)
movq $0x0, 0xd8(%rsp)
cmpl $0x6, 0x100(%rsp)
jne 0x279d
movl 0x100(%rsp), %edi
movl $0x4, %esi
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x21d0
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
xorl %r8d, %r8d
movl $0x9, %ecx
movl $0x1, %r9d
movl %r8d, %esi
movl %r8d, %edx
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x28(%rax), %ecx
andl $0x0, %ecx
orl $0x2100, %ecx           # imm = 0x2100
movq 0xd8(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0xd8(%rsp), %rdi
movl $0x1, %r9d
movl $0x20, %edx
movl $0x5, %ecx
movl $0x1b, %r8d
xorl %eax, %eax
movl %r9d, %esi
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x34(%rax), %ecx
andl $0x0, %ecx
orl $0xf, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x34(%rax)
movq 0xd8(%rsp), %rax
movl 0x38(%rax), %ecx
andl $0x0, %ecx
orl $0x1f, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x38(%rax)
movq 0xd8(%rsp), %rdi
movl $0x2, %esi
movl $0x1, %r9d
movl $0x9, %r8d
xorl %eax, %eax
movl %r9d, %edx
movl %r8d, %ecx
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x48(%rax), %ecx
andl $0x0, %ecx
orl $0x2100, %ecx           # imm = 0x2100
movq 0xd8(%rsp), %rax
movl %ecx, 0x48(%rax)
movq 0xd8(%rsp), %rdi
movl $0x3, %esi
movl $0x21, %edx
movl $0x5, %ecx
movl $0x1b, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x54(%rax), %ecx
andl $0x0, %ecx
orl $0xf, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x54(%rax)
movq 0xd8(%rsp), %rax
movl 0x58(%rax), %ecx
andl $0x0, %ecx
orl $0x1f, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x58(%rax)
movq 0xd8(%rsp), %rdi
movl $0x4, %esi
movl $0x2, %edx
movl $0x9, %ecx
movl $0x12, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x68(%rax), %ecx
andl $0x0, %ecx
orl $0x2100, %ecx           # imm = 0x2100
movq 0xd8(%rsp), %rax
movl %ecx, 0x68(%rax)
movq 0xd8(%rsp), %rdi
movl $0x5, %ecx
movl $0x22, %edx
movl $0x1b, %r8d
movl $0x1, %r9d
xorl %eax, %eax
movl %ecx, %esi
movl $0x1, (%rsp)
movl $0x0, 0x8(%rsp)
callq 0x22e0
movq 0xd8(%rsp), %rax
movl 0x74(%rax), %ecx
andl $0x0, %ecx
orl $0xf, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x74(%rax)
movq 0xd8(%rsp), %rax
movl 0x78(%rax), %ecx
andl $0x0, %ecx
orl $0x1f, %ecx
movq 0xd8(%rsp), %rax
movl %ecx, 0x78(%rax)
jmp 0x2c0c
cmpl $0x0, 0x104(%rsp)
je 0x2aeb
movl $0x0, 0xd4(%rsp)
movl $0x0, 0x38(%rsp)
movl 0x100(%rsp), %eax
movl %eax, 0x30(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x100(%rsp), %eax
jge 0x2829
movl 0xd4(%rsp), %ecx
movslq 0x3c(%rsp), %rax
movl %ecx, 0x40(%rsp,%rax,4)
movq 0xf8(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0xf0(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0xd4(%rsp), %eax
movl %eax, 0xd4(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x27d1
movl 0xd4(%rsp), %eax
subl $0x1, %eax
andl $0x18, %eax
movl %eax, 0x34(%rsp)
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x100(%rsp), %eax
jge 0x28f5
movl 0x3c(%rsp), %ecx
movl 0x38(%rsp), %eax
xorl 0x34(%rsp), %eax
cltq
movl %ecx, 0x50(%rsp,%rax,4)
movl 0x38(%rsp), %eax
movq 0xf8(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
subl $0x1, %eax
andl $-0x8, %eax
movl 0x38(%rsp), %ecx
andl $-0x8, %ecx
cmpl %ecx, %eax
je 0x28bd
movl 0x3c(%rsp), %ecx
movl 0x38(%rsp), %eax
movq 0xf8(%rsp), %rdx
movslq 0x3c(%rsp), %rsi
addl (%rdx,%rsi,4), %eax
subl $0x1, %eax
andl $-0x8, %eax
xorl 0x34(%rsp), %eax
cltq
movl %ecx, 0x50(%rsp,%rax,4)
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
movq 0xf8(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0xf0(%rsp), %rcx
movslq 0x3c(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x2842
movl 0x30(%rsp), %edi
movl 0xd4(%rsp), %esi
sarl $0x3, %esi
movl 0xe4(%rsp), %edx
xorl %ecx, %ecx
callq 0x21d0
movq %rax, 0xd8(%rsp)
movl $0x0, 0x2c(%rsp)
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0xd4(%rsp), %eax
jge 0x2ae6
movslq 0x38(%rsp), %rax
cmpl $-0x1, 0x50(%rsp,%rax,4)
jne 0x2959
movl 0x38(%rsp), %eax
addl $0x8, %eax
andl $-0x8, %eax
movl %eax, 0x38(%rsp)
jmp 0x2ae1
movslq 0x38(%rsp), %rax
movl 0x50(%rsp,%rax,4), %eax
movl %eax, 0x28(%rsp)
movslq 0x28(%rsp), %rax
movl 0x40(%rsp,%rax,4), %eax
xorl 0x34(%rsp), %eax
cmpl 0x38(%rsp), %eax
jne 0x29ed
movq 0xd8(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0xe8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0xf8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movl 0x38(%rsp), %r8d
movl 0xe4(%rsp), %eax
movl $0x1, %r9d
movl $0x1, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x22e0
movq 0xf8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
jmp 0x2adf
movslq 0x28(%rsp), %rax
movl 0x40(%rsp,%rax,4), %ecx
andl $0x7, %ecx
movl $0x8, %eax
subl %ecx, %eax
movl %eax, 0x24(%rsp)
movq 0xf8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
subl 0x24(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0xd8(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0xe8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movl 0x24(%rsp), %ecx
movslq 0x28(%rsp), %rax
movl 0x40(%rsp,%rax,4), %r8d
xorl 0x34(%rsp), %r8d
movl 0xe4(%rsp), %eax
xorl %r9d, %r9d
movl $0x1, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x22e0
movslq 0x28(%rsp), %rax
movl 0x40(%rsp,%rax,4), %eax
xorl 0x34(%rsp), %eax
cltq
movl $0xffffffff, 0x50(%rsp,%rax,4) # imm = 0xFFFFFFFF
movq 0xd8(%rsp), %rdi
movl 0x2c(%rsp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, 0x2c(%rsp)
movq 0xe8(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movl 0x20(%rsp), %ecx
movl 0x38(%rsp), %r8d
movl 0xe4(%rsp), %eax
movl $0x1, %r9d
xorl %r10d, %r10d
movl $0x0, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x22e0
movl 0x20(%rsp), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
jmp 0x2ae1
jmp 0x2929
jmp 0x2c0a
movl $0x0, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x100(%rsp), %eax
jge 0x2b45
movq 0xf8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0xf0(%rsp), %rcx
movslq 0x1c(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0x18(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2b03
movl 0x100(%rsp), %edi
movl 0x18(%rsp), %esi
sarl $0x3, %esi
movl 0xe4(%rsp), %edx
xorl %ecx, %ecx
callq 0x21d0
movq %rax, 0xd8(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x100(%rsp), %eax
jge 0x2c08
movq 0xd8(%rsp), %rdi
movl 0x1c(%rsp), %esi
movq 0xe8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0xf8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movl 0x14(%rsp), %r8d
movl 0xe4(%rsp), %eax
movl $0x1, %r9d
movl $0x1, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x22e0
movq 0xf8(%rsp), %rax
movslq 0x1c(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0xf0(%rsp), %rcx
movslq 0x1c(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x2b71
jmp 0x2c0a
jmp 0x2c0c
movq 0xd8(%rsp), %rax
addq $0x108, %rsp            # imm = 0x108
retq
nopl (%rax)