// File: mittman[P]project254/cycle.cpp
// Function: Cycle::toNanoSeconds(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
double Cycle::toNanoSeconds(const string reltime) {
	string nanotime = reltime.substr(0, reltime.size() - 2);
	double elapsed = 0.0;

	stringstream ss;
	ss << nanotime;
	ss >> elapsed;

	if(reltime.substr( reltime.length() - 2 ) == "ms") {
		return elapsed * 1000 * 1000;
	}
	else if(reltime.substr( reltime.length() - 2 ) == "us") {
		return elapsed * 1000;
	}
	else if(reltime.substr( reltime.length() - 2 ) == "ns") {
		return elapsed;
	}
    else {
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rsi, -0x250(%rbp)
movq %rdi, %rax
movq -0x250(%rbp), %rdi
movq %rdi, -0x248(%rbp)
movq %rax, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
callq 0x3190
movq -0x248(%rbp), %rsi
movq %rax, %rcx
addq $-0x2, %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x38(%rbp), %rdi
callq 0x32a0
movq $0x0, -0x40(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x31a0
jmp 0x4161
leaq -0x1b8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3240
jmp 0x4173
leaq -0x1c8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3210
jmp 0x4185
movq -0x248(%rbp), %rdi
callq 0x33c0
movq -0x248(%rbp), %rsi
movq %rax, %rdx
addq $-0x2, %rdx
leaq -0x1f8(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32a0
jmp 0x41b4
leaq 0x8e6a(%rip), %rsi      # 0xd025
leaq -0x1f8(%rbp), %rdi
callq 0x4a80
movb %al, -0x251(%rbp)
jmp 0x41cf
leaq -0x1f8(%rbp), %rdi
callq 0x3170
movb -0x251(%rbp), %al
testb $0x1, %al
jne 0x41e7
jmp 0x4265
movsd 0x8e19(%rip), %xmm0     # 0xd008
mulsd -0x40(%rbp), %xmm0
movsd 0x8e0c(%rip), %xmm1     # 0xd008
mulsd %xmm1, %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x1fc(%rbp)
jmp 0x43b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x43e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
jmp 0x43d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x3170
jmp 0x43d8
movq -0x248(%rbp), %rdi
callq 0x33c0
movq -0x248(%rbp), %rsi
movq %rax, %rdx
addq $-0x2, %rdx
leaq -0x220(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32a0
jmp 0x4294
leaq 0x8d8d(%rip), %rsi      # 0xd028
leaq -0x220(%rbp), %rdi
callq 0x4a80
movb %al, -0x252(%rbp)
jmp 0x42af
leaq -0x220(%rbp), %rdi
callq 0x3170
movb -0x252(%rbp), %al
testb $0x1, %al
jne 0x42c7
jmp 0x430b
movsd 0x8d39(%rip), %xmm0     # 0xd008
mulsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x1fc(%rbp)
jmp 0x43b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x3170
jmp 0x43d8
movq -0x248(%rbp), %rdi
callq 0x33c0
movq -0x248(%rbp), %rsi
movq %rax, %rdx
addq $-0x2, %rdx
leaq -0x240(%rbp), %rdi
movq $-0x1, %rcx
callq 0x32a0
jmp 0x433a
leaq 0x8cea(%rip), %rsi      # 0xd02b
leaq -0x240(%rbp), %rdi
callq 0x4a80
movb %al, -0x253(%rbp)
jmp 0x4355
leaq -0x240(%rbp), %rdi
callq 0x3170
movb -0x253(%rbp), %al
testb $0x1, %al
jne 0x436d
jmp 0x43a3
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x1fc(%rbp)
jmp 0x43b5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
leaq -0x240(%rbp), %rdi
callq 0x3170
jmp 0x43d8
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
movl $0x1, -0x1fc(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x31e0
leaq -0x38(%rbp), %rdi
callq 0x3170
movsd -0x8(%rbp), %xmm0
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
leaq -0x1c8(%rbp), %rdi
callq 0x31e0
leaq -0x38(%rbp), %rdi
callq 0x3170
movq -0x1d0(%rbp), %rdi
callq 0x3440
nopl (%rax)