// File: Bartor[P]kompilator/middle/abstract_assembler/AbstractAssembler.cpp
// Function: AbstractAssembler::resolve(AbstractValue&)
Resolution *AbstractAssembler::resolve(AbstractValue &value) {
    try { // NUMBER VALUE - 0
        NumberValue &numberValue = dynamic_cast<NumberValue &>(value);
        ResolvableAddress &address = constants->getConstant(numberValue.value)->getAddress();
        return new Resolution(
                *new InstructionList(),
                address,
                CONSTANT,
                false,
                0
        );
    } catch (std::bad_cast _) {
        try {
            IdentifierValue &identifierValue = dynamic_cast<IdentifierValue &>(value);
            return resolve(identifierValue.identifier);
        } catch (std::bad_cast __) {
            throw "Value resolution error";
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x2b5b2(%rip), %rsi     # 0x40078
leaq 0x2b713(%rip), %rdx     # 0x401e0
xorl %eax, %eax
movl %eax, %ecx
callq 0x62f0
movq %rax, -0x60(%rbp)
cmpq $0x0, %rax
jne 0x14ae7
callq 0x6530
jmp 0x14ae7
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq 0x30(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x23910
movq %rax, -0x70(%rbp)
jmp 0x14b0a
movq -0x70(%rbp), %rdi
callq 0x230c0
movq %rax, -0x78(%rbp)
jmp 0x14b19
movq -0x78(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x28, %edi
callq 0x6260
movq %rax, -0x80(%rbp)
jmp 0x14b31
movl $0x20, %edi
callq 0x6260
movq %rax, -0x88(%rbp)
jmp 0x14b44
movq -0x88(%rbp), %rdi
callq 0x2b0c0
jmp 0x14b52
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq %rsp, %rax
movl $0x1, (%rax)
xorl %r8d, %r8d
movl %r8d, %r9d
movl %r8d, %ecx
callq 0x20490
jmp 0x14b7a
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x14d30
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x14bce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
jmp 0x14bc0
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x20, %esi
callq 0x6270
movq -0x80(%rbp), %rdi
movl $0x28, %esi
callq 0x6270
movl -0x2c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14d3d
movq -0x28(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x6360
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x203d0
movq -0x98(%rbp), %rdi
callq 0x60f0
movq -0x18(%rbp), %rdi
leaq 0x2b467(%rip), %rsi     # 0x40078
leaq 0x2b610(%rip), %rdx     # 0x40228
xorl %eax, %eax
movl %eax, %ecx
callq 0x62f0
movq %rax, -0x90(%rbp)
cmpq $0x0, %rax
jne 0x14c35
callq 0x6530
jmp 0x14c35
movq -0x68(%rbp), %rdi
movq -0x90(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rsi
movl $0x1, %edx
callq 0x13eb0
movq %rax, -0xa0(%rbp)
jmp 0x14c5f
movq -0xa0(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0x4c(%rbp)
jmp 0x14d01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x14d1e
movq -0x28(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x6360
movq %rax, %rsi
leaq -0x58(%rbp), %rdi
callq 0x203d0
movq -0xa8(%rbp), %rdi
callq 0x60f0
movl $0x8, %edi
callq 0x6130
movq %rax, %rdi
leaq 0x1d94d(%rip), %rax     # 0x3261b
movq %rax, (%rdi)
movq 0x2c2c0(%rip), %rsi     # 0x40f98
xorl %eax, %eax
movl %eax, %edx
callq 0x6490
jmp 0x14d4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6500
callq 0x6450
jmp 0x14cff
jmp 0x14d1e
leaq -0x40(%rbp), %rdi
callq 0x6500
callq 0x6450
movl -0x4c(%rbp), %eax
testl %eax, %eax
je 0x14d1a
jmp 0x14d18
jmp 0x14d30
jmp 0x14d1c
ud2
leaq -0x40(%rbp), %rdi
callq 0x6500
callq 0x6450
jmp 0x14d2e
jmp 0x14d3d
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x64d0
movq %rax, %rdi
callq 0x9470
nop