// File: /workspace/github_cpp_makefile_star2_O1/saumya-prakash[P]AssemblerEmulator/Emulator.cpp
// Function: Emulator::check_memory_access(int)
bool Emulator::check_memory_access(int a)
{
    string tmp;

    if(a<0 || a>end_address)
    {
        fault = true;
        tmp = faults.find(3)->second;
    }

    if(a<=pc_upper)
    {
        fault = true;
        tmp = faults.find(2)->second;
    }

    if(fault==false)
        return true;

    PC--;
    string tmp2 = current_state();
    PC++;

    fault_cause = tmp + " when executing " + tmp2;

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
cmpl $0x10000, %esi          # imm = 0x10000
jb 0x53c9
movb $0x1, 0x51(%rbx)
movq 0x4e3e(%rip), %rcx      # 0xa1b8
leaq 0x4e2f(%rip), %rsi      # 0xa1b0
movq %rsi, %rax
testq %rcx, %rcx
je 0x53a7
leaq 0x4e20(%rip), %rax      # 0xa1b0
xorl %edx, %edx
cmpl $0x3, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x5390
cmpq %rsi, %rax
je 0x53bb
cmpl $0x4, 0x20(%rax)
leaq 0x4df9(%rip), %rsi      # 0xa1b0
cmovbq %rax, %rsi
addq $0x28, %rsi
leaq 0x28(%rsp), %rdi
callq 0x20e0
cmpl $0x3ff, %ebp            # imm = 0x3FF
ja 0x542b
movb $0x1, 0x51(%rbx)
movq 0x4ddc(%rip), %rcx      # 0xa1b8
leaq 0x4dcd(%rip), %rsi      # 0xa1b0
movq %rsi, %rax
testq %rcx, %rcx
je 0x5409
leaq 0x4dbe(%rip), %rax      # 0xa1b0
xorl %edx, %edx
cmpl $0x2, 0x20(%rcx)
setb %dl
cmovaeq %rcx, %rax
movq 0x10(%rcx,%rdx,8), %rcx
testq %rcx, %rcx
jne 0x53f2
cmpq %rsi, %rax
je 0x541d
cmpl $0x3, 0x20(%rax)
leaq 0x4d97(%rip), %rsi      # 0xa1b0
cmovbq %rax, %rsi
addq $0x28, %rsi
leaq 0x28(%rsp), %rdi
callq 0x20e0
movb 0x51(%rbx), %bpl
testb %bpl, %bpl
je 0x5532
decl 0x28(%rbx)
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x4e0e
incl 0x28(%rbx)
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x434c
leaq 0x206f(%rip), %rsi      # 0x74e2
leaq 0x8(%rsp), %rdi
callq 0x2290
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x2090
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x54b8
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x54c0
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
addq $0x58, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21c0
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x5500
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x5517
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5532
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x5549
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
testb %bpl, %bpl
sete %al
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x55a3
jmp 0x55a3
jmp 0x5567
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x5586
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x5586
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55a6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x55a6
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x55bd
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2270
nop