// File: /workspace/github_c_makefile_star2_O3/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, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
testl %r8d, %r8d
je 0x336a
leaq 0x2794(%rip), %rbx      # 0x5aee
xorl %ebp, %ebp
movq %rbx, %r15
movq $0x0, 0x20(%rsp)
jmp 0x337a
movl %ecx, %ebp
leaq 0x2a94(%rip), %r15      # 0x5e07
leaq 0x2773(%rip), %rbx      # 0x5aed
xorl %r14d, %r14d
movl %esi, %r13d
cmpl $0x4, %esi
jb 0x338d
movq 0x8(%rsp), %rax
movl (%rax), %r14d
movq 0x20(%rsp), %rax
movl %eax, %r12d
imull %ebp, %r12d
leaq 0x27b9(%rip), %rdi      # 0x5b59
leaq 0x2747(%rip), %rdx      # 0x5aee
movl %r12d, %esi
movq %r15, %rcx
movl %r14d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
cmpl %r13d, %r14d
cmovbl %r14d, %r13d
cmpl $0x3, %r13d
ja 0x33f3
leaq 0x27a2(%rip), %rdi      # 0x5b70
leaq 0x2719(%rip), %rdx      # 0x5aee
movl %r12d, %esi
movq %r15, %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 0x2785(%rip), %rdi      # 0x5b83
leaq 0x26e9(%rip), %rdx      # 0x5aee
movl %r12d, 0x4c(%rsp)
movl %r12d, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $0x8, %r13d
jae 0x3458
leaq 0x28fd(%rip), %rdi      # 0x5d21
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x29ca(%rip), %rdi      # 0x5dff
leaq 0x26b2(%rip), %rdx      # 0x5aee
movl 0x4c(%rsp), %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, 0x8(%rsp)
movq 0x20(%rsp), %rcx
leal 0x1(%rcx), %esi
imull %ebp, %esi
leal 0x2(%rcx), %edx
imull %ebp, %edx
movl %edx, 0x4(%rsp)
leal 0x3(%rcx), %edx
imull %ebp, %edx
movl %edx, 0x1c(%rsp)
leal 0x4(%rcx), %edx
imull %ebp, %edx
movl %edx, 0x10(%rsp)
addl $0x5, %ecx
imull %ebp, %ecx
movq %rcx, 0x20(%rsp)
xorl %ecx, %ecx
movl %esi, %r12d
movl %esi, 0x50(%rsp)
movq %r15, 0x28(%rsp)
movq %rbx, 0x30(%rsp)
movl %r13d, 0x14(%rsp)
movq 0x8(%rsp), %rax
movl (%rax), %ebp
movl 0x4(%rax), %r13d
movzbl 0x8(%rax), %eax
movl %eax, 0x18(%rsp)
movl %ecx, 0x54(%rsp)
testl %ecx, %ecx
leaq 0x2856(%rip), %rdi      # 0x5d20
leaq 0x2850(%rip), %rax      # 0x5d21
cmoveq %rax, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x26ad(%rip), %rdi      # 0x5b93
movl %r12d, %esi
leaq 0x25fe(%rip), %r14      # 0x5aee
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x2696(%rip), %rdi      # 0x5b9a
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %ebp, %esi
andl $0x1ffff, %esi          # imm = 0x1FFFF
je 0x352f
leaq 0x250b(%rip), %rdi      # 0x5a31
xorl %eax, %eax
callq 0x1050
jmp 0x3544
leaq 0x28df(%rip), %rdi      # 0x5e15
leaq 0x12d3(%rip), %rsi      # 0x4810
xorl %eax, %eax
callq 0x1050
movl %ebp, %r14d
shrl $0x11, %r14d
leaq 0x27ce(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2648(%rip), %rdi      # 0x5bab
movl 0x4(%rsp), %esi
leaq 0x2580(%rip), %rdx      # 0x5aee
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x12a9(%rip), %rsi      # 0x4828
testl %r14d, %r14d
je 0x35a6
cmpl $0x6002, %r14d          # imm = 0x6002
je 0x359f
cmpl $0x6001, %r14d          # imm = 0x6001
jne 0x35b6
leaq 0x12b1(%rip), %rsi      # 0x484e
jmp 0x35a6
leaq 0x12d4(%rip), %rsi      # 0x487a
leaq 0x2868(%rip), %rdi      # 0x5e15
xorl %eax, %eax
callq 0x1050
jmp 0x35c7
leaq 0x2474(%rip), %rdi      # 0x5a31
movl %r14d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x2752(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x25e3(%rip), %rdi      # 0x5bc2
movl 0x4(%rsp), %esi
leaq 0x2504(%rip), %rdx      # 0x5aee
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
cmpw $0x2, %r13w
ja 0x361c
movl %r13d, %eax
andl $0x3, %eax
leaq 0x47d8(%rip), %rcx      # 0x7de0
movq (%rcx,%rax,8), %rsi
leaq 0x2802(%rip), %rdi      # 0x5e15
xorl %eax, %eax
callq 0x1050
jmp 0x362e
movzwl %r13w, %esi
leaq 0x240a(%rip), %rdi      # 0x5a31
xorl %eax, %eax
callq 0x1050
shrl $0x10, %r13d
leaq 0x26e7(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x258e(%rip), %rdi      # 0x5bd8
movl 0x4(%rsp), %esi
leaq 0x2499(%rip), %rdx      # 0x5aee
movq %r15, %rcx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x1050
testl %ebp, %ebp
movq %r13, 0x58(%rsp)
je 0x368b
leaq 0x26af(%rip), %rdi      # 0x5d21
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x246b(%rip), %r14      # 0x5aee
movl %r12d, %esi
jmp 0x3c22
cmpl $0x17, 0x14(%rsp)
jbe 0x3c7a
leaq 0x2683(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x254f(%rip), %rdi      # 0x5bfd
movl 0x4(%rsp), %ebp
movl %ebp, %esi
leaq 0x2433(%rip), %r13      # 0x5aee
movq %r13, %rdx
movq %r15, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq %rbx, %r14
movq 0x8(%rsp), %rbx
movzbl 0xb(%rbx), %edx
movl 0x1c(%rsp), %edi
movq %r14, %rsi
leaq -0x10d0(%rip), %rcx     # 0x2615
callq 0x3cab
leaq 0x251d(%rip), %rdi      # 0x5c0e
movl %ebp, %esi
movq %r13, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x1050
movzbl 0xa(%rbx), %r14d
leaq 0x250a(%rip), %rdi      # 0x5c16
movl %ebp, %esi
movq %r13, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %r14d, %edi
callq 0x2632
testq %rax, %rax
je 0x373b
leaq 0x26e6(%rip), %rdi      # 0x5e15
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x374c
leaq 0x22ef(%rip), %rdi      # 0x5a31
movl %r14d, %esi
xorl %eax, %eax
callq 0x1050
movl 0x18(%rsp), %ebp
leaq 0x25c9(%rip), %rdi      # 0x5d20
movq 0x30(%rsp), %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movzbl 0x9(%rax), %r14d
leaq 0x24b8(%rip), %rdi      # 0x5c2f
movl 0x4(%rsp), %esi
leaq 0x236c(%rip), %rdx      # 0x5aee
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x1050
movl %r14d, %edi
callq 0x264b
testq %rax, %rax
je 0x37ae
leaq 0x2673(%rip), %rdi      # 0x5e15
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x37bf
leaq 0x227c(%rip), %rdi      # 0x5a31
movl %r14d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x255a(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x246f(%rip), %rdi      # 0x5c46
movl 0x4(%rsp), %esi
leaq 0x230c(%rip), %rdx      # 0x5aee
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x1050
movl %ebp, %edi
callq 0x2664
testq %rax, %rax
je 0x380d
leaq 0x2614(%rip), %rdi      # 0x5e15
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x381d
leaq 0x221d(%rip), %rdi      # 0x5a31
movl %ebp, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x24fc(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rbx
movl 0xc(%rbx), %r11d
movl %r11d, %r8d
movl $0xff, %r15d
andl %r15d, %r8d
incl %r8d
movl %r11d, %r10d
shrl $0x8, %r10d
andl %r15d, %r10d
incl %r10d
movl %r11d, %r14d
shrl $0x10, %r14d
andl %r15d, %r14d
incl %r14d
shrl $0x18, %r11d
incl %r11d
leaq 0x23eb(%rip), %rdi      # 0x5c59
movl 0x4(%rsp), %esi
leaq 0x2275(%rip), %rdx      # 0x5aee
movq 0x28(%rsp), %r12
movq %r12, %rcx
movq %r12, %r9
xorl %eax, %eax
pushq 0x30(%rsp)
pushq %r11
pushq %r12
pushq %r14
pushq %r12
pushq %r10
callq 0x1050
addq $0x30, %rsp
movl 0x10(%rbx), %r11d
movl 0x14(%rbx), %r13d
movq 0x30(%rsp), %rbx
movl %r11d, %r8d
andl %r15d, %r8d
movl %r11d, %eax
shrl $0x8, %eax
andl %r15d, %eax
movq %rax, 0x40(%rsp)
movl %r11d, %r14d
shrl $0x10, %r14d
andl %r15d, %r14d
shrl $0x18, %r11d
movl %r13d, %eax
andl %r15d, %eax
movq %rax, 0x38(%rsp)
movl %r13d, %r10d
shrl $0x8, %r10d
andl %r15d, %r10d
movl %r13d, %ebp
shrl $0x10, %ebp
andl %r15d, %ebp
shrl $0x18, %r13d
leaq 0x2396(%rip), %rdi      # 0x5c8b
movl 0x4(%rsp), %r15d
movl %r15d, %esi
leaq 0x21ea(%rip), %rdx      # 0x5aee
movq %r12, %rcx
movq %r12, %r9
xorl %eax, %eax
pushq %rbx
pushq %r13
pushq %r12
pushq %rbp
pushq %r12
pushq %r10
pushq %r12
pushq 0x70(%rsp)
pushq %r12
pushq %r11
pushq %r12
pushq %r14
pushq %r12
pushq 0xa8(%rsp)
callq 0x1050
addq $0x70, %rsp
leaq 0x238b(%rip), %rdi      # 0x5cc8
movl %r15d, %esi
leaq 0x21a7(%rip), %rdx      # 0x5aee
movq %r12, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x58(%rsp), %rax
leal -0x18(%rax), %ecx
cmpl $0x10, %ecx
jb 0x3be9
shrl $0x4, %ecx
cmpl $0x10, %ecx
movl $0x10, %eax
cmovael %eax, %ecx
movl 0x14(%rsp), %eax
movq %rax, 0x38(%rsp)
cmpl $0x1, %ecx
adcl $0x0, %ecx
shll $0x4, %ecx
movq %rcx, 0x60(%rsp)
xorl %ebp, %ebp
leaq 0x28(%rbp), %rax
cmpq 0x38(%rsp), %rax
ja 0x3be9
testq %rbp, %rbp
je 0x39b1
leaq 0x2379(%rip), %rdi      # 0x5d20
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x21db(%rip), %rdi      # 0x5b93
movl 0x1c(%rsp), %esi
leaq 0x212b(%rip), %r15      # 0x5aee
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movl 0x18(%rax,%rbp), %r14d
movl %r14d, 0x40(%rsp)
shrl $0x18, %r14d
andl $0xf0, %r14d
movq 0x28(%rsp), %r13
je 0x3a40
leaq 0x22fb(%rip), %rdi      # 0x5cf3
movl 0x10(%rsp), %r12d
movl %r12d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl %r14d, %edx
leaq -0x127d(%rip), %rcx     # 0x27a5
callq 0x3cab
leaq 0x21e0(%rip), %rdi      # 0x5c0e
movl %r12d, %esi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
jmp 0x3a5b
leaq 0x2294(%rip), %rdi      # 0x5cdb
movl 0x10(%rsp), %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movzbl 0x1b(%rax,%rbp), %r14d
andl $0xf, %r14d
movl 0x18(%rsp), %edi
movl %r14d, %esi
callq 0x27ce
testq %rax, %rax
je 0x3a9f
leaq 0x2287(%rip), %rdi      # 0x5d09
movl 0x10(%rsp), %r14d
movl %r14d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rax, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
jmp 0x3ac0
leaq 0x227e(%rip), %rdi      # 0x5d24
movl 0x10(%rsp), %esi
movq %r15, %rdx
movq %r13, %rcx
movl %r14d, %r8d
movl %esi, %r14d
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movzbl 0x1a(%rax,%rbp), %r8d
movq %rax, %r12
leaq 0x2268(%rip), %rdi      # 0x5d3d
movl %r14d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movzwl 0x18(%r12,%rbp), %r8d
leaq 0x225f(%rip), %rdi      # 0x5d54
movl %r14d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movl 0x1c(%r12,%rbp), %r11d
movq %r12, 0x8(%rsp)
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
movl %r11d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
movl %r14d, %esi
movl %r11d, %r14d
shrl $0x10, %r14d
andl %eax, %r14d
shrl $0x18, %r11d
leaq 0x222c(%rip), %rdi      # 0x5d6b
movq %r15, %rdx
movq %r13, %rcx
movq %r13, %r9
xorl %eax, %eax
pushq %rbx
pushq %r11
pushq %r13
pushq %r14
pushq %r13
pushq %r10
callq 0x1050
addq $0x30, %rsp
btl $0x1e, 0x40(%rsp)
leaq 0x222d(%rip), %rdi      # 0x5d98
leaq 0x2257(%rip), %rax      # 0x5dc9
cmovaeq %rax, %rdi
movl 0x20(%r12,%rbp), %r8d
leaq 0x222f(%rip), %r14      # 0x5db1
leaq 0x2259(%rip), %rax      # 0x5de2
cmovaeq %rax, %r14
movl 0x10(%rsp), %r12d
movl %r12d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movl 0x24(%rax,%rbp), %r8d
movq %r14, %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %r13, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
leaq 0x222e(%rip), %rdi      # 0x5dfa
movl 0x1c(%rsp), %esi
movq %r15, %rdx
xorl %eax, %eax
callq 0x1050
addq $0x10, %rbp
cmpq %rbp, 0x60(%rsp)
jne 0x398c
leaq 0x2131(%rip), %rdi      # 0x5d21
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x21fe(%rip), %rdi      # 0x5dff
movl 0x4(%rsp), %esi
leaq 0x1ee2(%rip), %r14      # 0x5aee
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movl 0x50(%rsp), %esi
movq 0x28(%rsp), %r15
leaq 0x21d1(%rip), %rdi      # 0x5dfa
movl %esi, %r12d
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
movq 0x58(%rsp), %rdx
cmpl $0x9, %edx
movl $0x8, %eax
cmovbl %eax, %edx
movl 0x14(%rsp), %r13d
subl %edx, %r13d
movl 0x54(%rsp), %ecx
jb 0x341d
cmpl $0x8, %ecx
ja 0x341d
andl $-0x4, %edx
addq %rdx, 0x8(%rsp)
incl %ecx
cmpl $0x7, %r13d
ja 0x34a5
jmp 0x341d
leaq 0x20a0(%rip), %rdi      # 0x5d21
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x1f64(%rip), %rdi      # 0x5bf6
leaq 0x1e55(%rip), %rdx      # 0x5aee
movl %r12d, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
jmp 0x341d