// File: /workspace/github_cpp_makefile_star2_O1/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: GenerateSDROutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string GenerateSDROutput (string line)
{
		istringstream iss(line);
		string sub, str;
		long int n, k;
		int i;

		// Scarta nome comando
		iss >> sub;
		// Memorizza dimensione dati, utilizzabile per verifica
		iss >> n;
		// Scarta parametro
		iss >> sub;
		// Prende dati in esadecimale tra parentesi
		iss >> sub;
		
		// Inserisce parte iniziale comune per tutte le SDR
		str += "!*";
		
		// Conteggio da ultimo carattere escludendo parentesi di chiusura e di apertura
		for (k = sub.length()-2; k>1; k--)
		{
			str += sub[k];
		}

		// Converte ultimo valore esadecimale in stringa binaria
		string binval = hexCharToBin(sub[k]);

		// Sostituisce '.' e ',' a 0 e 1
		for (i=binval.length()-1; i>0; i--)
		{
			if (binval[i]=='0') 
				str += ".";
			else if(binval[i]=='1') 
				str += ",";
		}

		if (binval[i]=='0') 
			str += ":";
        else if (binval[i]=='1') 
			str += ";";

		str += "!*";

		return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, %rbx
leaq -0x1f8(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x33b0
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
xorl %eax, %eax
movq %rax, -0x8(%r15)
movb %al, (%r15)
leaq 0x10(%rbx), %rcx
movq %rcx, -0x30(%rbp)
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
movb %al, 0x10(%rbx)
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x32e0
leaq -0x1f8(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x3260
leaq -0x1f8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x32e0
leaq -0x1f8(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x32e0
leaq 0x1741(%rip), %rsi      # 0x77b4
movq %rbx, %rdi
callq 0x3420
movq -0x48(%rbp), %r14
leaq -0x2(%r14), %rax
cmpq $0x2, %rax
jl 0x60ac
decq %r14
movq -0x50(%rbp), %rax
movsbl -0x1(%rax,%r14), %esi
movq %rbx, %rdi
callq 0x31f0
decq %r14
cmpq $0x2, %r14
jg 0x608c
movl $0x1, %eax
movq -0x50(%rbp), %rcx
movsbl (%rcx,%rax), %esi
leaq -0x70(%rbp), %rdi
callq 0x675a
movl -0x68(%rbp), %r14d
decl %r14d
testl %r14d, %r14d
jle 0x610b
movl %r14d, %r14d
incq %r14
leaq 0x16cc(%rip), %r13      # 0x77a2
leaq 0x1480(%rip), %r12      # 0x755d
movq -0x70(%rbp), %rax
movzbl -0x1(%rax,%r14), %eax
movq %r13, %rsi
cmpl $0x31, %eax
je 0x60f7
cmpl $0x30, %eax
jne 0x60ff
movq %r12, %rsi
movq %rbx, %rdi
callq 0x3420
decq %r14
cmpq $0x1, %r14
jg 0x60dd
decl %r14d
movslq %r14d, %rax
movq -0x70(%rbp), %rcx
movzbl (%rcx,%rax), %eax
cmpl $0x31, %eax
je 0x6129
cmpl $0x30, %eax
jne 0x6138
leaq 0x100d(%rip), %rsi      # 0x7134
jmp 0x6130
leaq 0x168b(%rip), %rsi      # 0x77bb
movq %rbx, %rdi
callq 0x3420
leaq 0x1675(%rip), %rsi      # 0x77b4
movq %rbx, %rdi
callq 0x3420
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x6160
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x6175
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq 0x3e44(%rip), %rsi      # 0x9fc0
leaq -0x1f8(%rbp), %rdi
callq 0x3320
leaq -0x180(%rbp), %rdi
callq 0x30a0
movq %rbx, %rax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x61cd
jmp 0x61af
jmp 0x61cd
movq %rax, %r14
leaq -0x60(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x61d0
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x3250
jmp 0x61d0
movq %rax, %r14
movq (%rbx), %rdi
cmpq -0x30(%rbp), %rdi
je 0x61e8
movq -0x30(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3250
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x61fd
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3250
movq 0x3dbc(%rip), %rsi      # 0x9fc0
leaq -0x1f8(%rbp), %rdi
callq 0x3320
leaq -0x180(%rbp), %rdi
callq 0x30a0
movq %r14, %rdi
callq 0x33e0