// File: /workspace/github_c_makefile_star2_O2/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 %rdi, 0x8(%rsp)
testl %r8d, %r8d
je 0x3080
leaq 0x2a49(%rip), %rbx      # 0x5abe
xorl %r9d, %r9d
movq %rbx, %r15
xorl %r13d, %r13d
jmp 0x3094
movl %ecx, %r9d
movl %edx, %r13d
leaq 0x2d4a(%rip), %r15      # 0x5dd7
leaq 0x2a29(%rip), %rbx      # 0x5abd
xorl %ebp, %ebp
movl %esi, %r12d
cmpl $0x4, %esi
jb 0x30a5
movq 0x8(%rsp), %rax
movl (%rax), %ebp
movl %r13d, %r14d
imull %r9d, %r14d
leaq 0x2a76(%rip), %rdi      # 0x5b29
leaq 0x2a04(%rip), %rdx      # 0x5abe
movl %r14d, %esi
movq %r15, %rcx
movl %ebp, %r8d
movl %r9d, 0x10(%rsp)
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
cmpl %r12d, %ebp
cmovbl %ebp, %r12d
cmpl $0x3, %r12d
ja 0x310b
leaq 0x2a5a(%rip), %rdi      # 0x5b40
leaq 0x29d1(%rip), %rdx      # 0x5abe
movl %r14d, %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
addq $0x4, 0x8(%rsp)
addl $-0x4, %r12d
leaq 0x2a37(%rip), %rdi      # 0x5b53
leaq 0x299b(%rip), %rax      # 0x5abe
movl %r14d, 0x40(%rsp)
movl %r14d, %esi
movq %rax, %r14
movq %rax, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %r12d, %eax
leal 0x1(%r13), %ecx
movl 0x10(%rsp), %edx
imull %edx, %ecx
movl %ecx, 0x1c(%rsp)
leal 0x2(%r13), %ecx
imull %edx, %ecx
movl %ecx, 0x4(%rsp)
leal 0x3(%r13), %ecx
imull %edx, %ecx
movl %ecx, 0x24(%rsp)
leal 0x4(%r13), %r12d
imull %edx, %r12d
addl $0x5, %r13d
imull %edx, %r13d
movq %r13, 0x50(%rsp)
xorl %ecx, %ecx
movq %r15, 0x28(%rsp)
movl %r12d, 0x34(%rsp)
cmpl $0x9, %ecx
ja 0x393c
cmpl $0x8, %eax
jb 0x393c
movl %eax, 0x20(%rsp)
movq 0x8(%rsp), %rax
movl (%rax), %ebp
movq %r15, %r13
movl 0x4(%rax), %r15d
movzbl 0x8(%rax), %eax
movl %eax, 0x30(%rsp)
movl %ecx, 0x44(%rsp)
testl %ecx, %ecx
leaq 0x2b33(%rip), %rdi      # 0x5cf0
leaq 0x2b2d(%rip), %rax      # 0x5cf1
cmoveq %rax, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x298a(%rip), %rdi      # 0x5b63
movl 0x1c(%rsp), %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x2979(%rip), %rdi      # 0x5b6a
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x1050
movl %ebp, %esi
andl $0x1ffff, %esi          # imm = 0x1FFFF
je 0x321c
leaq 0x27ee(%rip), %rdi      # 0x5a01
xorl %eax, %eax
callq 0x1050
jmp 0x3231
leaq 0x2bc2(%rip), %rdi      # 0x5de5
leaq 0x15b6(%rip), %rsi      # 0x47e0
xorl %eax, %eax
callq 0x1050
movl %ebp, %r13d
shrl $0x11, %r13d
leaq 0x2ab1(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x292b(%rip), %rdi      # 0x5b7b
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x158e(%rip), %rsi      # 0x47f8
testl %r13d, %r13d
je 0x3291
cmpl $0x6002, %r13d          # imm = 0x6002
je 0x328a
cmpl $0x6001, %r13d          # imm = 0x6001
jne 0x32a1
leaq 0x1596(%rip), %rsi      # 0x481e
jmp 0x3291
leaq 0x15b9(%rip), %rsi      # 0x484a
leaq 0x2b4d(%rip), %rdi      # 0x5de5
xorl %eax, %eax
callq 0x1050
jmp 0x32b2
leaq 0x2759(%rip), %rdi      # 0x5a01
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x2a37(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x28c8(%rip), %rdi      # 0x5b92
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x1050
cmpw $0x2, %r15w
ja 0x3308
movl %r15d, %eax
andl $0x3, %eax
leaq 0x4aef(%rip), %rcx      # 0x7de0
movq (%rcx,%rax,8), %rsi
leaq 0x2ae9(%rip), %rdi      # 0x5de5
xorl %eax, %eax
movq %r15, %r13
callq 0x1050
jmp 0x331d
movzwl %r15w, %esi
leaq 0x26ee(%rip), %rdi      # 0x5a01
xorl %eax, %eax
movq %r15, %r13
callq 0x1050
shrl $0x10, %r13d
leaq 0x29c8(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x286f(%rip), %rdi      # 0x5ba8
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq 0x28(%rsp), %r15
movq %r15, %rcx
movq %r13, 0x48(%rsp)
movl %r13d, %r8d
xorl %eax, %eax
callq 0x1050
testl %ebp, %ebp
je 0x3371
leaq 0x298f(%rip), %rdi      # 0x5cf1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x38d1
cmpl $0x17, 0x20(%rsp)
jbe 0x390f
leaq 0x296d(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2839(%rip), %rdi      # 0x5bcd
movl 0x4(%rsp), %r12d
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq %r14, %rbp
movq 0x8(%rsp), %r14
movzbl 0xb(%r14), %edx
movl 0x24(%rsp), %edi
movq %rbx, %rsi
leaq -0xfaa(%rip), %rcx      # 0x241d
callq 0x3977
leaq 0x280b(%rip), %rdi      # 0x5bde
movl %r12d, %esi
movq %rbp, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movzbl 0xa(%r14), %r13d
movq %rbp, %r14
leaq 0x27f4(%rip), %rdi      # 0x5be6
movl %r12d, %esi
movq %rbp, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %r13d, %edi
callq 0x243a
testq %rax, %rax
je 0x3422
leaq 0x29cf(%rip), %rdi      # 0x5de5
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x3433
leaq 0x25d8(%rip), %rdi      # 0x5a01
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x28b6(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movzbl 0x9(%rax), %r13d
leaq 0x27aa(%rip), %rdi      # 0x5bff
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl %r13d, %edi
callq 0x2453
testq %rax, %rax
je 0x3486
leaq 0x296b(%rip), %rdi      # 0x5de5
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x3497
leaq 0x2574(%rip), %rdi      # 0x5a01
movl %r13d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x2852(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2767(%rip), %rdi      # 0x5c16
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x1050
movl 0x30(%rsp), %r14d
movl %r14d, %edi
callq 0x246c
testq %rax, %rax
je 0x34e5
leaq 0x290c(%rip), %rdi      # 0x5de5
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
jmp 0x34f6
leaq 0x2515(%rip), %rdi      # 0x5a01
movl %r14d, %esi
xorl %eax, %eax
callq 0x1050
leaq 0x27f3(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
movq 0x8(%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 0x26e3(%rip), %rdi      # 0x5c29
movl 0x4(%rsp), %esi
movq %rbp, %rdx
movq 0x28(%rsp), %r15
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 %rbp, %r14
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
movl %r11d, %ecx
shrl $0x8, %ecx
andl %eax, %ecx
movq %rcx, 0x10(%rsp)
movl %r11d, %r12d
shrl $0x10, %r12d
andl %eax, %r12d
shrl $0x18, %r11d
movl %r13d, %ecx
andl %eax, %ecx
movq %rcx, 0x38(%rsp)
movl %r13d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
movl %r13d, %ebp
shrl $0x10, %ebp
andl %eax, %ebp
shrl $0x18, %r13d
leaq 0x2695(%rip), %rdi      # 0x5c5b
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
movq %r15, %r9
xorl %eax, %eax
pushq %rbx
pushq %r13
pushq %r15
pushq %rbp
pushq %r15
pushq %r10
pushq %r15
pushq 0x70(%rsp)
pushq %r15
pushq %r11
pushq %r15
pushq %r12
pushq %r15
pushq 0x78(%rsp)
callq 0x1050
addq $0x70, %rsp
leaq 0x2695(%rip), %rdi      # 0x5c98
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x48(%rsp), %rax
leal -0x18(%rax), %ecx
shrl $0x4, %ecx
cmpl $0x10, %ecx
pushq $0x10
popq %rax
cmovael %eax, %ecx
movl 0x20(%rsp), %eax
movq %rax, 0x58(%rsp)
shll $0x4, %ecx
movq %rcx, 0x60(%rsp)
xorl %ebp, %ebp
cmpq %rbp, 0x60(%rsp)
movl 0x34(%rsp), %r12d
je 0x38a3
leaq 0x28(%rbp), %rax
cmpq 0x58(%rsp), %rax
ja 0x38a3
testq %rbp, %rbp
movq 0x28(%rsp), %r15
je 0x3678
leaq 0x2682(%rip), %rdi      # 0x5cf0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x24e4(%rip), %rdi      # 0x5b63
movl 0x24(%rsp), %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movl 0x18(%rax,%rbp), %r13d
movl %r13d, 0x38(%rsp)
shrl $0x18, %r13d
andl $0xf0, %r13d
je 0x36f6
leaq 0x2610(%rip), %rdi      # 0x5cc3
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x50(%rsp), %rdi
movq %rbx, %rsi
movl %r13d, %edx
leaq -0x112b(%rip), %rcx     # 0x25ad
callq 0x3977
leaq 0x24fa(%rip), %rdi      # 0x5bde
movl %r12d, %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
jmp 0x3710
leaq 0x25ae(%rip), %rdi      # 0x5cab
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movq %rbp, 0x10(%rsp)
movzbl 0x1b(%rax,%rbp), %r13d
andl $0xf, %r13d
movl 0x30(%rsp), %edi
movl %r13d, %esi
callq 0x25d4
testq %rax, %rax
je 0x3754
leaq 0x259d(%rip), %rdi      # 0x5cd9
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rax, %r8
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
jmp 0x3771
leaq 0x2599(%rip), %rdi      # 0x5cf4
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movl %r13d, %r8d
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x8(%rsp), %rax
movq 0x10(%rsp), %rcx
movzbl 0x1a(%rax,%rcx), %r8d
movq %rcx, %rbp
movq %rax, %r13
movq %rax, 0x8(%rsp)
leaq 0x257a(%rip), %rdi      # 0x5d0d
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movzwl 0x18(%r13,%rbp), %r8d
leaq 0x2571(%rip), %rdi      # 0x5d24
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movl 0x1c(%r13,%rbp), %r11d
movl %r11d, %r8d
movl $0xff, %eax
andl %eax, %r8d
movl %r11d, %r10d
shrl $0x8, %r10d
andl %eax, %r10d
movl %r11d, %r13d
shrl $0x10, %r13d
andl %eax, %r13d
shrl $0x18, %r11d
leaq 0x2546(%rip), %rdi      # 0x5d3b
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %r15, %r9
xorl %eax, %eax
pushq %rbx
pushq %r11
pushq %r15
pushq %r13
pushq %r15
pushq %r10
callq 0x1050
addq $0x30, %rsp
btl $0x1e, 0x38(%rsp)
leaq 0x2544(%rip), %rdi      # 0x5d68
leaq 0x256e(%rip), %rax      # 0x5d99
cmovaeq %rax, %rdi
movq 0x8(%rsp), %r12
movl 0x20(%r12,%rbp), %r8d
leaq 0x2541(%rip), %r13      # 0x5d81
leaq 0x256b(%rip), %rax      # 0x5db2
cmovaeq %rax, %r13
movl 0x34(%rsp), %ebp
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rax
movl 0x24(%r12,%rax), %r8d
movq %r13, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x1050
leaq 0x2543(%rip), %rdi      # 0x5dca
movl 0x24(%rsp), %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
movq 0x10(%rsp), %rbp
addq $0x10, %rbp
jmp 0x363e
leaq 0x2447(%rip), %rdi      # 0x5cf1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x2514(%rip), %rdi      # 0x5dcf
movl 0x4(%rsp), %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
movq 0x28(%rsp), %r15
pushq $0x8
popq %rbp
leaq 0x24ef(%rip), %rdi      # 0x5dca
movl 0x1c(%rsp), %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x1050
movq 0x48(%rsp), %rdx
cmpl $0x9, %edx
cmovbl %ebp, %edx
movl 0x20(%rsp), %eax
subl %edx, %eax
movl 0x44(%rsp), %ecx
jb 0x393c
andl $-0x4, %edx
addq %rdx, 0x8(%rsp)
incl %ecx
jmp 0x3184
leaq 0x23db(%rip), %rdi      # 0x5cf1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x229f(%rip), %rdi      # 0x5bc6
leaq 0x2190(%rip), %rdx      # 0x5abe
movl 0x1c(%rsp), %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x23ae(%rip), %rdi      # 0x5cf1
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1050
leaq 0x247b(%rip), %rdi      # 0x5dcf
leaq 0x2163(%rip), %rdx      # 0x5abe
movl 0x40(%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