// File: /workspace/github_c_makefile_star2_O0/KhronosGroup[P]dfdutils/createdfd.c
// Function: createDFDCompressed
uint32_t *createDFDCompressed(enum VkCompScheme compScheme, int bwidth, int bheight, int bdepth,
                              enum VkSuffix suffix)
{
    uint32_t *DFD = 0;
    uint32_t numSamples = compSampleCount[compScheme];
    uint32_t* BDFD;
    uint32_t *sample;
    uint32_t channel;
    // Use union to avoid type-punning complaints from gcc optimizer
    // with -Wall.
    union {
        uint32_t i;
        float f;
    } lower, upper;

    DFD = (uint32_t *) malloc(sizeof(uint32_t) *
                              (1 + KHR_DF_WORD_SAMPLESTART +
                               numSamples * KHR_DF_WORD_SAMPLEWORDS));
    BDFD = DFD+1;
    DFD[0] = sizeof(uint32_t) *
        (1 + KHR_DF_WORD_SAMPLESTART +
         numSamples * KHR_DF_WORD_SAMPLEWORDS);
    BDFD[KHR_DF_WORD_VENDORID] =
        (KHR_DF_VENDORID_KHRONOS << KHR_DF_SHIFT_VENDORID) |
        (KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT << KHR_DF_SHIFT_DESCRIPTORTYPE);
    BDFD[KHR_DF_WORD_VERSIONNUMBER] =
        (KHR_DF_VERSIONNUMBER_LATEST << KHR_DF_SHIFT_VERSIONNUMBER) |
        (((uint32_t)sizeof(uint32_t) *
          (KHR_DF_WORD_SAMPLESTART +
           numSamples * KHR_DF_WORD_SAMPLEWORDS)
          << KHR_DF_SHIFT_DESCRIPTORBLOCKSIZE));
    BDFD[KHR_DF_WORD_MODEL] =
        ((compModelMapping[compScheme] << KHR_DF_SHIFT_MODEL) |
         (KHR_DF_PRIMARIES_BT709 << KHR_DF_SHIFT_PRIMARIES) | /* Assumed */
         (KHR_DF_FLAG_ALPHA_STRAIGHT << KHR_DF_SHIFT_FLAGS));

    if (suffix == s_SRGB) {
        BDFD[KHR_DF_WORD_TRANSFER] |= KHR_DF_TRANSFER_SRGB << KHR_DF_SHIFT_TRANSFER;
    } else {
        BDFD[KHR_DF_WORD_TRANSFER] |= KHR_DF_TRANSFER_LINEAR << KHR_DF_SHIFT_TRANSFER;
    }
    BDFD[KHR_DF_WORD_TEXELBLOCKDIMENSION0] =
        (bwidth - 1) | ((bheight - 1) << KHR_DF_SHIFT_TEXELBLOCKDIMENSION1) | ((bdepth - 1) << KHR_DF_SHIFT_TEXELBLOCKDIMENSION2);
    /* bytesPlane0 = bytes, bytesPlane3..1 = 0 */
    BDFD[KHR_DF_WORD_BYTESPLANE0] = compBytes[compScheme];
    BDFD[KHR_DF_WORD_BYTESPLANE4] = 0; /* bytesPlane7..5 = 0 */

    sample = BDFD + KHR_DF_WORD_SAMPLESTART;
    channel = compFirstChannel[compScheme];
    channel = setChannelFlags(channel, suffix);

    sample[KHR_DF_SAMPLEWORD_BITOFFSET] =
        (0 << KHR_DF_SAMPLESHIFT_BITOFFSET) |
        ((compChannelBits[compScheme] - 1) << KHR_DF_SAMPLESHIFT_BITLENGTH) |
        (channel << KHR_DF_SAMPLESHIFT_CHANNELID);

    sample[KHR_DF_SAMPLEWORD_SAMPLEPOSITION_ALL] = 0;
    switch (suffix) {
    case s_UNORM:
    case s_SRGB:
    default:
        upper.i = 0xFFFFFFFFU;
        lower.i = 0U;
        break;
    case s_SNORM:
        upper.i = 0x7FFFFFFF;
        lower.i = ~upper.i;
        break;
    case s_USCALED:
    case s_UINT:
        upper.i = 1U;
        lower.i = 0U;
        break;
    case s_SSCALED:
    case s_SINT:
        upper.i = 1U;
        lower.i = ~0U;
        break;
    case s_SFLOAT:
        upper.f = 1.0f;
        lower.f = -1.0f;
        break;
    case s_UFLOAT:
        upper.f = 1.0f;
        lower.f = 0.0f;
        break;
    }
    sample[KHR_DF_SAMPLEWORD_SAMPLELOWER] = lower.i;
    sample[KHR_DF_SAMPLEWORD_SAMPLEUPPER] = upper.i;

    if (compSampleCount[compScheme] > 1) {
        sample += KHR_DF_WORD_SAMPLEWORDS;
        channel = compSecondChannel[compScheme];
        channel = setChannelFlags(channel, suffix);

        sample[KHR_DF_SAMPLEWORD_BITOFFSET] =
            (compSecondChannelOffset[compScheme] << KHR_DF_SAMPLESHIFT_BITOFFSET) |
            ((compChannelBits[compScheme] - 1) << KHR_DF_SAMPLESHIFT_BITLENGTH) |
            (channel << KHR_DF_SAMPLESHIFT_CHANNELID);

        sample[KHR_DF_SAMPLEWORD_SAMPLEPOSITION_ALL] = 0;

        sample[KHR_DF_SAMPLEWORD_SAMPLELOWER] = lower.i;
        sample[KHR_DF_SAMPLEWORD_SAMPLEUPPER] = upper.i;
    }
    return DFD;
}

// Assembly:
subq $0x58, %rsp
movl %edi, 0x54(%rsp)
movl %esi, 0x50(%rsp)
movl %edx, 0x4c(%rsp)
movl %ecx, 0x48(%rsp)
movl %r8d, 0x44(%rsp)
movq $0x0, 0x38(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7d11(%rip), %rax      # 0xb050
movl (%rax,%rcx,4), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
shll $0x2, %eax
addl $0x7, %eax
movl %eax, %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x1070
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x28(%rsp)
movl 0x34(%rsp), %eax
shll $0x2, %eax
addl $0x7, %eax
movl %eax, %eax
shlq $0x2, %rax
movl %eax, %ecx
movq 0x38(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
movl $0x0, (%rax)
movl 0x34(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
shll $0x2, %ecx
shll $0x10, %ecx
orl $0x2, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x4(%rax)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7ce4(%rip), %rax      # 0xb0a0
movl (%rax,%rcx,4), %ecx
shll $0x0, %ecx
orl $0x100, %ecx            # imm = 0x100
orl $0x0, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x8(%rax)
cmpl $0x8, 0x44(%rsp)
jne 0x33ed
movq 0x28(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x20000, %ecx          # imm = 0x20000
movl %ecx, 0x8(%rax)
jmp 0x33fe
movq 0x28(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x8(%rax)
movl 0x50(%rsp), %ecx
decl %ecx
movl 0x4c(%rsp), %eax
shll $0x8, %eax
addl $0xffffff00, %eax       # imm = 0xFFFFFF00
orl %eax, %ecx
movl 0x48(%rsp), %eax
shll $0x10, %eax
addl $0xffff0000, %eax       # imm = 0xFFFF0000
orl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7cbb(%rip), %rax      # 0xb0f0
movl (%rax,%rcx,4), %ecx
movq 0x28(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x28(%rsp), %rax
movl $0x0, 0x14(%rax)
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x20(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7cd9(%rip), %rax      # 0xb140
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %edi
movl 0x44(%rsp), %esi
callq 0x3630
movl %eax, 0x1c(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7d04(%rip), %rax      # 0xb190
movl (%rax,%rcx,4), %ecx
shll $0x10, %ecx
addl $0xffff0000, %ecx       # imm = 0xFFFF0000
movl 0x1c(%rsp), %eax
shll $0x18, %eax
orl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x4(%rax)
movl 0x44(%rsp), %eax
movq %rax, 0x8(%rsp)
subq $0x8, %rax
ja 0x34da
movq 0x8(%rsp), %rax
leaq 0x3be1(%rip), %rcx      # 0x70b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x34da
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
movl $0x0, 0x18(%rsp)
jmp 0x355a
movl $0x7fffffff, 0x14(%rsp) # imm = 0x7FFFFFFF
movl 0x14(%rsp), %eax
xorl $-0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x355a
movl $0x1, 0x14(%rsp)
movl $0x0, 0x18(%rsp)
jmp 0x355a
movl $0x1, 0x14(%rsp)
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
jmp 0x355a
movss 0x3ad7(%rip), %xmm0     # 0x7004
movss %xmm0, 0x14(%rsp)
movss 0x3b4d(%rip), %xmm0     # 0x7088
movss %xmm0, 0x18(%rsp)
jmp 0x355a
movss 0x3ab9(%rip), %xmm0     # 0x7004
movss %xmm0, 0x14(%rsp)
xorps %xmm0, %xmm0
movss %xmm0, 0x18(%rsp)
movl 0x18(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7ad1(%rip), %rax      # 0xb050
cmpl $0x1, (%rax,%rcx,4)
jbe 0x361b
movq 0x20(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x20(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7c3c(%rip), %rax      # 0xb1e0
movl (%rax,%rcx,4), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %edi
movl 0x44(%rsp), %esi
callq 0x3630
movl %eax, 0x1c(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %ecx
leaq 0x7c67(%rip), %rax      # 0xb230
movl (%rax,%rcx,4), %ecx
shll $0x0, %ecx
movl 0x54(%rsp), %eax
movl %eax, %edx
leaq 0x7bb4(%rip), %rax      # 0xb190
movl (%rax,%rdx,4), %eax
subl $0x1, %eax
shll $0x10, %eax
orl %eax, %ecx
movl 0x1c(%rsp), %eax
shll $0x18, %eax
orl %eax, %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
movl $0x0, 0x4(%rax)
movl 0x18(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x8(%rax)
movl 0x14(%rsp), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0xc(%rax)
movq 0x38(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)