// File: /workspace/github_c_makefile_star2_O0/KhronosGroup[P]dfdutils/createdfd.c
// Function: writeHeader
static uint32_t *writeHeader(int numSamples, int bytes, int suffix,
                             channels_infotype infotype)
{
    uint32_t *DFD = (uint32_t *) malloc(sizeof(uint32_t) *
                                        (1 + KHR_DF_WORD_SAMPLESTART +
                                         numSamples * KHR_DF_WORD_SAMPLEWORDS));
    uint32_t* 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] =
        ((KHR_DF_MODEL_RGBSDA << KHR_DF_SHIFT_MODEL) | /* Only supported model */
         (KHR_DF_FLAG_ALPHA_STRAIGHT << KHR_DF_SHIFT_FLAGS));
    if (infotype == i_COLOR) {
        BDFD[KHR_DF_WORD_PRIMARIES] |= KHR_DF_PRIMARIES_BT709 << KHR_DF_SHIFT_PRIMARIES; /* Assumed */
    } else {
        BDFD[KHR_DF_WORD_PRIMARIES] |= KHR_DF_PRIMARIES_UNSPECIFIED << KHR_DF_SHIFT_PRIMARIES;
    }
    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] = 0; /* Only 1x1x1x1 texel blocks supported */
    BDFD[KHR_DF_WORD_BYTESPLANE0] = bytes; /* bytesPlane0 = bytes, bytesPlane3..1 = 0 */
    BDFD[KHR_DF_WORD_BYTESPLANE4] = 0; /* bytesPlane7..5 = 0 */
    return DFD;
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
movl %esi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movl %ecx, 0x18(%rsp)
movl 0x24(%rsp), %eax
shll $0x2, %eax
addl $0x7, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x1070
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
addq $0x4, %rax
movq %rax, 0x8(%rsp)
movl 0x24(%rsp), %eax
shll $0x2, %eax
addl $0x7, %eax
cltq
shlq $0x2, %rax
movl %eax, %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
movl 0x24(%rsp), %ecx
shll $0x2, %ecx
addl $0x6, %ecx
shll $0x2, %ecx
shll $0x10, %ecx
orl $0x2, %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x8(%rsp), %rax
movl $0x1, 0x8(%rax)
cmpl $0x0, 0x18(%rsp)
jne 0x2272
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x100, %ecx            # imm = 0x100
movl %ecx, 0x8(%rax)
jmp 0x2280
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x0, %ecx
movl %ecx, 0x8(%rax)
cmpl $0x8, 0x1c(%rsp)
jne 0x229a
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x20000, %ecx          # imm = 0x20000
movl %ecx, 0x8(%rax)
jmp 0x22ab
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
orl $0x10000, %ecx          # imm = 0x10000
movl %ecx, 0x8(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0xc(%rax)
movl 0x20(%rsp), %ecx
movq 0x8(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x14(%rax)
movq 0x10(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax)