// File: mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: DecodeInstruction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string DecodeInstruction (string line) 
{
	// Necessario per analizzare linea componente per componente
	istringstream iss(line);
	string sub;
	iss >> sub;

	// Vengono chiamate diverse funzioni a seconda del valore di sub
	if (sub == "SDR")			return GenerateSDROutput (line);
	else if (sub == "SIR") 		return GenerateSIROutput (line);
	else if (sub == "STATE")	return GenerateSTATEOutput (line);
	else if (sub == "RUNTEST")	return GenerateRUNTESTOutput (line);
	else 
	{
		// Handler per altri casi
		return "";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rsi, -0x278(%rbp)
movq %rdi, -0x270(%rbp)
movq %rdi, %rax
movq %rax, -0x268(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x190(%rbp), %rdi
movq %rdi, -0x260(%rbp)
movl $0x8, %edx
callq 0x3460
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x33a0
movq -0x260(%rbp), %rdi
movq -0x258(%rbp), %rsi
callq 0x3370
jmp 0x7b4b
leaq 0x2a85(%rip), %rsi      # 0xa5d7
leaq -0x1b0(%rbp), %rdi
callq 0x5ce0
movb %al, -0x279(%rbp)
jmp 0x7b66
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x7b72
jmp 0x7bf1
movq -0x278(%rbp), %rsi
leaq -0x1e0(%rbp), %rdi
callq 0x30e0
jmp 0x7b87
movq -0x270(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x7e60
jmp 0x7b9c
leaq -0x1e0(%rbp), %rdi
callq 0x3190
movl $0x1, -0x1e4(%rbp)
jmp 0x7e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0x7e2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x1e0(%rbp), %rdi
callq 0x3190
jmp 0x7e2d
leaq 0x2b7c(%rip), %rsi      # 0xa774
leaq -0x1b0(%rbp), %rdi
callq 0x5ce0
movb %al, -0x27a(%rbp)
jmp 0x7c0c
movb -0x27a(%rbp), %al
testb $0x1, %al
jne 0x7c18
jmp 0x7c80
movq -0x278(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x30e0
jmp 0x7c2d
movq -0x270(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x81e0
jmp 0x7c42
leaq -0x208(%rbp), %rdi
callq 0x3190
movl $0x1, -0x1e4(%rbp)
jmp 0x7e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x3190
jmp 0x7e2d
leaq 0x2af1(%rip), %rsi      # 0xa778
leaq -0x1b0(%rbp), %rdi
callq 0x5ce0
movb %al, -0x27b(%rbp)
jmp 0x7c9b
movb -0x27b(%rbp), %al
testb $0x1, %al
jne 0x7ca7
jmp 0x7d0f
movq -0x278(%rbp), %rsi
leaq -0x228(%rbp), %rdi
callq 0x30e0
jmp 0x7cbc
movq -0x270(%rbp), %rdi
leaq -0x228(%rbp), %rsi
callq 0x85a0
jmp 0x7cd1
leaq -0x228(%rbp), %rdi
callq 0x3190
movl $0x1, -0x1e4(%rbp)
jmp 0x7e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x228(%rbp), %rdi
callq 0x3190
jmp 0x7e2d
leaq 0x2a68(%rip), %rsi      # 0xa77e
leaq -0x1b0(%rbp), %rdi
callq 0x5ce0
movb %al, -0x27c(%rbp)
jmp 0x7d2a
movb -0x27c(%rbp), %al
testb $0x1, %al
jne 0x7d36
jmp 0x7d9e
movq -0x278(%rbp), %rsi
leaq -0x248(%rbp), %rdi
callq 0x30e0
jmp 0x7d4b
movq -0x270(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x87b0
jmp 0x7d60
leaq -0x248(%rbp), %rdi
callq 0x3190
movl $0x1, -0x1e4(%rbp)
jmp 0x7e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x248(%rbp), %rdi
callq 0x3190
jmp 0x7e2d
leaq -0x249(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0x34b0
movq -0x270(%rbp), %rdi
movq -0x288(%rbp), %rdx
leaq 0x229d(%rip), %rsi      # 0xa063
callq 0x54b0
jmp 0x7dcd
leaq -0x249(%rbp), %rdi
callq 0x32e0
movl $0x1, -0x1e4(%rbp)
jmp 0x7e05
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x249(%rbp), %rdi
callq 0x32e0
jmp 0x7e2d
leaq -0x1b0(%rbp), %rdi
callq 0x3190
leaq -0x190(%rbp), %rdi
callq 0x3100
movq -0x268(%rbp), %rax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
leaq -0x1b0(%rbp), %rdi
callq 0x3190
leaq -0x190(%rbp), %rdi
callq 0x3100
movq -0x1b8(%rbp), %rdi
callq 0x34a0
nopw %cs:(%rax,%rax)