// File: /workspace/github_cpp_makefile_star2_O3/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 0x53cb
movb $0x1, 0x51(%rbx)
movq 0x4e42(%rip), %rcx      # 0xa1b8
testq %rcx, %rcx
je 0x53b6
leaq 0x4e2e(%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 0x5382
leaq 0x4e10(%rip), %rsi      # 0xa1b0
cmpq %rsi, %rax
je 0x53bd
cmpl $0x4, 0x20(%rax)
leaq 0x4e00(%rip), %rsi      # 0xa1b0
cmovbq %rax, %rsi
jmp 0x53bd
leaq 0x4df3(%rip), %rsi      # 0xa1b0
addq $0x28, %rsi
leaq 0x28(%rsp), %rdi
callq 0x20e0
cmpl $0x3ff, %ebp            # imm = 0x3FF
ja 0x5433
movb $0x1, 0x51(%rbx)
movq 0x4dda(%rip), %rcx      # 0xa1b8
testq %rcx, %rcx
je 0x541e
leaq 0x4dc6(%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 0x53ea
leaq 0x4da8(%rip), %rsi      # 0xa1b0
cmpq %rsi, %rax
je 0x5425
cmpl $0x3, 0x20(%rax)
leaq 0x4d98(%rip), %rsi      # 0xa1b0
cmovbq %rax, %rsi
jmp 0x5425
leaq 0x4d8b(%rip), %rsi      # 0xa1b0
addq $0x28, %rsi
leaq 0x28(%rsp), %rdi
callq 0x20e0
movb 0x51(%rbx), %bpl
testb %bpl, %bpl
je 0x553a
decl 0x28(%rbx)
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x4e0c
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 0x431c
leaq 0x2067(%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 0x54c0
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x54c8
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 0x5508
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x551f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x553a
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x5551
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 0x55ab
jmp 0x55ab
jmp 0x556f
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x558e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x558e
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x55ae
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x2190
jmp 0x55ae
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x55c5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2270
nop