// File: /workspace/github_cpp_makefile_star2_O1/dannye[P]jed/src/decoder.cpp
// Function: decodeBlockComponent(JPGImage const*, BitReader&, int*, int&, unsigned int&, HuffmanTable const&, HuffmanTable const&)
bool decodeBlockComponent(
    const JPGImage* const image,
    BitReader& bitReader,
    int* const component,
    int& previousDC,
    uint& skips,
    const HuffmanTable& dcTable,
    const HuffmanTable& acTable
) {
    if (image->frameType == SOF0) {
        // get the DC value for this block component
        byte length = getNextSymbol(bitReader, dcTable);
        if (length == (byte)-1) {
            std::cout << "Error - Invalid DC value\n";
            return false;
        }
        if (length > 11) {
            std::cout << "Error - DC coefficient length greater than 11\n";
            return false;
        }

        int coeff = bitReader.readBits(length);
        if (coeff == -1) {
            std::cout << "Error - Invalid DC value\n";
            return false;
        }
        if (length != 0 && coeff < (1 << (length - 1))) {
            coeff -= (1 << length) - 1;
        }
        component[0] = coeff + previousDC;
        previousDC = component[0];

        // get the AC values for this block component
        for (uint i = 1; i < 64; ++i) {
            byte symbol = getNextSymbol(bitReader, acTable);
            if (symbol == (byte)-1) {
                std::cout << "Error - Invalid AC value\n";
                return false;
            }

            // symbol 0x00 means fill remainder of component with 0
            if (symbol == 0x00) {
                return true;
            }

            // otherwise, read next component coefficient
            byte numZeroes = symbol >> 4;
            byte coeffLength = symbol & 0x0F;
            coeff = 0;

            if (i + numZeroes >= 64) {
                std::cout << "Error - Zero run-length exceeded block component\n";
                return false;
            }
            i += numZeroes;

            if (coeffLength > 10) {
                std::cout << "Error - AC coefficient length greater than 10\n";
                return false;
            }
            coeff = bitReader.readBits(coeffLength);
            if (coeff == -1) {
                std::cout << "Error - Invalid AC value\n";
                return false;
            }
            if (coeff < (1 << (coeffLength - 1))) {
                coeff -= (1 << coeffLength) - 1;
            }
            component[zigZagMap[i]] = coeff;
        }
        return true;
    }
    else { // image->frameType == SOF2
        if (image->startOfSelection == 0 && image->successiveApproximationHigh == 0) {
            // DC first visit
            byte length = getNextSymbol(bitReader, dcTable);
            if (length == (byte)-1) {
                std::cout << "Error - Invalid DC value\n";
                return false;
            }
            if (length > 11) {
                std::cout << "Error - DC coefficient length greater than 11\n";
                return false;
            }

            int coeff = bitReader.readBits(length);
            if (coeff == -1) {
                std::cout << "Error - Invalid DC value\n";
                return false;
            }
            if (length != 0 && coeff < (1 << (length - 1))) {
                coeff -= (1 << length) - 1;
            }
            coeff += previousDC;
            previousDC = coeff;
            component[0] = coeff << image->successiveApproximationLow;
            return true;
        }
        else if (image->startOfSelection == 0 && image->successiveApproximationHigh != 0) {
            // DC refinement
            int bit = bitReader.readBit();
            if (bit == -1) {
                std::cout << "Error - Invalid DC value\n";
                return false;
            }
            component[0] |= bit << image->successiveApproximationLow;
            return true;
        }
        else if (image->startOfSelection != 0 && image->successiveApproximationHigh == 0) {
            // AC first visit
            if (skips > 0) {
                skips -= 1;
                return true;
            }
            for (uint i = image->startOfSelection; i <= image->endOfSelection; ++i) {
                byte symbol = getNextSymbol(bitReader, acTable);
                if (symbol == (byte)-1) {
                    std::cout << "Error - Invalid AC value\n";
                    return false;
                }

                byte numZeroes = symbol >> 4;
                byte coeffLength = symbol & 0x0F;

                if (coeffLength != 0) {
                    if (i + numZeroes > image->endOfSelection) {
                        std::cout << "Error - Zero run-length exceeded spectral selection\n";
                        return false;
                    }
                    for (uint j = 0; j < numZeroes; ++j, ++i) {
                        component[zigZagMap[i]] = 0;
                    }
                    if (coeffLength > 10) {
                        std::cout << "Error - AC coefficient length greater than 10\n";
                        return false;
                    }

                    int coeff = bitReader.readBits(coeffLength);
                    if (coeff == -1) {
                        std::cout << "Error - Invalid AC value\n";
                        return false;
                    }
                    if (coeff < (1 << (coeffLength - 1))) {
                        coeff -= (1 << coeffLength) - 1;
                    }
                    component[zigZagMap[i]] = coeff << image->successiveApproximationLow;
                }
                else {
                    if (numZeroes == 15) {
                        if (i + numZeroes > image->endOfSelection) {
                            std::cout << "Error - Zero run-length exceeded spectral selection\n";
                            return false;
                        }
                        for (uint j = 0; j < numZeroes; ++j, ++i) {
                            component[zigZagMap[i]] = 0;
                        }
                    }
                    else {
                        skips = (1 << numZeroes) - 1;
                        uint extraSkips = bitReader.readBits(numZeroes);
                        if (extraSkips == (uint)-1) {
                            std::cout << "Error - Invalid AC value\n";
                            return false;
                        }
                        skips += extraSkips;
                        break;
                    }
                }
            }
            return true;
        }
        else { // image->startOfSelection != 0 && image->successiveApproximationHigh != 0
            // AC refinement
            int positive = 1 << image->successiveApproximationLow;
            int negative = ((unsigned)-1) << image->successiveApproximationLow;
            int i = image->startOfSelection;
            if (skips == 0) {
                for (; i <= image->endOfSelection; ++i) {
                    byte symbol = getNextSymbol(bitReader, acTable);
                    if (symbol == (byte)-1) {
                        std::cout << "Error - Invalid AC value\n";
                        return false;
                    }

                    byte numZeroes = symbol >> 4;
                    byte coeffLength = symbol & 0x0F;
                    int coeff = 0;

                    if (coeffLength != 0) {
                        if (coeffLength != 1) {
                            std::cout << "Error - Invalid AC value\n";
                            return false;
                        }
                        switch (bitReader.readBit()) {
                        case 1:
                            coeff = positive;
                            break;
                        case 0:
                            coeff = negative;
                            break;
                        default: // -1, data stream is empty
                            std::cout << "Error - Invalid AC value\n";
                            return false;
                        }
                    }
                    else {
                        if (numZeroes != 15) {
                            skips = 1 << numZeroes;
                            uint extraSkips = bitReader.readBits(numZeroes);
                            if (extraSkips == (uint)-1) {
                                std::cout << "Error - Invalid AC value\n";
                                return false;
                            }
                            skips += extraSkips;
                            break;
                        }
                    }

                    do {
                        if (component[zigZagMap[i]] != 0) {
                            switch (bitReader.readBit()) {
                            case 1:
                                if ((component[zigZagMap[i]] & positive) == 0) {
                                    if (component[zigZagMap[i]] >= 0) {
                                        component[zigZagMap[i]] += positive;
                                    }
                                    else {
                                        component[zigZagMap[i]] += negative;
                                    }
                                }
                                break;
                            case 0:
                                // do nothing
                                break;
                            default: // -1, data stream is empty
                                std::cout << "Error - Invalid AC value\n";
                                return false;
                            }
                        }
                        else {
                            if (numZeroes == 0) {
                                break;
                            }
                            numZeroes -= 1;
                        }

                        i += 1;
                    } while (i <= image->endOfSelection);

                    if (coeff != 0 && i <= image->endOfSelection) {
                        component[zigZagMap[i]] = coeff;
                    }
                }
            }

            if (skips > 0) {
                for (; i <= image->endOfSelection; ++i) {
                    if (component[zigZagMap[i]] != 0) {
                        switch (bitReader.readBit()) {
                        case 1:
                            if ((component[zigZagMap[i]] & positive) == 0) {
                                if (component[zigZagMap[i]] >= 0) {
                                    component[zigZagMap[i]] += positive;
                                }
                                else {
                                    component[zigZagMap[i]] += negative;
                                }
                            }
                            break;
                        case 0:
                            // do nothing
                            break;
                        default: // -1, data stream is empty
                            std::cout << "Error - Invalid AC value\n";
                            return false;
                        }
                    }
                }
                skips -= 1;
            }
            return true;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbp
movq %rsi, %r14
cmpb $-0x40, 0x2065(%rdi)
movq %rdx, 0x8(%rsp)
jne 0x4d32
movq %r14, %rdi
movq %r9, %rsi
callq 0x4c63
cmpb $-0x1, %al
je 0x5547
movl %eax, %r12d
cmpb $0xc, %al
jb 0x505e
movq 0x52b7(%rip), %rdi      # 0x9fd8
leaq 0x2cfd(%rip), %rsi      # 0x7a25
movl $0x2e, %edx
jmp 0x555a
movq %r8, %rbx
movq %rdi, %r12
movzbl 0x2073(%rdi), %r15d
testl %r15d, %r15d
je 0x5013
testl %r15d, %r15d
movq %rbx, 0x10(%rsp)
je 0x4d62
cmpb $0x0, 0x2075(%r12)
je 0x5095
movb 0x2076(%r12), %cl
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x18(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
movl %eax, 0x20(%rsp)
cmpl $0x0, (%rbx)
jne 0x4d93
cmpb 0x2074(%r12), %r15b
jbe 0x4e1d
movl %r15d, %r13d
movb $0x1, %bpl
cmpl $0x0, (%rbx)
je 0x5561
movzbl 0x2074(%r12), %eax
cmpl %eax, %r13d
jg 0x4e11
movl %r13d, %eax
decl %r13d
leaq 0x2333(%rip), %r15      # 0x70f0
addq %rax, %r15
movzbl (%r15), %ebx
cmpl $0x0, (%rdx,%rbx,4)
je 0x4dfd
movq %r14, %rdi
callq 0x6692
movq 0x8(%rsp), %rdx
testl %eax, %eax
je 0x4dfd
cmpl $0x1, %eax
jne 0x54f2
movl (%rdx,%rbx,4), %eax
testl %eax, 0x18(%rsp)
jne 0x4dfd
testl %eax, %eax
movl 0x18(%rsp), %ecx
cmovsl 0x20(%rsp), %ecx
addl %eax, %ecx
movl %ecx, (%rdx,%rbx,4)
movzbl 0x2074(%r12), %eax
incl %r13d
incq %r15
cmpl %eax, %r13d
jl 0x4dc0
movq 0x10(%rsp), %rax
decl (%rax)
jmp 0x5561
movq %r14, %rdi
movq 0x60(%rsp), %rsi
callq 0x4c63
cmpb $-0x1, %al
je 0x4e5c
movl %eax, %ebp
shrb $0x4, %bpl
movl %eax, %ecx
andb $0xf, %cl
je 0x4ea0
movzbl %cl, %eax
cmpl $0x1, %eax
jne 0x4e5c
movq %r14, %rdi
callq 0x6692
movl 0x18(%rsp), %ecx
cmpl $0x1, %eax
je 0x4eac
movl 0x20(%rsp), %ecx
testl %eax, %eax
je 0x4eac
movl $0x19, %edx
movq 0x5170(%rip), %rdi      # 0x9fd8
leaq 0x2be5(%rip), %rsi      # 0x7a54
callq 0x2130
movl $0x1, %eax
movq 0x8(%rsp), %rdx
testl %eax, %eax
jne 0x5144
leal 0x1(%r15), %r13d
movzbl 0x2074(%r12), %eax
cmpl %eax, %r15d
movl %r13d, %r15d
jl 0x4e1d
jmp 0x4d96
xorl %ecx, %ecx
cmpb $0xf, %bpl
jne 0x4f30
movl %ecx, 0x24(%rsp)
movl %r15d, %r13d
leaq 0x2236(%rip), %rax      # 0x70f0
addq %rax, %r13
movq 0x8(%rsp), %rdx
movzbl (%r13), %ebx
cmpl $0x0, (%rdx,%rbx,4)
je 0x4efa
movq %r14, %rdi
callq 0x6692
testl %eax, %eax
je 0x4f08
cmpl $0x1, %eax
movq 0x8(%rsp), %rdx
jne 0x4fc3
movl (%rdx,%rbx,4), %eax
testl %eax, 0x18(%rsp)
jne 0x4f16
testl %eax, %eax
js 0x4f0f
addl 0x18(%rsp), %eax
jmp 0x4f13
testb %bpl, %bpl
je 0x4f84
decb %bpl
jmp 0x4f16
movq 0x8(%rsp), %rdx
jmp 0x4f16
addl 0x20(%rsp), %eax
movl %eax, (%rdx,%rbx,4)
leal 0x1(%r15), %ecx
movzbl 0x2074(%r12), %eax
incq %r13
cmpl %eax, %r15d
movl %ecx, %r15d
jl 0x4ec2
jmp 0x4f87
movl $0x1, %edx
movl %ebp, %ecx
shll %cl, %edx
movl %edx, (%rbx)
xorl %r13d, %r13d
cmpb $0x10, %al
jb 0x4f6c
movzbl %bpl, %ebx
decl %ebx
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x6692
addl %r13d, %r13d
orl %eax, %r13d
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %r13d
je 0x4f6c
testb %cl, %cl
je 0x4f4b
cmpl $-0x1, %r13d
je 0x4fe7
movq 0x10(%rsp), %rbx
addl %r13d, (%rbx)
movl $0xe, %eax
jmp 0x4e79
movl %r15d, %ecx
xorl %eax, %eax
movl 0x24(%rsp), %r8d
testl %r8d, %r8d
je 0x4fbe
movzbl 0x2074(%r12), %esi
cmpl %esi, %ecx
movq 0x10(%rsp), %rbx
jg 0x4fb6
movl %ecx, %esi
leaq 0x2142(%rip), %rdi      # 0x70f0
movzbl (%rsi,%rdi), %esi
movl %r8d, (%rdx,%rsi,4)
movl %ecx, %r15d
jmp 0x4e7e
movl %ecx, %r15d
jmp 0x5009
movl $0x19, %edx
movq 0x5009(%rip), %rdi      # 0x9fd8
leaq 0x2a7e(%rip), %rsi      # 0x7a54
callq 0x2130
movq 0x8(%rsp), %rdx
movl $0x1, %eax
jmp 0x5009
movl $0x19, %edx
movq 0x4fe5(%rip), %rdi      # 0x9fd8
leaq 0x2a5a(%rip), %rsi      # 0x7a54
callq 0x2130
movl $0x1, %eax
movq 0x8(%rsp), %rdx
movq 0x10(%rsp), %rbx
jmp 0x4e7e
cmpb $0x0, 0x2075(%r12)
je 0x50ab
testl %r15d, %r15d
jne 0x4d49
cmpb $0x0, 0x2075(%r12)
je 0x4d49
movq %r14, %rdi
callq 0x6692
cmpl $-0x1, %eax
je 0x5547
movb 0x2076(%r12), %cl
shll %cl, %eax
movq 0x8(%rsp), %rcx
orl %eax, (%rcx)
jmp 0x50a3
movzbl %r12b, %r13d
testl %r13d, %r13d
je 0x510a
leal -0x1(%r13), %ebx
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x6692
addl %r15d, %r15d
orl %eax, %r15d
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %r15d
je 0x510d
testb %cl, %cl
je 0x5072
jmp 0x510d
movl (%rbx), %eax
testl %eax, %eax
je 0x52b7
decl %eax
movl %eax, (%rbx)
movb $0x1, %bpl
jmp 0x5561
movq %r14, %rdi
movq %r9, %rsi
callq 0x4c63
cmpb $-0x1, %al
je 0x5547
movl %eax, %r15d
cmpb $0xc, %al
jae 0x4d1a
movzbl %r15b, %eax
testl %eax, %eax
movq %rax, 0x18(%rsp)
je 0x5510
leal -0x1(%rax), %ebx
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x6692
addl %r13d, %r13d
orl %eax, %r13d
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %r13d
je 0x5513
testb %cl, %cl
je 0x50e0
jmp 0x5513
xorl %r15d, %r15d
cmpl $-0x1, %r15d
je 0x5547
testl %r13d, %r13d
je 0x5155
leal -0x1(%r12), %ecx
movl $0x1, %eax
shll %cl, %eax
cmpl %eax, %r15d
movq 0x8(%rsp), %rdx
jge 0x515a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %r12d, %ecx
shll %cl, %eax
addl %eax, %r15d
incl %r15d
jmp 0x515a
movl %r15d, %r13d
cmpl $0xe, %eax
je 0x4d96
jmp 0x555f
movq 0x8(%rsp), %rdx
addl (%rbp), %r15d
movl %r15d, (%rdx)
movl %r15d, (%rbp)
movl $0x1, %r15d
movq 0x4e66(%rip), %rbx      # 0x9fd8
movq %r14, %rdi
movq 0x60(%rsp), %rsi
callq 0x4c63
testb %al, %al
je 0x51a1
movl %eax, %r13d
movzbl %al, %eax
cmpl $0xff, %eax
jne 0x51a8
movl $0x19, %edx
movq %rbx, %rdi
leaq 0x28b5(%rip), %rsi      # 0x7a54
jmp 0x51cd
movb $0x1, %bpl
xorl %eax, %eax
jmp 0x51d6
movl %r13d, %eax
shrb $0x4, %al
movl %r15d, %ecx
movzbl %al, %r12d
addq %rcx, %r12
cmpl $0x40, %r12d
jb 0x51f0
movl $0x31, %edx
movq %rbx, %rdi
leaq 0x28a1(%rip), %rsi      # 0x7a6e
callq 0x2130
xorl %eax, %eax
xorl %ebp, %ebp
testb %al, %al
je 0x5561
leal 0x1(%r15), %eax
cmpl $0x3e, %r15d
movl %eax, %r15d
jbe 0x5172
jmp 0x50a3
andb $0xf, %r13b
cmpb $0xb, %r13b
jb 0x520e
movl $0x2e, %edx
movq %rbx, %rdi
leaq 0x2897(%rip), %rsi      # 0x7aa0
jmp 0x52a8
movzbl %r13b, %ebx
testl %ebx, %ebx
je 0x523e
decl %ebx
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x6692
addl %r15d, %r15d
orl %eax, %r15d
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %r15d
je 0x5241
testb %cl, %cl
je 0x521b
jmp 0x5241
xorl %r15d, %r15d
cmpl $-0x1, %r15d
je 0x5292
movl %r13d, %ecx
decb %cl
movl $0x1, %eax
shll %cl, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %r13d, %ecx
shll %cl, %edx
incl %edx
cmpl %eax, %r15d
movl $0x0, %eax
cmovgel %eax, %edx
addl %r15d, %edx
leaq 0x1e7c(%rip), %rax      # 0x70f0
movzbl (%r12,%rax), %eax
movq 0x8(%rsp), %rcx
movl %edx, (%rcx,%rax,4)
movb $0x1, %al
movl %r12d, %r15d
movq 0x4d4b(%rip), %rbx      # 0x9fd8
jmp 0x51d6
movl $0x19, %edx
movq 0x4d3a(%rip), %rbx      # 0x9fd8
movq %rbx, %rdi
leaq 0x27ac(%rip), %rsi      # 0x7a54
callq 0x2130
xorl %eax, %eax
movl %r12d, %r15d
jmp 0x51d4
movb $0x1, %bpl
cmpb 0x2074(%r12), %r15b
ja 0x5561
movq 0x4d09(%rip), %r13      # 0x9fd8
movq %r14, %rdi
movq 0x60(%rsp), %rsi
callq 0x4c63
cmpb $-0x1, %al
je 0x5341
movl %eax, %ecx
shrb $0x4, %cl
movl %eax, %ebp
andb $0xf, %bpl
je 0x5352
movzbl %cl, %ecx
leal (%r15,%rcx), %edx
movzbl 0x2074(%r12), %esi
cmpl %esi, %edx
ja 0x536c
cmpb $0x10, %al
movq 0x8(%rsp), %rdx
leaq 0x1de1(%rip), %rsi      # 0x70f0
jb 0x5326
movl %r15d, %eax
movzbl (%rax,%rsi), %eax
movl $0x0, (%rdx,%rax,4)
incl %r15d
decl %ecx
jne 0x5311
cmpb $0xa, %bpl
jbe 0x53f4
movl $0x2e, %edx
movq %r13, %rdi
leaq 0x2761(%rip), %rsi      # 0x7aa0
jmp 0x537b
movl $0x19, %edx
movq %r13, %rdi
leaq 0x2704(%rip), %rsi      # 0x7a54
jmp 0x537b
cmpb $0xf, %cl
jne 0x53a7
leal 0xf(%r15), %eax
movzbl 0x2074(%r12), %ecx
cmpl %ecx, %eax
jbe 0x546f
movl $0x34, %edx
movq %r13, %rdi
leaq 0x2754(%rip), %rsi      # 0x7acf
callq 0x2130
movl $0x1, %eax
testl %eax, %eax
jne 0x5507
incl %r15d
movzbl 0x2074(%r12), %eax
cmpl %eax, %r15d
jbe 0x52cf
jmp 0x5502
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
shll %cl, %edx
notl %edx
movl %edx, (%rbx)
xorl %ebp, %ebp
cmpb $0x10, %al
jb 0x53dd
movzbl %cl, %ebx
decl %ebx
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x6692
addl %ebp, %ebp
orl %eax, %ebp
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %ebp
je 0x53dd
testb %cl, %cl
je 0x53bf
cmpl $-0x1, %ebp
je 0x549d
movq 0x10(%rsp), %rbx
addl %ebp, (%rbx)
movl $0x5, %eax
jmp 0x5385
movzbl %bpl, %ebx
decl %ebx
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x6692
addl %r13d, %r13d
orl %eax, %r13d
subl $0x1, %ebx
setb %cl
cmpl $-0x1, %eax
cmovel %eax, %r13d
je 0x541e
testb %cl, %cl
je 0x53fd
cmpl $-0x1, %r13d
je 0x54c0
movl %ebp, %ecx
decb %cl
movl $0x1, %eax
shll %cl, %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %ebp, %ecx
shll %cl, %edx
orl $0x1, %edx
cmpl %eax, %r13d
movl $0x0, %eax
cmovgel %eax, %edx
addl %r13d, %edx
movb 0x2076(%r12), %cl
shll %cl, %edx
movl %r15d, %eax
leaq 0x1c8f(%rip), %rcx      # 0x70f0
movzbl (%rax,%rcx), %eax
movq 0x8(%rsp), %rcx
movl %edx, (%rcx,%rax,4)
jmp 0x54d8
xorl %eax, %eax
movq 0x8(%rsp), %rdx
leaq 0x1c73(%rip), %rsi      # 0x70f0
leal (%r15,%rax), %ecx
movzbl (%rcx,%rsi), %ecx
movl $0x0, (%rdx,%rcx,4)
incl %eax
cmpl $0xf, %eax
jne 0x547d
addl %eax, %r15d
xorl %eax, %eax
jmp 0x5385
movl $0x19, %edx
movq %r13, %rdi
leaq 0x25a8(%rip), %rsi      # 0x7a54
callq 0x2130
movl $0x1, %eax
movq 0x10(%rsp), %rbx
jmp 0x5385
movl $0x19, %edx
movq 0x4b0c(%rip), %rdi      # 0x9fd8
leaq 0x2581(%rip), %rsi      # 0x7a54
callq 0x2130
movq 0x10(%rsp), %rbx
xorl %eax, %eax
cmpl $-0x1, %r13d
sete %al
movq 0x4aeb(%rip), %r13      # 0x9fd8
jmp 0x5385
movq 0x4adf(%rip), %rdi      # 0x9fd8
leaq 0x2554(%rip), %rsi      # 0x7a54
jmp 0x5555
movl $0x5, %eax
cmpl $0x5, %eax
sete %bpl
jmp 0x5561
xorl %r13d, %r13d
cmpl $-0x1, %r13d
je 0x5547
cmpl $0x0, 0x18(%rsp)
je 0x5576
leal -0x1(%r15), %ecx
movl $0x1, %eax
shll %cl, %eax
cmpl %eax, %r13d
movq 0x8(%rsp), %rdx
jge 0x557b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %r15d, %ecx
shll %cl, %eax
addl %eax, %r13d
incl %r13d
jmp 0x557b
movq 0x4a8a(%rip), %rdi      # 0x9fd8
leaq 0x24b6(%rip), %rsi      # 0x7a0b
movl $0x19, %edx
callq 0x2130
xorl %ebp, %ebp
andb $0x1, %bpl
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdx
addl (%rbp), %r13d
movl %r13d, (%rbp)
movb 0x2076(%r12), %cl
shll %cl, %r13d
movl %r13d, (%rdx)
jmp 0x50a3