// File: /workspace/github_c_makefile_star2_O1/KhronosGroup[P]dfdutils/printdfd.c
// Function: printDFDJSON
void printDFDJSON(uint32_t* DFD, uint32_t dataSize, uint32_t base_indent, uint32_t indent_width, bool minified)
{
    if (minified) {
        base_indent = 0;
        indent_width = 0;
    }
    const char* space = minified ? "" : " ";
    const char* nl = minified ? "" : "\n";

#define LENGTH_OF_INDENT(INDENT) ((base_indent + INDENT) * indent_width)

/** Prints an enum as string or number */
#define PRINT_ENUM(INDENT, NAME, VALUE, TO_STRING_FN, COMMA) {          \
        int value = VALUE;                                                 \
        printf("%*s\"" NAME "\":%s", LENGTH_OF_INDENT(INDENT), "", space); \
        const char* str = TO_STRING_FN(value);                             \
        if (str)                                                           \
            printf("\"%s\"", str);                                         \
        else                                                               \
            printf("%u", value);                                           \
        printf(COMMA "%s", nl);                                            \
    }

/** Prints an enum as string or number if the to string function fails with a trailing comma*/
#define PRINT_ENUM_C(INDENT, NAME, VALUE, TO_STRING_FN) \
        PRINT_ENUM(INDENT, NAME, VALUE, TO_STRING_FN, ",")

/** Prints an enum as string or number if the to string function fails without a trailing comma*/
#define PRINT_ENUM_E(INDENT, NAME, VALUE, TO_STRING_FN) \
        PRINT_ENUM(INDENT, NAME, VALUE, TO_STRING_FN, "")

#define PRINT_INDENT(INDENT, FMT, ...) {                              \
        printf("%*s" FMT, LENGTH_OF_INDENT(INDENT), "", __VA_ARGS__); \
    }

#define PRINT_INDENT_NOARG(INDENT, FMT) {                \
        printf("%*s" FMT, LENGTH_OF_INDENT(INDENT), ""); \
    }

    const uint32_t sizeof_dfdTotalSize = sizeof(uint32_t);
    const uint32_t sizeof_DFDBHeader = sizeof(uint32_t) * 2;
    const uint32_t sizeof_BDFD = sizeof(uint32_t) * KHR_DF_WORD_SAMPLESTART;
    const uint32_t sizeof_BDFDSample = sizeof(uint32_t) * KHR_DF_WORD_SAMPLEWORDS;

    uint32_t dfdTotalSize = dataSize >= sizeof_dfdTotalSize ? DFD[0] : 0;
    PRINT_INDENT(0, "\"totalSize\":%s%u,%s", space, dfdTotalSize, nl)

    uint32_t remainingSize = dfdTotalSize < dataSize ? dfdTotalSize : dataSize;
    if (remainingSize < sizeof_dfdTotalSize) {
        PRINT_INDENT(0, "\"blocks\":%s[]%s", space, nl) // Print empty blocks to confirm to the json scheme
        return; // Invalid DFD: dfdTotalSize must be present
    }

    uint32_t* block = DFD + 1;
    remainingSize -= sizeof_dfdTotalSize;
    PRINT_INDENT(0, "\"blocks\":%s[", space)

    for (int i = 0; i < MAX_NUM_DFD_BLOCKS; ++i) { // At most only iterate MAX_NUM_DFD_BLOCKS block
        if (remainingSize < sizeof_DFDBHeader)
            break; // Invalid DFD: Missing or partial block header

        const khr_df_vendorid_e vendorID = KHR_DFDVAL(block, VENDORID);
        const khr_df_khr_descriptortype_e descriptorType = KHR_DFDVAL(block, DESCRIPTORTYPE);
        const khr_df_versionnumber_e versionNumber = KHR_DFDVAL(block, VERSIONNUMBER);
        const uint32_t blockSize = KHR_DFDVAL(block, DESCRIPTORBLOCKSIZE);

        const int model = KHR_DFDVAL(block, MODEL);

        if (i == 0) {
            printf("%s", nl);
        } else {
            printf(",%s", nl);
        }
        PRINT_INDENT(1, "{%s", nl)
        PRINT_ENUM_C(2, "vendorId", vendorID, dfdToStringVendorID);
        PRINT_ENUM_C(2, "descriptorType", descriptorType, dfdToStringDescriptorType);
        PRINT_ENUM_C(2, "versionNumber", versionNumber, dfdToStringVersionNumber);
        PRINT_INDENT(2, "\"descriptorBlockSize\":%s%u", space, blockSize)

        if (vendorID == KHR_DF_VENDORID_KHRONOS && descriptorType == KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT) {
            if (remainingSize < sizeof_BDFD) {
                // Invalid DFD: Missing or partial basic DFD block
                printf("%s", nl);
                PRINT_INDENT(1, "}%s", nl) // End of block
                break;
            }

            printf(",%s", nl);
            PRINT_INDENT(2, "\"flags\":%s[%s", space, nl)
            khr_df_flags_e flags = KHR_DFDVAL(block, FLAGS);
            printFlagBitsJSON(LENGTH_OF_INDENT(3), nl, flags, dfdToStringFlagsBit);
            PRINT_INDENT(2, "],%s", nl)

            PRINT_ENUM_C(2, "transferFunction", KHR_DFDVAL(block, TRANSFER), dfdToStringTransferFunction);
            PRINT_ENUM_C(2, "colorPrimaries", KHR_DFDVAL(block, PRIMARIES), dfdToStringColorPrimaries);
            PRINT_ENUM_C(2, "colorModel", model, dfdToStringColorModel);
            PRINT_INDENT(2, "\"texelBlockDimension\":%s[%u,%s%u,%s%u,%s%u],%s", space,
                    KHR_DFDVAL(block, TEXELBLOCKDIMENSION0) + 1, space,
                    KHR_DFDVAL(block, TEXELBLOCKDIMENSION1) + 1, space,
                    KHR_DFDVAL(block, TEXELBLOCKDIMENSION2) + 1, space,
                    KHR_DFDVAL(block, TEXELBLOCKDIMENSION3) + 1, nl)
            PRINT_INDENT(2, "\"bytesPlane\":%s[%u,%s%u,%s%u,%s%u,%s%u,%s%u,%s%u,%s%u],%s", space,
                    KHR_DFDVAL(block, BYTESPLANE0), space,
                    KHR_DFDVAL(block, BYTESPLANE1), space,
                    KHR_DFDVAL(block, BYTESPLANE2), space,
                    KHR_DFDVAL(block, BYTESPLANE3), space,
                    KHR_DFDVAL(block, BYTESPLANE4), space,
                    KHR_DFDVAL(block, BYTESPLANE5), space,
                    KHR_DFDVAL(block, BYTESPLANE6), space,
                    KHR_DFDVAL(block, BYTESPLANE7), nl)

            PRINT_INDENT(2, "\"samples\":%s[%s", space, nl)
            int samples = (blockSize - sizeof_BDFD) / sizeof_BDFDSample;
            if (samples > MAX_NUM_BDFD_SAMPLES)
                samples = MAX_NUM_BDFD_SAMPLES;
            for (int sample = 0; sample < samples; ++sample) {
                if (remainingSize < sizeof_BDFD + (sample + 1) * sizeof_BDFDSample)
                    break; // Invalid DFD: Missing or partial basic DFD sample

                if (sample != 0)
                    printf(",%s", nl);
                PRINT_INDENT(3, "{%s", nl)

                khr_df_sample_datatype_qualifiers_e qualifiers = KHR_DFDSVAL(block, sample, QUALIFIERS);
                if (qualifiers == 0) {
                    PRINT_INDENT(4, "\"qualifiers\":%s[],%s", space, nl)

                } else {
                    PRINT_INDENT(4, "\"qualifiers\":%s[%s", space, nl)
                    printFlagBitsJSON(LENGTH_OF_INDENT(5), nl, qualifiers, dfdToStringSampleDatatypeQualifiers);
                    PRINT_INDENT(4, "],%s", nl)
                }

                khr_df_model_channels_e channelType = KHR_DFDSVAL(block, sample, CHANNELID);
                const char* channelStr = dfdToStringChannelId(model, channelType);
                if (channelStr)
                    PRINT_INDENT(4, "\"channelType\":%s\"%s\",%s", space, channelStr, nl)
                else
                    PRINT_INDENT(4, "\"channelType\":%s%u,%s", space, channelType, nl)

                PRINT_INDENT(4, "\"bitLength\":%s%u,%s", space, KHR_DFDSVAL(block, sample, BITLENGTH), nl)
                PRINT_INDENT(4, "\"bitOffset\":%s%u,%s", space, KHR_DFDSVAL(block, sample, BITOFFSET), nl)
                PRINT_INDENT(4, "\"samplePosition\":%s[%u,%s%u,%s%u,%s%u],%s", space,
                        KHR_DFDSVAL(block, sample, SAMPLEPOSITION0), space,
                        KHR_DFDSVAL(block, sample, SAMPLEPOSITION1), space,
                        KHR_DFDSVAL(block, sample, SAMPLEPOSITION2), space,
                        KHR_DFDSVAL(block, sample, SAMPLEPOSITION3), nl)

                if (qualifiers & KHR_DF_SAMPLE_DATATYPE_SIGNED) {
                    PRINT_INDENT(4, "\"sampleLower\":%s%d,%s", space, KHR_DFDSVAL(block, sample, SAMPLELOWER), nl)
                    PRINT_INDENT(4, "\"sampleUpper\":%s%d%s", space, KHR_DFDSVAL(block, sample, SAMPLEUPPER), nl)
                } else {
                    PRINT_INDENT(4, "\"sampleLower\":%s%u,%s", space, (unsigned int) KHR_DFDSVAL(block, sample, SAMPLELOWER), nl)
                    PRINT_INDENT(4, "\"sampleUpper\":%s%u%s", space, (unsigned int) KHR_DFDSVAL(block, sample, SAMPLEUPPER), nl)
                }

                PRINT_INDENT_NOARG(3, "}")
            }
            printf("%s", nl);
            PRINT_INDENT(2, "]%s", nl) // End of samples
        } else if (vendorID == KHR_DF_VENDORID_KHRONOS && descriptorType == KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_DIMENSIONS) {
            printf("%s", nl);
            // printf(",%s", nl); // If there is extra member printed
            // TODO: Implement DFD print for ADDITIONAL_DIMENSIONS
        } else if (vendorID == KHR_DF_VENDORID_KHRONOS && descriptorType == KHR_DF_KHR_DESCRIPTORTYPE_ADDITIONAL_PLANES) {
            printf("%s", nl);
            // printf(",%s", nl); // If there is extra member printed
            // TODO: Implement DFD print for ADDITIONAL_PLANES
        } else {
            printf("%s", nl);
            // printf(",%s", nl); // If there is extra member printed
            // TODO: What to do with unknown blocks for json?
            //      Unknown block data in binary?
        }

        PRINT_INDENT_NOARG(1, "}") // End of block

        const uint32_t advance = sizeof_DFDBHeader > blockSize ? sizeof_DFDBHeader : blockSize;
        if (advance > remainingSize)
            break;
        remainingSize -= advance;
        block += advance / 4;
    }
    printf("%s", nl);
    PRINT_INDENT(0, "]%s", nl) // End of blocks

#undef PRINT_ENUM
#undef PRINT_ENUM_C
#undef PRINT_ENUM_E
#undef PRINT_INDENT
#undef PRINT_INDENT_NOARG
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, 0x30(%rsp)
movl %esi, %r13d
movq %rdi, 0x10(%rsp)
testl %r8d, %r8d
je 0x35ed
leaq 0x34ee(%rip), %rbx      # 0x6aca
xorl %r15d, %r15d
movq %rbx, %r14
movq $0x0, 0x30(%rsp)
jmp 0x35fe
movl %ecx, %r15d
leaq 0x37ec(%rip), %r14      # 0x6de3
leaq 0x34cb(%rip), %rbx      # 0x6ac9
xorl %r12d, %r12d
cmpl $0x4, %r13d
jb 0x360f
movq 0x10(%rsp), %rax
movl (%rax), %r12d
movq 0x30(%rsp), %rax
movl %eax, %ebp
imull %r15d, %ebp
leaq 0x3514(%rip), %rdi      # 0x6b35
leaq 0x34a2(%rip), %rdx      # 0x6aca
movl %ebp, %esi
movq %r14, %rcx
movl %r12d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
cmpl %r13d, %r12d
cmovbl %r12d, %r13d
cmpl $0x3, %r13d
ja 0x3672
leaq 0x34fe(%rip), %rdi      # 0x6b4c
leaq 0x3475(%rip), %rdx      # 0x6aca
movl %ebp, %esi
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1050
addl $-0x4, %r13d
leaq 0x34e2(%rip), %rdi      # 0x6b5f
leaq 0x3446(%rip), %rdx      # 0x6aca
movl %ebp, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $0x8, %r13d
movl %ebp, %r12d
jae 0x36d3
leaq 0x365d(%rip), %rdi      # 0x6cfd
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x372a(%rip), %rdi      # 0x6ddb
leaq 0x3412(%rip), %rdx      # 0x6aca
movl %r12d, %esi
movq %rbx, %rcx
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1050
addq $0x4, 0x10(%rsp)
movq 0x30(%rsp), %rax
leal 0x1(%rax), %ecx
imull %r15d, %ecx
movl %ecx, 0x28(%rsp)
leal 0x2(%rax), %ecx
imull %r15d, %ecx
movl %ecx, 0xc(%rsp)
leal 0x3(%rax), %ecx
imull %r15d, %ecx
movl %ecx, 0x2c(%rsp)
leal 0x4(%rax), %ecx
imull %r15d, %ecx
movl %ecx, 0x1c(%rsp)
addl $0x5, %eax
imull %r15d, %eax
movq %rax, 0x30(%rsp)
xorl %ecx, %ecx
movl %r12d, 0x24(%rsp)
movl %r13d, 0x20(%rsp)
movq 0x10(%rsp), %rax
movl (%rax), %r13d
movl 0x4(%rax), %r15d
movzbl 0x8(%rax), %eax
movl %eax, 0x3c(%rsp)
movl %ecx, 0x54(%rsp)
testl %ecx, %ecx
leaq 0x35b9(%rip), %rdi      # 0x6cfc
leaq 0x35b3(%rip), %rax      # 0x6cfd
cmoveq %rax, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x3410(%rip), %rdi      # 0x6b6f
movl 0x28(%rsp), %esi
leaq 0x3360(%rip), %r12      # 0x6aca
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x33f8(%rip), %rdi      # 0x6b76
movl 0xc(%rsp), %esi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
movl %r13d, %esi
andl $0x1ffff, %esi          # imm = 0x1FFFF
je 0x37aa
leaq 0x326c(%rip), %rdi      # 0x6a0d
xorl %eax, %eax
callq 0x1050
jmp 0x37bf
leaq 0x3640(%rip), %rdi      # 0x6df1
leaq 0x2034(%rip), %rsi      # 0x57ec
xorl %eax, %eax
callq 0x1050
movl %r13d, %ebp
shrl $0x11, %ebp
xorl %r12d, %r12d
leaq 0x352d(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x33a7(%rip), %rdi      # 0x6b87
movl 0xc(%rsp), %esi
leaq 0x32df(%rip), %rdx      # 0x6aca
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x2008(%rip), %rsi      # 0x5804
testl %ebp, %ebp
je 0x382d
cmpl $0x6002, %ebp           # imm = 0x6002
je 0x381c
cmpl $0x6001, %ebp           # imm = 0x6001
jne 0x3828
xorl %r12d, %r12d
leaq 0x2010(%rip), %rsi      # 0x582a
jmp 0x382d
xorl %r12d, %r12d
leaq 0x2030(%rip), %rsi      # 0x5856
jmp 0x382d
movb $0x1, %r12b
xorl %esi, %esi
testb %r12b, %r12b
je 0x3844
leaq 0x31d4(%rip), %rdi      # 0x6a0d
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
jmp 0x3852
leaq 0x35a6(%rip), %rdi      # 0x6df1
xorl %eax, %eax
callq 0x1050
movl 0x24(%rsp), %r12d
xorl %ebp, %ebp
leaq 0x349c(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x332d(%rip), %rdi      # 0x6b9e
movl 0xc(%rsp), %esi
leaq 0x324e(%rip), %rdx      # 0x6aca
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x1ff9(%rip), %rsi      # 0x5886
testw %r15w, %r15w
je 0x38be
movq %r15, %rax
movzwl %ax, %eax
cmpl $0x2, %eax
je 0x38ae
cmpl $0x1, %eax
jne 0x38b9
xorl %ebp, %ebp
leaq 0x1ff3(%rip), %rsi      # 0x589f
jmp 0x38be
xorl %ebp, %ebp
leaq 0x2001(%rip), %rsi      # 0x58b8
jmp 0x38be
movb $0x1, %bpl
xorl %esi, %esi
testb %bpl, %bpl
je 0x38d7
movzwl %r15w, %esi
leaq 0x313f(%rip), %rdi      # 0x6a0d
xorl %eax, %eax
callq 0x1050
jmp 0x38e5
leaq 0x3513(%rip), %rdi      # 0x6df1
xorl %eax, %eax
callq 0x1050
shrl $0x10, %r15d
leaq 0x340c(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x32b3(%rip), %rdi      # 0x6bb4
movl 0xc(%rsp), %esi
leaq 0x31be(%rip), %rdx      # 0x6aca
movq %r14, %rcx
movl %r15d, %r8d
xorl %eax, %eax
callq 0x1050
testl %r13d, %r13d
je 0x3939
leaq 0x33d8(%rip), %rdi      # 0x6cfd
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movl 0x20(%rsp), %r13d
jmp 0x3ee2
movl 0x20(%rsp), %r13d
cmpl $0x17, %r13d
ja 0x3978
xorl %ebp, %ebp
leaq 0x33b0(%rip), %rdi      # 0x6cfd
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x3274(%rip), %rdi      # 0x6bd2
movl 0x28(%rsp), %esi
leaq 0x3161(%rip), %rdx      # 0x6aca
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
jmp 0x3f32
movq %r15, 0x58(%rsp)
leaq 0x3378(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x3244(%rip), %rdi      # 0x6bd9
movl 0xc(%rsp), %r12d
movl %r12d, %esi
leaq 0x3126(%rip), %r13      # 0x6aca
movq %r13, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq %r14, %r15
movq 0x10(%rsp), %r14
movzbl 0xb(%r14), %edx
movl 0x2c(%rsp), %edi
movq %rbx, %rsi
leaq -0x11db(%rip), %rcx     # 0x27f4
callq 0x3f59
leaq 0x320f(%rip), %rdi      # 0x6bea
movl %r12d, %esi
movq %r13, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movzbl 0xa(%r14), %ebp
movq %r15, %r14
leaq 0x31f8(%rip), %rdi      # 0x6bf2
movl %r12d, %esi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %ebp, %edi
callq 0x2811
testq %rax, %rax
je 0x3a29
leaq 0x33d4(%rip), %rdi      # 0x6df1
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x3a39
leaq 0x2fdd(%rip), %rdi      # 0x6a0d
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x32bc(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movzbl 0x9(%rax), %ebp
leaq 0x31b1(%rip), %rdi      # 0x6c0b
movl 0xc(%rsp), %esi
movq %r13, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
movl %ebp, %edi
callq 0x282a
testq %rax, %rax
je 0x3a8a
leaq 0x3373(%rip), %rdi      # 0x6df1
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x3a9a
leaq 0x2f7c(%rip), %rdi      # 0x6a0d
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x325b(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x3170(%rip), %rdi      # 0x6c22
movl 0xc(%rsp), %esi
movq %r13, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
movl 0x3c(%rsp), %ebp
movl %ebp, %edi
callq 0x2843
testq %rax, %rax
je 0x3ae6
leaq 0x3317(%rip), %rdi      # 0x6df1
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x3af6
leaq 0x2f20(%rip), %rdi      # 0x6a0d
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x31ff(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %r14
movl 0xc(%r14), %r11d
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
incl %r8d
movl %r11d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
incl %r10d
movl %r11d, %r12d
shrl $0x10, %r12d
andl %eax, %r12d
incl %r12d
shrl $0x18, %r11d
incl %r11d
leaq 0x30ef(%rip), %rdi      # 0x6c35
movl 0xc(%rsp), %esi
leaq 0x2f79(%rip), %rdx      # 0x6aca
movq %r15, %rcx
movq %r15, %r9
xorl %eax, %eax
pushq %rbx
pushq %r11
pushq %r15
pushq %r12
pushq %r15
pushq %r10
callq 0x1050
addq $0x30, %rsp
movl 0x10(%r14), %r11d
movl 0x14(%r14), %r13d
movq %r15, %r14
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
movl %r11d, %ecx
shrl $0x8, %ecx
andl %eax, %ecx
movq %rcx, 0x48(%rsp)
movl %r11d, %r12d
shrl $0x10, %r12d
andl %eax, %r12d
shrl $0x18, %r11d
movl %r13d, %ecx
andl %eax, %ecx
movq %rcx, 0x40(%rsp)
movl %r13d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
movl %r13d, %ebp
shrl $0x10, %ebp
andl %eax, %ebp
shrl $0x18, %r13d
leaq 0x30a2(%rip), %rdi      # 0x6c67
movl 0xc(%rsp), %r15d
movl %r15d, %esi
leaq 0x2ef6(%rip), %rdx      # 0x6aca
movq %r14, %rcx
movq %r14, %r9
xorl %eax, %eax
pushq %rbx
pushq %r13
pushq %r14
pushq %rbp
pushq %r14
pushq %r10
pushq %r14
pushq 0x78(%rsp)
pushq %r14
pushq %r11
pushq %r14
pushq %r12
pushq %r14
pushq 0xb0(%rsp)
callq 0x1050
addq $0x70, %rsp
leaq 0x3097(%rip), %rdi      # 0x6ca4
movl %r15d, %esi
leaq 0x2eb3(%rip), %rdx      # 0x6aca
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x58(%rsp), %rax
leal -0x18(%rax), %ecx
cmpl $0x10, %ecx
jb 0x3ea6
shrl $0x4, %ecx
cmpl $0x10, %ecx
movl $0x10, %eax
cmovael %eax, %ecx
movl 0x20(%rsp), %eax
movq %rax, 0x40(%rsp)
cmpl $0x1, %ecx
adcl $0x0, %ecx
shll $0x4, %ecx
movq %rcx, 0x60(%rsp)
xorl %r13d, %r13d
leaq 0x28(%r13), %rax
cmpq 0x40(%rsp), %rax
ja 0x3ea6
testq %r13, %r13
je 0x3c82
leaq 0x3084(%rip), %rdi      # 0x6cfc
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2ee6(%rip), %rdi      # 0x6b6f
movl 0x2c(%rsp), %esi
leaq 0x2e36(%rip), %r12      # 0x6aca
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movl 0x18(%rax,%r13), %ebp
movl %ebp, 0x48(%rsp)
shrl $0x18, %ebp
andl $0xf0, %ebp
je 0x3d08
leaq 0x300e(%rip), %rdi      # 0x6ccf
movl 0x1c(%rsp), %r15d
movl %r15d, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x30(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
leaq -0x1366(%rip), %rcx     # 0x2984
callq 0x3f59
leaq 0x2ef4(%rip), %rdi      # 0x6bea
movl %r15d, %esi
movq %r12, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
jmp 0x3d23
leaq 0x2fa8(%rip), %rdi      # 0x6cb7
movl 0x1c(%rsp), %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movzbl 0x1b(%rax,%r13), %ebp
andl $0xf, %ebp
movl 0x3c(%rsp), %edi
movl %ebp, %esi
callq 0x29ad
testq %rax, %rax
je 0x3d63
leaq 0x2f9d(%rip), %rdi      # 0x6ce5
movl 0x1c(%rsp), %ebp
movl %ebp, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rax, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
jmp 0x3d83
leaq 0x2f96(%rip), %rdi      # 0x6d00
movl 0x1c(%rsp), %esi
movq %r12, %rdx
movq %r14, %rcx
movl %ebp, %r8d
movl %esi, %ebp
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movzbl 0x1a(%rax,%r13), %r8d
movq %rax, %r15
leaq 0x2f81(%rip), %rdi      # 0x6d19
movl %ebp, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movzwl 0x18(%r15,%r13), %r8d
leaq 0x2f79(%rip), %rdi      # 0x6d30
movl %ebp, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movl 0x1c(%r15,%r13), %r11d
movq %r15, 0x10(%rsp)
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
movl %r11d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
movl %ebp, %esi
movl %r11d, %ebp
shrl $0x10, %ebp
andl %eax, %ebp
shrl $0x18, %r11d
leaq 0x2f4a(%rip), %rdi      # 0x6d47
movq %r12, %rdx
movq %r14, %rcx
movq %r14, %r9
xorl %eax, %eax
pushq %rbx
pushq %r11
pushq %r14
pushq %rbp
pushq %r14
pushq %r10
callq 0x1050
addq $0x30, %rsp
btl $0x1e, 0x48(%rsp)
leaq 0x2f4c(%rip), %rdi      # 0x6d74
leaq 0x2f76(%rip), %rax      # 0x6da5
cmovaeq %rax, %rdi
movl 0x20(%r15,%r13), %r8d
leaq 0x2f4e(%rip), %rbp      # 0x6d8d
leaq 0x2f78(%rip), %rax      # 0x6dbe
cmovaeq %rax, %rbp
movl 0x1c(%rsp), %r15d
movl %r15d, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movl 0x24(%rax,%r13), %r8d
movq %rbp, %rdi
movl %r15d, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
leaq 0x2f4d(%rip), %rdi      # 0x6dd6
movl 0x2c(%rsp), %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1050
addq $0x10, %r13
cmpq %r13, 0x60(%rsp)
jne 0x3c5d
leaq 0x2e50(%rip), %rdi      # 0x6cfd
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2f1d(%rip), %rdi      # 0x6ddb
movl 0xc(%rsp), %esi
leaq 0x2c01(%rip), %rdx      # 0x6aca
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movl 0x20(%rsp), %r13d
movl 0x24(%rsp), %r12d
movq 0x58(%rsp), %r15
leaq 0x2eed(%rip), %rdi      # 0x6dd6
movl 0x28(%rsp), %esi
leaq 0x2bd6(%rip), %rdx      # 0x6aca
xorl %eax, %eax
callq 0x1050
cmpl $0x9, %r15d
movl $0x8, %eax
cmovbl %eax, %r15d
movl %r15d, %eax
shrl $0x2, %eax
cmpl %r13d, %r15d
setbe %bpl
movl $0x0, %ecx
cmoval %ecx, %eax
movq 0x10(%rsp), %rdx
leaq (%rdx,%rax,4), %rdx
movq %rdx, 0x10(%rsp)
cmoval %ecx, %r15d
subl %r15d, %r13d
testb %bpl, %bpl
movl 0x54(%rsp), %ecx
je 0x3699
cmpl $0x8, %ecx
ja 0x3699
incl %ecx
cmpl $0x8, %r13d
jae 0x371d
jmp 0x3699