// File: /workspace/github_c_makefile_star2_O0/KhronosGroup[P]dfdutils/interpretdfdtest.c
// Function: main
int main(int argc, char** argv)
{
    const char *errorText[] = {
        "UNSUPPORTED_NONTRIVIAL_ENDIANNESS",
        "UNSUPPORTED_MULTIPLE_SAMPLE_LOCATIONS",
        "UNSUPPORTED_MULTIPLE_PLANES",
        "UNSUPPORTED_CHANNEL_TYPES",
        "UNSUPPORTED_MIXED_CHANNELS"};

    InterpretedDFDChannel R = {0,0}, G = {0,0}, B = {0,0}, A = {0,0};
    uint32_t wordSize;
    enum InterpretDFDResult t;

#if 0
    t = interpretDFD(dfd1, &R, &G, &B, &A, &wordSize);
#else
#if 0
    uint32_t *d = createDFDUnpacked(1,2,4,0,s_UNORM);
#elif 0
    int channels[] = {0,1,2,3};
    int bits[] = {10,10,10,2};
    uint32_t *d = createDFDPacked(1,4,bits,channels,s_UNORM);
#elif 0
    int channels[] = {0,1,2};
    int bits[] = {5,6,5};
    uint32_t *d = createDFDPacked(1,3,bits,channels,s_UNORM);
#elif 1
    uint32_t *d = createDFDUnpacked(0, 3, 1, 0, s_UNORM);
#endif

    printDFD(d, *d);
    t = interpretDFD(d, &R, &G, &B, &A, &wordSize);
#endif

    if (t & i_UNSUPPORTED_ERROR_BIT) {
        printf("%s\n", errorText[t - i_UNSUPPORTED_ERROR_BIT]);
        return 0;
    } else {
        if (t & i_BIG_ENDIAN_FORMAT_BIT) {
            printf("Big-endian\n");
        } else {
            printf("Little-endian\n");
        }
        if (t & i_PACKED_FORMAT_BIT) {
            printf("Packed\n");
            if (R.size > 0) {
                printf("%u red bit%s starting at %u\n", R.size, R.size>1?"s":"", R.offset);
            }
            if (G.size > 0) {
                printf("%u green bit%s starting at %u\n", G.size, G.size>1?"s":"", G.offset);
            }
            if (B.size > 0) {
                printf("%u blue bit%s starting at %u\n", B.size, B.size>1?"s":"", B.offset);
            }
            if (A.size > 0) {
                printf("%u alpha bit%s starting at %u\n", A.size, A.size>1?"s":"", A.offset);
            }
            printf("Total word size %u\n", wordSize);
        } else {
            printf("Not packed\n");
            if (R.size > 0) {
                printf("%u red byte%s starting at %u\n", R.size, R.size>1?"s":"", R.offset);
            }
            if (G.size > 0) {
                printf("%u green byte%s starting at %u\n", G.size, G.size>1?"s":"", G.offset);
            }
            if (B.size > 0) {
                printf("%u blue byte%s starting at %u\n", B.size, B.size>1?"s":"", B.offset);
            }
            if (A.size > 0) {
                printf("%u alpha byte%s starting at %u\n", A.size, A.size>1?"s":"", A.offset);
            }
        }
        if (t & i_SRGB_FORMAT_BIT) {
            printf("sRGB\n");
        }
        if (t & i_NORMALIZED_FORMAT_BIT) {
            printf("Normalized\n");
        }
        if (t & i_SIGNED_FORMAT_BIT) {
            printf("Signed\n");
        }
        if (t & i_FLOAT_FORMAT_BIT) {
            printf("Float\n");
        }
    }
    return 0;
}

// Assembly:
subq $0x68, %rsp
movl $0x0, 0x64(%rsp)
movl %edi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x749f(%rip), %rsi      # 0xadd0
movl $0x28, %edx
callq 0x1060
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1050
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1050
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1050
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1050
xorl %r8d, %r8d
movl $0x3, %esi
movl $0x1, %edx
movl %r8d, %edi
movl %r8d, %ecx
callq 0x1ff0
movq %rax, (%rsp)
movq (%rsp), %rdi
movq (%rsp), %rax
movl (%rax), %esi
callq 0x50d0
movq (%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
leaq 0xc(%rsp), %r9
callq 0x1180
movl %eax, 0x8(%rsp)
movl 0x8(%rsp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x3a09
movl 0x8(%rsp), %eax
subl $0x100, %eax            # imm = 0x100
movl %eax, %eax
movq 0x30(%rsp,%rax,8), %rsi
leaq 0x387d(%rip), %rdi      # 0x7272
movb $0x0, %al
callq 0x1030
movl $0x0, 0x64(%rsp)
jmp 0x3c9a
movl 0x8(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x3a25
leaq 0x385a(%rip), %rdi      # 0x7276
movb $0x0, %al
callq 0x1030
jmp 0x3a33
leaq 0x3856(%rip), %rdi      # 0x7282
movb $0x0, %al
callq 0x1030
movl 0x8(%rsp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x3b40
leaq 0x3847(%rip), %rdi      # 0x7291
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x2c(%rsp)
jbe 0x3a87
movl 0x2c(%rsp), %esi
movl 0x2c(%rsp), %ecx
leaq 0x564b(%rip), %rdx      # 0x90b2
leaq 0x5887(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x28(%rsp), %ecx
leaq 0x3819(%rip), %rdi      # 0x7299
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x24(%rsp)
jbe 0x3abd
movl 0x24(%rsp), %esi
movl 0x24(%rsp), %ecx
leaq 0x5615(%rip), %rdx      # 0x90b2
leaq 0x5851(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x20(%rsp), %ecx
leaq 0x3800(%rip), %rdi      # 0x72b6
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x1c(%rsp)
jbe 0x3af3
movl 0x1c(%rsp), %esi
movl 0x1c(%rsp), %ecx
leaq 0x55df(%rip), %rdx      # 0x90b2
leaq 0x581b(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x18(%rsp), %ecx
leaq 0x37e9(%rip), %rdi      # 0x72d5
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x14(%rsp)
jbe 0x3b29
movl 0x14(%rsp), %esi
movl 0x14(%rsp), %ecx
leaq 0x55a9(%rip), %rdx      # 0x90b2
leaq 0x57e5(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x10(%rsp), %ecx
leaq 0x37d1(%rip), %rdi      # 0x72f3
movb $0x0, %al
callq 0x1030
movl 0xc(%rsp), %esi
leaq 0x37de(%rip), %rdi      # 0x7312
movb $0x0, %al
callq 0x1030
jmp 0x3c28
leaq 0x37df(%rip), %rdi      # 0x7326
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x2c(%rsp)
jbe 0x3b84
movl 0x2c(%rsp), %esi
movl 0x2c(%rsp), %ecx
leaq 0x554e(%rip), %rdx      # 0x90b2
leaq 0x578a(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x28(%rsp), %ecx
leaq 0x37b5(%rip), %rdi      # 0x7332
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x24(%rsp)
jbe 0x3bba
movl 0x24(%rsp), %esi
movl 0x24(%rsp), %ecx
leaq 0x5518(%rip), %rdx      # 0x90b2
leaq 0x5754(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x20(%rsp), %ecx
leaq 0x379d(%rip), %rdi      # 0x7350
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x1c(%rsp)
jbe 0x3bf0
movl 0x1c(%rsp), %esi
movl 0x1c(%rsp), %ecx
leaq 0x54e2(%rip), %rdx      # 0x90b2
leaq 0x571e(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x18(%rsp), %ecx
leaq 0x3787(%rip), %rdi      # 0x7370
movb $0x0, %al
callq 0x1030
cmpl $0x0, 0x14(%rsp)
jbe 0x3c26
movl 0x14(%rsp), %esi
movl 0x14(%rsp), %ecx
leaq 0x54ac(%rip), %rdx      # 0x90b2
leaq 0x56e8(%rip), %rax      # 0x92f5
cmpl $0x1, %ecx
cmovaq %rax, %rdx
movl 0x10(%rsp), %ecx
leaq 0x3770(%rip), %rdi      # 0x738f
movb $0x0, %al
callq 0x1030
jmp 0x3c28
movl 0x8(%rsp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x3c42
leaq 0x3774(%rip), %rdi      # 0x73af
movb $0x0, %al
callq 0x1030
movl 0x8(%rsp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x3c5c
leaq 0x3760(%rip), %rdi      # 0x73b5
movb $0x0, %al
callq 0x1030
movl 0x8(%rsp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x3c76
leaq 0x3752(%rip), %rdi      # 0x73c1
movb $0x0, %al
callq 0x1030
movl 0x8(%rsp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x3c90
leaq 0x3740(%rip), %rdi      # 0x73c9
movb $0x0, %al
callq 0x1030
jmp 0x3c92
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)