// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/middle/abstract_assembler/AbstractAssembler.cpp
// Function: AbstractAssembler::assembleCommands(CommandList&)
SimpleResolution *AbstractAssembler::assembleCommands(CommandList &commandList) {
    InstructionList &instructions = *new InstructionList();

    for (const auto &command : commandList.commands) {
        long long tempVars = 0;

        if (auto commandList = dynamic_cast<CommandList *>(command)) { // NESTED COMMANDLIST
            SimpleResolution *assmebledCommands = assembleCommands(*commandList);
            instructions.append(assmebledCommands->instructions);
            tempVars += assmebledCommands->temporaryVars;
        } else if (auto readNode = dynamic_cast<Read *>(command)) { // READ
            Resolution *idRes = resolve(readNode->identifier, false);

            if (!idRes->writable) throw "Trying to read to non-writable variable " + readNode->identifier.name;

            Get *get = new Get();
            if (idRes->indirect) {
                TemporaryVariable *tempAddressVar = new TemporaryVariable(TEMPORARY_NAMES, *new ResolvableAddress());
                scopedVariables->pushVariableScope(tempAddressVar);

                instructions.append(idRes->instructions).append(new Store(tempAddressVar->getAddress())).append(get).append(new Storei(tempAddressVar->getAddress()));
                tempVars += 1;
            } else {
                instructions.append(get).append(new Store(idRes->address));
            }

            tempVars += idRes->temporaryVars;
        } else if (auto writeNode = dynamic_cast<Write *>(command)) { // WRITE
            Resolution *valRes = resolve(writeNode->value);
            Put *put = new Put();

            if (valRes->indirect) {
                instructions.append(valRes->instructions).append(new Loadi(primaryAccumulator)).append(put);
            } else {
                instructions.append(new Load(valRes->address)).append(put);
            }

            tempVars += valRes->temporaryVars;
        } else if (auto assignNode = dynamic_cast<Assignment *>(command)) { // ASSIGN
            Resolution *idRes = resolve(assignNode->identifier, false);

            if (!idRes->writable) throw "Trying to assign to non-writable variable " + assignNode->identifier.name;

            SimpleResolution *expRes = assembleExpression(assignNode->expression);

            if (idRes->indirect) {
                TemporaryVariable *tempAddressVar = new TemporaryVariable(TEMPORARY_NAMES, *new ResolvableAddress());
                scopedVariables->pushVariableScope(tempAddressVar);

                instructions.append(idRes->instructions).append(new Store(tempAddressVar->getAddress())).append(expRes->instructions).append(new Storei(tempAddressVar->getAddress()));
                tempVars += 1;
            } else {
                instructions.append(expRes->instructions).append(new Store(idRes->address));
            }

            tempVars += idRes->temporaryVars + expRes->temporaryVars;
        } else if (auto ifNode = dynamic_cast<If *>(command)) { // IF
            SimpleResolution *codeResolution = assembleCommands(ifNode->commands); // assemble inner instructions
            SimpleResolution *conditionResolution = assembleCondition(ifNode->condition, codeResolution->instructions); // assemble condition

            instructions.append(conditionResolution->instructions) // add condition code
                    .append(codeResolution->instructions); // add inner block code

            tempVars += conditionResolution->temporaryVars;
        } else if (auto ifElseNode = dynamic_cast<IfElse *>(command)) { // IF ELSE
            SimpleResolution *ifCodeResolution = assembleCommands(ifElseNode->commands);
            SimpleResolution *conditionResolution = assembleCondition(ifElseNode->condition, ifCodeResolution->instructions);
            SimpleResolution *elseCodeResolution = assembleCommands(ifElseNode->elseCommands);

            Jump *jump = new Jump(elseCodeResolution->instructions.end());
            ifCodeResolution->instructions.append(jump);

            instructions.append(conditionResolution->instructions)
                    .append(ifCodeResolution->instructions)
                    .append(elseCodeResolution->instructions);

            tempVars += conditionResolution->temporaryVars;
        } else if (auto whileNode = dynamic_cast<While *>(command)) { // WHILE
            SimpleResolution *codeResolution = assembleCommands(whileNode->commands);

            if (whileNode->doWhile) {
                InstructionList *jumpBlock = new InstructionList();
                Jump *jump = new Jump(codeResolution->instructions.start());
                jumpBlock->append(jump);

                SimpleResolution *conditionResolution = assembleCondition(whileNode->condition, *jumpBlock);
                instructions.append(codeResolution->instructions)
                        .append(conditionResolution->instructions)
                        .append(*jumpBlock);

                tempVars += conditionResolution->temporaryVars;
            } else {
                SimpleResolution *conditionResolution = assembleCondition(whileNode->condition, codeResolution->instructions);
                Jump *jump = new Jump(conditionResolution->instructions.start());
                codeResolution->instructions.append(jump);

                instructions.append(conditionResolution->instructions)
                        .append(codeResolution->instructions);

                tempVars += conditionResolution->temporaryVars;
            }
        } else if (auto forNode = dynamic_cast<For *>(command)) {
            NumberVariable *iterator = new NumberVariable(
                    forNode->variableName,
                    *new ResolvableAddress(),
                    true
            );
            iterator->initialized = true;
            scopedVariables->pushVariableScope(iterator); // create iterator BEFORE commands would use it
            tempVars += 1;

            Resolution *startRes = resolve(forNode->startValue); // resolve start and end
            Resolution *endRes = resolve(forNode->endValue);
            tempVars += startRes->temporaryVars + endRes->temporaryVars;

            ResolvableAddress *iterationEndAddress; // we will need it in comparing

            if (endRes->type == CONSTANT) {
                iterationEndAddress = &endRes->address;
            } else {
                TemporaryVariable *iterationEnd = new TemporaryVariable(TEMPORARY_NAMES, *new ResolvableAddress());
                scopedVariables->pushVariableScope(iterationEnd);
                tempVars += 1;

                iterationEndAddress = &iterationEnd->getAddress();

                instructions.append(endRes->instructions)
                        .append(endRes->indirect ? static_cast<Instruction *>(new Loadi(primaryAccumulator)) : static_cast<Instruction *>(new Load(endRes->address)))
                        .append(new Store(*iterationEndAddress));
            }

            SimpleResolution *codeResolution = assembleCommands(forNode->commands); // assemble iterated commands

            InstructionList &forLoopInstructions = *new InstructionList();
            forLoopInstructions.append(new Sub(*iterationEndAddress))
                    .append(forNode->reversed ? static_cast<Instruction *>(new Jneg(codeResolution->instructions.end())) : static_cast<Instruction *>(new Jpos(codeResolution->instructions.end())));

            codeResolution->instructions.append(new Load(iterator->getAddress()))
                    .append(forNode->reversed ? static_cast<Instruction *>(new Dec()) : static_cast<Instruction *>(new Inc()))
                    .append(new Store(iterator->getAddress()))
                    .append(new Jump(forLoopInstructions.start()));

            instructions.append(startRes->instructions) // load start instructions
                    .append(startRes->indirect ? static_cast<Instruction *>(new Loadi(primaryAccumulator)) : static_cast<Instruction *>(new Load(startRes->address)))
                    .append(new Store(iterator->getAddress())); // store it in the iterator

            instructions.append(forLoopInstructions)
                    .append(codeResolution->instructions);
        }

        scopedVariables->popVariableScope(tempVars);
    }

    return new SimpleResolution(
            instructions,
            0
    );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, -0x30(%rbp)
movl $0x20, %edi
callq 0x51f0
movq %rax, %r15
movq %rax, %rdi
callq 0x1a830
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rax
movq %rax, -0xd8(%rbp)
cmpq %rax, %r14
movq -0x30(%rbp), %rbx
je 0xfe0e
leaq 0x8(%rbx), %rax
movq %rax, -0x78(%rbp)
leaq 0x17515(%rip), %rax     # 0x266d0
addq $0x10, %rax
movq %rax, -0xc0(%rbp)
leaq 0x1783b(%rip), %rax     # 0x26a08
addq $0x10, %rax
movq %rax, -0xb8(%rbp)
leaq 0x179b9(%rip), %rax     # 0x26b98
addq $0x10, %rax
movq %rax, -0xb0(%rbp)
leaq 0x17687(%rip), %rax     # 0x26878
addq $0x10, %rax
movq %rax, -0x60(%rbp)
leaq 0x176c8(%rip), %rax     # 0x268c8
addq $0x10, %rax
movq %rax, -0x48(%rbp)
leaq 0x17899(%rip), %rax     # 0x26aa8
addq $0x10, %rax
movq %rax, -0x58(%rbp)
leaq 0x176fa(%rip), %rax     # 0x26918
addq $0x10, %rax
movq %rax, -0x70(%rbp)
leaq 0x178cb(%rip), %rax     # 0x26af8
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
leaq 0x17511(%rip), %rax     # 0x26750
addq $0x10, %rax
movq %rax, -0x80(%rbp)
leaq 0x1771a(%rip), %rax     # 0x26968
addq $0x10, %rax
movq %rax, -0x90(%rbp)
leaq 0x179d8(%rip), %rax     # 0x26c38
addq $0x10, %rax
movq %rax, -0xc8(%rbp)
leaq 0x17976(%rip), %rax     # 0x26be8
addq $0x10, %rax
movq %rax, -0xd0(%rbp)
movq %r15, -0x38(%rbp)
movq (%r14), %r12
testq %r12, %r12
je 0xf2cb
movq %r12, %rdi
leaq 0x1737d(%rip), %r13     # 0x26610
movq %r13, %rsi
leaq 0x1708b(%rip), %rdx     # 0x26328
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf2d3
movq %rbx, %rdi
movq %rax, %rsi
callq 0xf160
movq %rax, %rbx
movq 0x8(%rax), %rsi
movq %r15, %rdi
callq 0x1a902
movq (%rbx), %r13
jmp 0xf52f
xorl %r13d, %r13d
jmp 0xf533
movq %r12, %rdi
movq %r13, %rsi
leaq 0x171f8(%rip), %rdx     # 0x264d8
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf43c
movq %rax, %rbx
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rdi
xorl %edx, %edx
callq 0xff14
cmpb $0x0, (%rax)
je 0xfe35
movq %rax, %r12
movl $0x18, %edi
callq 0x51f0
movq %rax, %r15
movq $0x0, 0x10(%rax)
movq $-0x1, 0x8(%rax)
movq -0xd0(%rbp), %rax
movq %rax, (%r15)
cmpb $0x1, 0x1(%r12)
jne 0xf4e3
movl $0x30, %edi
callq 0x51f0
movq %rax, %r13
movl $0x10, %edi
callq 0x51f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x8(%r13)
movb $0x0, 0x10(%r13)
leaq 0x17fa2(%rip), %rax     # 0x27310
movq %rax, 0x18(%r13)
movw $0x101, 0x28(%r13)      # imm = 0x101
movq -0x80(%rbp), %rax
movq %rax, (%r13)
movq $0x1, 0x20(%r13)
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rdi
movq %r13, %rsi
callq 0x17afc
movq %r12, -0x40(%rbp)
movq 0x10(%r12), %rsi
movq -0x38(%rbp), %rdi
callq 0x1a902
movq %rax, %r12
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r13, %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq %rax, %rdi
movq %r15, %rsi
callq 0x1a9ba
movq %rax, %r15
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r13, %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x90(%rbp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movl $0x1, %r13d
movq -0x40(%rbp), %r12
jmp 0xf526
movq %r12, %rdi
movq %r13, %rsi
leaq 0x170d7(%rip), %rdx     # 0x26520
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf555
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
callq 0x1092e
movq %rax, %r15
movl $0x18, %edi
callq 0x51f0
movq %rax, %r12
movq $0x0, 0x10(%rax)
movq $-0x1, 0x8(%rax)
movq -0xc8(%rbp), %rax
movq %rax, (%r12)
cmpb $0x1, 0x1(%r15)
jne 0xf6ad
movq 0x10(%r15), %rsi
movq -0x38(%rbp), %rdi
callq 0x1a902
movq %rax, %rbx
movl $0x20, %edi
callq 0x51f0
movq -0x78(%rbp), %rcx
movq (%rcx), %rcx
movq $-0x1, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq -0x70(%rbp), %rcx
movq %rcx, (%rax)
movq %rbx, %rdi
movq -0x30(%rbp), %rbx
jmp 0xf6d6
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x1a9ba
movq %rax, %rbx
movl $0x20, %edi
callq 0x51f0
movq 0x18(%r12), %rcx
movq $-0x1, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1a9ba
xorl %r13d, %r13d
addq 0x8(%r12), %r13
movq -0x38(%rbp), %r15
movq -0x30(%rbp), %rbx
movq 0x28(%rbx), %rdi
movq %r13, %rsi
callq 0x17c22
addq $0x8, %r14
cmpq -0xd8(%rbp), %r14
jne 0xf281
jmp 0xfe0e
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16e0e(%rip), %rdx     # 0x26370
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf6f6
movq %rax, %rbx
movq 0x8(%rax), %rsi
movq -0x30(%rbp), %r13
movq %r13, %rdi
xorl %edx, %edx
callq 0xff14
cmpb $0x0, (%rax)
je 0xfe6f
movq %rax, %r12
movq 0x10(%rbx), %rsi
movq %r13, %rdi
callq 0x10aea
cmpb $0x1, 0x1(%r12)
jne 0xf75c
movq %r13, %rbx
movq %rax, -0x40(%rbp)
movl $0x30, %edi
callq 0x51f0
movq %rax, %r13
movl $0x10, %edi
callq 0x51f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x8(%r13)
movb $0x0, 0x10(%r13)
leaq 0x17d31(%rip), %rax     # 0x27310
movq %rax, 0x18(%r13)
movw $0x101, 0x28(%r13)      # imm = 0x101
movq -0x80(%rbp), %rax
movq %rax, (%r13)
movq $0x1, 0x20(%r13)
movq 0x28(%rbx), %rdi
movq %r13, %rsi
callq 0x17afc
movq 0x10(%r12), %rsi
movq %r15, %rdi
callq 0x1a902
movq %rax, %r15
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r13, %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rsi
movq %rax, %rdi
callq 0x1a902
movq %rax, %r15
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r13, %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x90(%rbp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movl $0x1, %r13d
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %rbx
jmp 0xf7a2
movl $0x20, %edi
callq 0x51f0
movq 0x18(%r15), %rcx
movq $-0x1, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq -0x60(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x1a9ba
movq %rax, %rdi
movq %r12, %rsi
callq 0x1a9ba
movq 0x8(%r15), %r13
movq -0x38(%rbp), %r15
jmp 0xf533
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16cb5(%rip), %rdx     # 0x263b8
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf7af
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0xf160
movq 0x8(%rbx), %rsi
movq 0x8(%rax), %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x15b76
movq %rax, %r15
movq 0x8(%rax), %rsi
movq -0x38(%rbp), %rdi
callq 0x1a902
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rbx
callq 0x1a902
movq (%r15), %r13
jmp 0xf6ed
movq 0x8(%rax), %rsi
movq %r15, %rdi
movq %rax, %rbx
callq 0x1a902
movq %rax, %r13
movl $0x20, %edi
callq 0x51f0
movq 0x18(%r12), %rcx
movq $-0x1, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x1a9ba
xorl %r13d, %r13d
addq 0x8(%r12), %r13
addq (%rbx), %r13
jmp 0xf52f
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16c44(%rip), %rdx     # 0x26400
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf86b
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %r15
movq %r15, %rdi
callq 0xf160
movq 0x8(%rbx), %rsi
movq 0x8(%rax), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x15b76
movq %rax, -0x40(%rbp)
movq 0x18(%rbx), %rsi
movq %r15, %rdi
callq 0xf160
movq %rax, %rbx
movl $0x20, %edi
callq 0x51f0
movq %rax, %r15
movq 0x8(%rbx), %r13
movq %r13, %rdi
callq 0x1a8ba
movq $-0x1, 0x8(%r15)
movb $0x0, 0x10(%r15)
movq -0x58(%rbp), %rcx
movq %rcx, (%r15)
movq %rax, 0x18(%r15)
movq %r12, %rdi
movq %r15, %rsi
callq 0x1a9ba
movq -0x40(%rbp), %rbx
movq 0x8(%rbx), %rsi
movq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0x1a902
movq %rax, %rdi
movq %r12, %rsi
callq 0x1a902
movq %rax, %rdi
movq %r13, %rsi
jmp 0xf2be
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16bd0(%rip), %rdx     # 0x26448
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0xf93b
movq %rax, %rbx
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0xf160
movq %rax, %r15
cmpb $0x1, 0x18(%rbx)
jne 0xfaf8
movq %rbx, %r12
movl $0x20, %edi
callq 0x51f0
movq %rax, %r13
movq %rax, %rdi
callq 0x1a830
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq 0x8(%r15), %r15
movq %r15, %rdi
callq 0x1a8c4
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq -0x58(%rbp), %rcx
movq %rcx, (%rbx)
movq %rax, 0x18(%rbx)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq 0x8(%r12), %rsi
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
callq 0x15b76
movq %rax, %r12
movq -0x38(%rbp), %rdi
movq %r15, %rsi
callq 0x1a902
movq 0x8(%r12), %rsi
movq %rax, %rdi
callq 0x1a902
movq %rax, %rdi
movq %r13, %rsi
callq 0x1a902
jmp 0xfb67
movq %r12, %rdi
movq %r13, %rsi
leaq 0x16b48(%rip), %rdx     # 0x26490
xorl %ecx, %ecx
callq 0x5240
movl $0x0, %r13d
movq %rax, -0x40(%rbp)
testq %rax, %rax
movq -0x30(%rbp), %rbx
je 0xf533
movl $0x30, %edi
callq 0x51f0
movq %rax, %r15
movl $0x10, %edi
callq 0x51f0
movq -0x40(%rbp), %r13
movq %r13, %rcx
addq $0x8, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x8(%r15)
movq %rcx, 0x18(%r15)
movb $0x1, %cl
movb %cl, 0x28(%r15)
movq -0xc0(%rbp), %rax
movq %rax, (%r15)
movq $0x1, 0x20(%r15)
movb %cl, 0x10(%r15)
movq 0x28(%rbx), %rdi
movq %r15, -0x68(%rbp)
movq %r15, %rsi
callq 0x17afc
movq 0x28(%r13), %rsi
movq %rbx, %rdi
callq 0x1092e
movq %rax, %r12
movq 0x30(%r13), %rsi
movq %rbx, %rdi
callq 0x1092e
movq %rax, %r15
movq 0x8(%rax), %r13
movq %r12, -0x98(%rbp)
addq 0x8(%r12), %r13
cmpl $0x0, 0x20(%rax)
je 0xfb70
movl $0x30, %edi
callq 0x51f0
movq %rax, %r12
movl $0x10, %edi
callq 0x51f0
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x8(%r12)
xorl %eax, %eax
movb %al, 0x10(%r12)
leaq 0x178e6(%rip), %rax     # 0x27310
movq %rax, 0x18(%r12)
movw $0x101, 0x28(%r12)      # imm = 0x101
movq -0x80(%rbp), %rax
movq %rax, (%r12)
movq $0x1, 0x20(%r12)
movq 0x28(%rbx), %rdi
movq %r12, %rsi
callq 0x17afc
movq %r12, %rdi
callq 0x17e78
movq %rax, -0x50(%rbp)
movq 0x10(%r15), %rsi
movq -0x38(%rbp), %rdi
callq 0x1a902
movq %rax, %rbx
movb 0x1(%r15), %al
xorl %ecx, %ecx
cmpb %cl, %al
movq -0x60(%rbp), %r12
cmovneq -0x70(%rbp), %r12
addq $0x18, %r15
cmpb %cl, %al
cmovneq -0x78(%rbp), %r15
addq $0x2, %r13
movl $0x20, %edi
callq 0x51f0
movq (%r15), %rcx
movq $-0x1, %r15
movq %r15, 0x8(%rax)
xorl %edx, %edx
movb %dl, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %r12, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1a9ba
movq %rax, %rbx
movl $0x20, %edi
callq 0x51f0
movq %r15, 0x8(%rax)
xorl %ecx, %ecx
movb %cl, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq %rcx, (%rax)
movq %rbx, %rdi
movq -0x30(%rbp), %rbx
movq %rax, %rsi
callq 0x1a9ba
jmp 0xfb7b
movq 0x8(%rbx), %rsi
movq 0x8(%r15), %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x15b76
movq %rax, %r12
movl $0x20, %edi
callq 0x51f0
movq %rax, %r13
movq 0x8(%r12), %rbx
movq %rbx, %rdi
callq 0x1a8c4
movq $-0x1, 0x8(%r13)
movb $0x0, 0x10(%r13)
movq -0x58(%rbp), %rcx
movq %rcx, (%r13)
movq %rax, 0x18(%r13)
movq %r15, %rdi
movq %r13, %rsi
callq 0x1a9ba
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x1a902
movq %rax, %rdi
movq %r15, %rsi
callq 0x1a902
movq -0x30(%rbp), %rbx
movq (%r12), %r13
jmp 0xf6ed
incq %r13
movq 0x18(%r15), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %r15
movq 0x38(%r15), %rsi
movq %rbx, %rdi
callq 0xf160
movq %rax, %r12
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %rax, %rdi
callq 0x1a830
movl $0x20, %edi
callq 0x51f0
movq $-0x1, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0xb8(%rbp), %rcx
movq %rcx, (%rax)
movq %rbx, -0x88(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1a9ba
movq %rax, -0xa0(%rbp)
movb 0x40(%r15), %bl
movl $0x20, %edi
callq 0x51f0
movq %rax, %r15
movq 0x8(%r12), %rdi
cmpb $0x1, %bl
movq %rdi, -0x50(%rbp)
jne 0xfc15
callq 0x1a8ba
movq -0x68(%rbp), %r12
movq -0xb0(%rbp), %rcx
jmp 0xfc25
callq 0x1a8ba
movq -0x68(%rbp), %r12
movq -0xa8(%rbp), %rcx
movq $-0x1, 0x8(%r15)
movb $0x0, 0x10(%r15)
movq %rax, 0x18(%r15)
movq %rcx, (%r15)
movq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x1a9ba
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r12, %rdi
callq 0x17e78
movq $-0x1, %rcx
movq %rcx, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x60(%rbp), %rax
movq %rax, (%rbx)
movq -0x50(%rbp), %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq %rax, %rbx
movq -0x40(%rbp), %rax
cmpb $0x0, 0x40(%rax)
leaq 0x17043(%rip), %r15     # 0x26cd8
je 0xfc9e
leaq 0x1708a(%rip), %r15     # 0x26d28
movl $0x18, %edi
callq 0x51f0
movq $0x0, 0x10(%rax)
movq $-0x1, %rcx
movq %rcx, 0x8(%rax)
addq $0x10, %r15
movq %r15, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x1a9ba
movq %rax, %r15
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq %r12, %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq %rax, %rbx
movl $0x20, %edi
callq 0x51f0
movq %rax, %r15
movq -0x88(%rbp), %rdi
callq 0x1a8c4
movq $-0x1, %rcx
movq %rcx, 0x8(%r15)
xorl %ecx, %ecx
movb %cl, 0x10(%r15)
movq -0x58(%rbp), %rcx
movq %rcx, (%r15)
movq %rax, 0x18(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a9ba
movq -0x98(%rbp), %rbx
movq 0x10(%rbx), %rsi
movq -0x38(%rbp), %r12
movq %r12, %rdi
callq 0x1a902
movq %rax, -0x40(%rbp)
movb 0x1(%rbx), %al
xorl %ecx, %ecx
cmpb %cl, %al
movq -0x60(%rbp), %r15
cmovneq -0x70(%rbp), %r15
addq $0x18, %rbx
cmpb %cl, %al
cmovneq -0x78(%rbp), %rbx
movl $0x20, %edi
callq 0x51f0
movq (%rbx), %rcx
movq $-0x1, %rdx
movq %rdx, 0x8(%rax)
xorl %edx, %edx
movb %dl, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq %r15, (%rax)
movq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0x1a9ba
movq %rax, %r15
movl $0x20, %edi
callq 0x51f0
movq %rax, %rbx
movq -0x68(%rbp), %rdi
callq 0x17e78
movq $-0x1, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %rax, 0x18(%rbx)
movq -0x48(%rbp), %rax
movq %rax, (%rbx)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1a9ba
movq %r12, %rdi
movq -0x88(%rbp), %rsi
callq 0x1a902
movq %rax, %rdi
movq -0x50(%rbp), %rsi
callq 0x1a902
movq %r12, %r15
jmp 0xf52f
movl $0x10, %edi
callq 0x51f0
movq $0x0, (%rax)
movq %r15, 0x8(%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0x5120
movq %rax, %r15
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0xf5f1(%rip), %rsi      # 0x1f442
movq %r15, %rdi
callq 0x16512
leaq 0x16850(%rip), %rsi     # 0x266b0
movq 0x17131(%rip), %rdx     # 0x26f98
movq %r15, %rdi
callq 0x53a0
movl $0x20, %edi
callq 0x5120
movq %rax, %r15
movq 0x8(%rbx), %rax
movq 0x8(%rax), %rdx
leaq 0xf5e0(%rip), %rsi      # 0x1f46b
movq %r15, %rdi
callq 0x16512
jmp 0xfe59
jmp 0xfed2
jmp 0xfed2
movq %rax, %r14
movl $0x30, %esi
movq %r12, %rdi
jmp 0xfef9
jmp 0xfee1
jmp 0xfed2
jmp 0xfee1
jmp 0xfee1
jmp 0xfee1
movq %rax, %r14
movl $0x30, %esi
jmp 0xfeda
jmp 0xfebe
jmp 0xfee1
movq %rax, %r14
movl $0x20, %esi
jmp 0xfef6
jmp 0xfed2
jmp 0xfee1
jmp 0xfee1
jmp 0xfeee
jmp 0xff00
movq %rax, %r14
movl $0x20, %esi
movq %r15, %rdi
jmp 0xfef9
jmp 0xfee1
movq %rax, %r14
movl $0x20, %esi
movq %rbx, %rdi
jmp 0xfef9
movq %rax, %r14
movl $0x30, %esi
movq %r13, %rdi
callq 0x5200
jmp 0xff0b
movq %rax, %r14
movq %r15, %rdi
callq 0x5160
movq %r14, %rdi
callq 0x53d0
nop