// File: CMU-SAFARI[P]ramulator/src/Processor.cpp
// Function: ramulator::Trace::get_dramtrace_request(long&, ramulator::Request::Type&)
bool Trace::get_dramtrace_request(long& req_addr, Request::Type& req_type)
{
    string line;
    getline(file, line);
    if (file.eof()) {
        return false;
    }
    size_t pos;
    req_addr = std::stoul(line, &pos, 16);

    pos = line.find_first_not_of(' ', pos+1);

    if (pos == string::npos || line.substr(pos)[0] == 'R')
        req_type = Request::Type::READ;
    else if (line.substr(pos)[0] == 'W')
        req_type = Request::Type::WRITE;
    else assert(false);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0xc480
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
addq $0x8, %rdi
callq 0xc0e0
jmp 0x1fa08b
movq -0xb0(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rcx), %rcx
leaq 0x8(%rax,%rcx), %rdi
callq 0xc620
movb %al, -0xb1(%rbp)
jmp 0x1fa0ac
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x1fa0b8
jmp 0x1fa0d9
movb $0x0, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
jmp 0x1fa285
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1fa29c
leaq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rsi
movl $0x10, %edx
callq 0x1fb020
movq %rax, -0xc0(%rbp)
jmp 0x1fa0f4
movq -0xc0(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rdx
addq $0x1, %rdx
leaq -0x40(%rbp), %rdi
movl $0x20, %esi
callq 0xc340
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rcx
movb $0x0, -0x79(%rbp)
movb $0x1, %al
cmpq $-0x1, %rcx
movb %al, -0xc1(%rbp)
je 0x1fa17c
movq -0x58(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq $-0x1, %rcx
callq 0xc380
jmp 0x1fa14c
movb $0x1, -0x79(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x78(%rbp), %rdi
callq 0xc690
movq %rax, -0xd0(%rbp)
jmp 0x1fa166
movq -0xd0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x52, %eax
sete %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
movb %al, -0xd1(%rbp)
testb $0x1, -0x79(%rbp)
jne 0x1fa190
jmp 0x1fa199
leaq -0x78(%rbp), %rdi
callq 0xc6b8
movb -0xd1(%rbp), %al
testb $0x1, %al
jne 0x1fa1a5
jmp 0x1fa1d6
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
jmp 0x1fa27a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x79(%rbp)
jne 0x1fa1c8
jmp 0x1fa1d1
leaq -0x78(%rbp), %rdi
callq 0xc6b8
jmp 0x1fa29c
movq -0x58(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq $-0x1, %rcx
callq 0xc380
jmp 0x1fa1f3
xorl %eax, %eax
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
callq 0xc690
movq %rax, -0xe0(%rbp)
jmp 0x1fa20c
movq -0xe0(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0xe4(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xc6b8
movl -0xe4(%rbp), %eax
cmpl $0x57, %eax
jne 0x1fa259
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
jmp 0x1fa278
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0xc6b8
jmp 0x1fa29c
leaq 0x55901(%rip), %rdi     # 0x24fb61
leaq 0x66d4d(%rip), %rsi     # 0x260fb4
movl $0x1d7, %edx            # imm = 0x1D7
leaq 0x671a3(%rip), %rcx     # 0x261416
callq 0xc280
jmp 0x1fa27a
movb $0x1, -0x1(%rbp)
movl $0x1, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
callq 0xc6b8
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0xc6b8
movq -0x48(%rbp), %rdi
callq 0xc5d0
nop