// File: /workspace/github_c_makefile_star2_O0/KhronosGroup[P]dfdutils/createdfd.c
// Function: createDFD422
uint32_t *createDFD422(int bigEndian, int numSamples,
                       int bits[], int paddings[], int channels[],
                       int position_xs[], int position_ys[],
                       enum VkSuffix suffix) {
    assert(!bigEndian); (void) bigEndian;
    assert(suffix == s_UNORM); (void) suffix;

    int totalBits = 0;
    for (int i = 0; i < numSamples; ++i)
        totalBits += bits[i] + paddings[i];
    assert(totalBits % 8 == 0);

    uint32_t BDFDSize = sizeof(uint32_t) * (KHR_DF_WORD_SAMPLESTART + numSamples * KHR_DF_WORD_SAMPLEWORDS);
    uint32_t DFDSize = sizeof(uint32_t) + BDFDSize;
    uint32_t *DFD = (uint32_t *) malloc(DFDSize);
    memset(DFD, 0, DFDSize);
    DFD[0] = DFDSize;
    uint32_t *BDFD = DFD + 1;
    KHR_DFDSETVAL(BDFD, VENDORID, KHR_DF_VENDORID_KHRONOS);
    KHR_DFDSETVAL(BDFD, DESCRIPTORTYPE, KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT);
    KHR_DFDSETVAL(BDFD, VERSIONNUMBER, KHR_DF_VERSIONNUMBER_LATEST);
    KHR_DFDSETVAL(BDFD, DESCRIPTORBLOCKSIZE, BDFDSize);
    KHR_DFDSETVAL(BDFD, MODEL, KHR_DF_MODEL_YUVSDA);
    KHR_DFDSETVAL(BDFD, PRIMARIES, KHR_DF_PRIMARIES_UNSPECIFIED);
    KHR_DFDSETVAL(BDFD, TRANSFER, KHR_DF_TRANSFER_LINEAR);
    KHR_DFDSETVAL(BDFD, FLAGS, KHR_DF_FLAG_ALPHA_STRAIGHT);
    KHR_DFDSETVAL(BDFD, TEXELBLOCKDIMENSION0, 2 - 1); // 422 contains 2 x 1 blocks
    KHR_DFDSETVAL(BDFD, TEXELBLOCKDIMENSION1, 1 - 1);
    KHR_DFDSETVAL(BDFD, TEXELBLOCKDIMENSION2, 1 - 1);
    KHR_DFDSETVAL(BDFD, TEXELBLOCKDIMENSION3, 1 - 1);
    KHR_DFDSETVAL(BDFD, BYTESPLANE0, totalBits / 8);
    KHR_DFDSETVAL(BDFD, BYTESPLANE1, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE2, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE3, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE4, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE5, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE6, 0);
    KHR_DFDSETVAL(BDFD, BYTESPLANE7, 0);

    int bitOffset = 0;
    for (int i = 0; i < numSamples; ++i) {
        KHR_DFDSETSVAL(BDFD, i, BITOFFSET, bitOffset);
        KHR_DFDSETSVAL(BDFD, i, BITLENGTH, bits[i] - 1);
        KHR_DFDSETSVAL(BDFD, i, CHANNELID, channels[i]);
        KHR_DFDSETSVAL(BDFD, i, QUALIFIERS, 0); // None of: FLOAT, SIGNED, EXPONENT, LINEAR
        KHR_DFDSETSVAL(BDFD, i, SAMPLEPOSITION0, position_xs[i]);
        KHR_DFDSETSVAL(BDFD, i, SAMPLEPOSITION1, position_ys[i]);
        KHR_DFDSETSVAL(BDFD, i, SAMPLEPOSITION2, 0);
        KHR_DFDSETSVAL(BDFD, i, SAMPLEPOSITION3, 0);
        KHR_DFDSETSVAL(BDFD, i, SAMPLELOWER, 0);
        KHR_DFDSETSVAL(BDFD, i, SAMPLEUPPER, (1u << bits[i]) - 1u);
        bitOffset += bits[i] + paddings[i];
    }

    return DFD;
}

// Assembly:
subq $0x58, %rsp
movl 0x68(%rsp), %eax
movq 0x60(%rsp), %rax
movl %edi, 0x54(%rsp)
movl %esi, 0x50(%rsp)
movq %rdx, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %r8, 0x38(%rsp)
movq %r9, 0x30(%rsp)
cmpl $0x0, 0x54(%rsp)
jne 0x2cd2
jmp 0x2cf1
leaq 0x447d(%rip), %rdi      # 0x7156
leaq 0x4429(%rip), %rsi      # 0x7109
movl $0x18a, %edx            # imm = 0x18A
leaq 0x4475(%rip), %rcx      # 0x7161
callq 0x1040
cmpl $0x0, 0x68(%rsp)
jne 0x2cfa
jmp 0x2d19
leaq 0x44b3(%rip), %rdi      # 0x71b4
leaq 0x4401(%rip), %rsi      # 0x7109
movl $0x18b, %edx            # imm = 0x18B
leaq 0x444d(%rip), %rcx      # 0x7161
callq 0x1040
movl $0x0, 0x2c(%rsp)
movl $0x0, 0x28(%rsp)
movl 0x28(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x2d62
movq 0x48(%rsp), %rax
movslq 0x28(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x40(%rsp), %rcx
movslq 0x28(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0x2c(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
jmp 0x2d29
movl 0x2c(%rsp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x2d75
jmp 0x2d94
leaq 0x444a(%rip), %rdi      # 0x71c6
leaq 0x4386(%rip), %rsi      # 0x7109
movl $0x190, %edx            # imm = 0x190
leaq 0x43d2(%rip), %rcx      # 0x7161
callq 0x1040
movl 0x50(%rsp), %eax
shll $0x2, %eax
addl $0x6, %eax
cltq
shlq $0x2, %rax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x4, %rax
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl %eax, %edi
callq 0x1070
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl 0x20(%rsp), %eax
movl %eax, %edx
xorl %esi, %esi
callq 0x1050
movl 0x20(%rsp), %ecx
movq 0x18(%rsp), %rax
movl %ecx, (%rax)
movq 0x18(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl (%rax), %ecx
andl $0xfffe0000, %ecx       # imm = 0xFFFE0000
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movq 0x10(%rsp), %rax
movl (%rax), %ecx
andl $0x1ffff, %ecx          # imm = 0x1FFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movq 0x10(%rsp), %rax
movl 0x4(%rax), %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
orl $0x2, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x10(%rsp), %rax
movl 0x4(%rax), %ecx
andl $0xffff, %ecx           # imm = 0xFFFF
movl 0x24(%rsp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
shll $0x10, %eax
orl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x2, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %ecx
andl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %ecx
andl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
orl $0x10000, %ecx          # imm = 0x10000
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x1, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %ecx
andl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %ecx
andl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x10(%rsp), %rax
movl 0x10(%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
movl 0x2c(%rsp), %eax
movl $0x8, %esi
cltd
idivl %esi
andl $0xff, %eax
shll $0x0, %eax
orl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl 0x10(%rax), %ecx
andl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl 0x10(%rax), %ecx
andl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl 0x10(%rax), %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
andl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
andl $0xff00ffff, %ecx       # imm = 0xFF00FFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
andl $0xffffff, %ecx         # imm = 0xFFFFFF
orl $0x0, %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
movl $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0x50(%rsp), %eax
jge 0x32fc
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xffff0000, %edx       # imm = 0xFFFF0000
movl 0xc(%rsp), %eax
andl $0xffff, %eax           # imm = 0xFFFF
shll $0x0, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xff00ffff, %edx       # imm = 0xFF00FFFF
movq 0x48(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %eax
subl $0x1, %eax
andl $0xff, %eax
shll $0x10, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xf0ffffff, %edx       # imm = 0xF0FFFFFF
movq 0x38(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xf, %eax
shll $0x18, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xfffffff, %edx        # imm = 0xFFFFFFF
orl $0x0, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xffffff00, %edx       # imm = 0xFFFFFF00
movq 0x30(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
shll $0x0, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xffff00ff, %edx       # imm = 0xFFFF00FF
movq 0x60(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
shll $0x8, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xff00ffff, %edx       # imm = 0xFF00FFFF
orl $0x0, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0xffffff, %edx         # imm = 0xFFFFFF
orl $0x0, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0x0, %edx
orl $0x0, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
andl $0x0, %edx
movq 0x48(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
andl $-0x1, %eax
shll $0x0, %eax
orl %eax, %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x48(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq 0x40(%rsp), %rcx
movslq 0x8(%rsp), %rdx
addl (%rcx,%rdx,4), %eax
addl 0xc(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x3010
movq 0x18(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)