// File: talyerushalmy[P]SimpleFileSystem/src/Commands.cpp
// Function: ExecCommand::execute(FileSystem&)
void ExecCommand::execute(FileSystem& fs)
{
	try
	{
		unsigned int input = stoi(StringTools::trim(this->getArgs()));
		if (input >= this->history.size() || (StringTools::trim(this->getArgs()) != "0" && input == 0))
		{
			std::cout << "Command not found" << std::endl;
			return;
		}
		std::string command = this->history[input]->toString();
		std::cout << command << std::endl;
	}
	catch (int e)
	{
		std::cout << "Command not found" << std::endl;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0xe0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x7c70
jmp 0xd289
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x36c0
jmp 0xd298
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
movl $0xa, %edx
callq 0xdc00
movl %eax, -0xe4(%rbp)
jmp 0xd2b2
leaq -0x38(%rbp), %rdi
callq 0x3130
leaq -0x58(%rbp), %rdi
callq 0x3130
movl -0xe4(%rbp), %ecx
movq -0xe0(%rbp), %rax
movl %ecx, -0x14(%rbp)
movl -0x14(%rbp), %ecx
movq %rcx, -0xf0(%rbp)
movq 0x48(%rax), %rdi
callq 0x6e80
movq -0xf0(%rbp), %rcx
movq %rax, %rdx
movb $0x0, -0xa9(%rbp)
movb $0x0, -0xaa(%rbp)
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, -0xe5(%rbp)
jae 0xd391
movq -0xe0(%rbp), %rsi
leaq -0xa8(%rbp), %rdi
callq 0x7c70
jmp 0xd325
movb $0x1, -0xa9(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x36c0
jmp 0xd341
movb $0x1, -0xaa(%rbp)
leaq 0x6fe2(%rip), %rsi      # 0x14331
leaq -0x88(%rbp), %rdi
callq 0xd9d0
movb %al, -0xf1(%rbp)
jmp 0xd363
movb -0xf1(%rbp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xf2(%rbp)
jne 0xd378
jmp 0xd385
cmpl $0x0, -0x14(%rbp)
sete %al
movb %al, -0xf2(%rbp)
movb -0xf2(%rbp), %al
movb %al, -0xe5(%rbp)
movb -0xe5(%rbp), %al
movb %al, -0xf3(%rbp)
testb $0x1, -0xaa(%rbp)
jne 0xd3a8
jmp 0xd3b4
leaq -0x88(%rbp), %rdi
callq 0x3130
testb $0x1, -0xa9(%rbp)
jne 0xd3bf
jmp 0xd3cb
leaq -0xa8(%rbp), %rdi
callq 0x3130
movb -0xf3(%rbp), %al
testb $0x1, %al
jne 0xd3da
jmp 0xd4a1
movq 0xebe7(%rip), %rdi      # 0x1bfc8
leaq 0x6f77(%rip), %rsi      # 0x1435f
callq 0x31b0
movq %rax, -0x100(%rbp)
jmp 0xd3f6
movq -0x100(%rbp), %rdi
movq 0xebb4(%rip), %rsi      # 0x1bfb8
callq 0x31e0
jmp 0xd40b
jmp 0xd575
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd522
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd444
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3130
leaq -0x58(%rbp), %rdi
callq 0x3130
jmp 0xd522
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd485
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
testb $0x1, -0xaa(%rbp)
jne 0xd477
jmp 0xd483
leaq -0x88(%rbp), %rdi
callq 0x3130
jmp 0xd485
testb $0x1, -0xa9(%rbp)
jne 0xd490
jmp 0xd49c
leaq -0xa8(%rbp), %rdi
callq 0x3130
jmp 0xd522
movq -0xe0(%rbp), %rax
movq 0x48(%rax), %rdi
movl -0x14(%rbp), %eax
movl %eax, %esi
callq 0xdc90
movq (%rax), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0xd0(%rbp), %rdi
callq *%rax
jmp 0xd4cb
movq 0xeaf6(%rip), %rdi      # 0x1bfc8
leaq -0xd0(%rbp), %rsi
callq 0x3180
movq %rax, -0x108(%rbp)
jmp 0xd4e7
movq -0x108(%rbp), %rdi
movq 0xeac3(%rip), %rsi      # 0x1bfb8
callq 0x31e0
jmp 0xd4fc
leaq -0xd0(%rbp), %rdi
callq 0x3130
jmp 0xd575
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x3130
movl -0x64(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xd58f
movq -0x60(%rbp), %rdi
callq 0x30c0
movl (%rax), %eax
movl %eax, -0xd4(%rbp)
movq 0xea82(%rip), %rdi      # 0x1bfc8
leaq 0x6e12(%rip), %rsi      # 0x1435f
callq 0x31b0
movq %rax, -0x110(%rbp)
jmp 0xd55b
movq -0x110(%rbp), %rdi
movq 0xea4f(%rip), %rsi      # 0x1bfb8
callq 0x31e0
jmp 0xd570
callq 0x32e0
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
callq 0x32e0
movq -0x60(%rbp), %rdi
callq 0x3300
nopl (%rax,%rax)