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

		// 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;

		// Preleva parte tra parentesi
		string hexval = sub.substr(1,2);
		// Converte stringa esadecimale in stringa binaria
		string binval = hexstrToBinstr(hexval);

		// Inserisce parte iniziale comune per tutte le SIR
		str += "!!**";
		
		// Sostituisce '.' e ',' a 0 e 1
		for (k=binval.length()-1; k>binval.length()-n; k--)
		{
			if (binval[k]=='0') 
				str += '.';
			else if(binval[k]=='1') 
				str += ',';
		}

		// Sostituisce l'ultimo bit con ':' o con ';'
		if (binval[k]=='0') 
			str += ':';
        else if (binval[k]=='1') 
			str += ';';

		// Inserisce parte finale comune per tutte le SIR
		str += "!*";
		
		return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
leaq -0x218(%rbp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x3360
leaq -0x28(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb %cl, 0x10(%rbx)
leaq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq -0x218(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x3130
leaq -0x218(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x32a0
leaq -0x218(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x32a0
leaq -0x98(%rbp), %rdi
leaq -0x38(%rbp), %rsi
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
callq 0x3240
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x32c0
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5b21
leaq -0x78(%rbp), %rdi
callq 0x30c0
leaq 0x1001(%rip), %rsi      # 0x677c
movq %rbx, %rdi
callq 0x33d0
movq -0x50(%rbp), %rax
leal -0x1(%rax), %r14d
movslq %r14d, %rdx
movslq -0x14(%rbp), %rcx
subq %rcx, %rax
movq -0x58(%rbp), %rcx
movzbl (%rcx,%rdx), %ecx
cmpq %rdx, %rax
jae 0x57c6
cmpl $0x31, %ecx
je 0x57b0
cmpl $0x30, %ecx
jne 0x57bd
movb $0x2e, %al
jmp 0x57b2
movb $0x2c, %al
movzbl %al, %esi
movq %rbx, %rdi
callq 0x31c0
movq -0x50(%rbp), %rax
decl %r14d
jmp 0x578b
cmpl $0x31, %ecx
je 0x57d4
movb $0x3a, %al
cmpl $0x30, %ecx
je 0x57d6
jmp 0x57e1
movb $0x3b, %al
movzbl %al, %esi
movq %rbx, %rdi
callq 0x31c0
leaq 0xfa4(%rip), %rsi       # 0x678c
movq %rbx, %rdi
callq 0x33d0
leaq -0x58(%rbp), %rdi
callq 0x30c0
leaq -0x98(%rbp), %rdi
callq 0x30c0
leaq -0x38(%rbp), %rdi
callq 0x30c0
leaq -0x218(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
leaq -0x78(%rbp), %rdi
jmp 0x5847
movq %rax, %r14
jmp 0x584c
jmp 0x583b
jmp 0x5840
movq %rax, %r14
jmp 0x5858
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x30c0
leaq -0x98(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x30c0
leaq -0x38(%rbp), %rdi
callq 0x30c0
leaq -0x218(%rbp), %rdi
callq 0x30d0
movq %r14, %rdi
callq 0x3390