// File: mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: hexCharToBin[abi:cxx11](char)
string hexCharToBin(char c)	// Funzione di conversione valore esadecimale in valore binario
{
    switch(toupper(c))
    {
        case '0': return "0000";
        case '1': return "0001";
        case '2': return "0010";
        case '3': return "0011";
        case '4': return "0100";
        case '5': return "0101";
        case '6': return "0110";
        case '7': return "0111";
        case '8': return "1000";
        case '9': return "1001";
        case 'A': return "1010";
        case 'B': return "1011";
        case 'C': return "1100";
        case 'D': return "1101";
        case 'E': return "1110";
        case 'F': return "1111";
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x48(%rbp)
movb %sil, %al
movq %rdi, %rcx
movq %rcx, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movsbl -0x9(%rbp), %edi
callq 0x3510
addl $-0x30, %eax
movl %eax, %ecx
movq %rcx, -0x38(%rbp)
subl $0x16, %eax
ja 0x8e69
movq -0x38(%rbp), %rax
leaq 0x1d92(%rip), %rcx      # 0xa718
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq -0xa(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq 0x1df6(%rip), %rsi      # 0xa7a1
callq 0x54b0
jmp 0x89b2
leaq -0xa(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xa(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x1d(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rdx
leaq 0x1db0(%rip), %rsi      # 0xa7a6
callq 0x54b0
jmp 0x89fd
leaq -0x1d(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x1d(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x1e(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x60(%rbp), %rdx
leaq 0x1d6a(%rip), %rsi      # 0xa7ab
callq 0x54b0
jmp 0x8a48
leaq -0x1e(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x1e(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x1f(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x68(%rbp), %rdx
leaq 0x1d24(%rip), %rsi      # 0xa7b0
callq 0x54b0
jmp 0x8a93
leaq -0x1f(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x1f(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x20(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x70(%rbp), %rdx
leaq 0x1cde(%rip), %rsi      # 0xa7b5
callq 0x54b0
jmp 0x8ade
leaq -0x20(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x21(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x78(%rbp), %rdx
leaq 0x1c98(%rip), %rsi      # 0xa7ba
callq 0x54b0
jmp 0x8b29
leaq -0x21(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x21(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x22(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x80(%rbp), %rdx
leaq 0x1c52(%rip), %rsi      # 0xa7bf
callq 0x54b0
jmp 0x8b74
leaq -0x22(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x22(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x23(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x88(%rbp), %rdx
leaq 0x1c06(%rip), %rsi      # 0xa7c4
callq 0x54b0
jmp 0x8bc5
leaq -0x23(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x23(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x24(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x90(%rbp), %rdx
leaq 0x1bba(%rip), %rsi      # 0xa7c9
callq 0x54b0
jmp 0x8c16
leaq -0x24(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x24(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x25(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0x98(%rbp), %rdx
leaq 0x1b6e(%rip), %rsi      # 0xa7ce
callq 0x54b0
jmp 0x8c67
leaq -0x25(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x25(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x26(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xa0(%rbp), %rdx
leaq 0x1b22(%rip), %rsi      # 0xa7d3
callq 0x54b0
jmp 0x8cb8
leaq -0x26(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x26(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x27(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xa8(%rbp), %rdx
leaq 0x1ad6(%rip), %rsi      # 0xa7d8
callq 0x54b0
jmp 0x8d09
leaq -0x27(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x27(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x28(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xb0(%rbp), %rdx
leaq 0x1a8a(%rip), %rsi      # 0xa7dd
callq 0x54b0
jmp 0x8d5a
leaq -0x28(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x29(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xb8(%rbp), %rdx
leaq 0x1a3e(%rip), %rsi      # 0xa7e2
callq 0x54b0
jmp 0x8dab
leaq -0x29(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x2a(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xc0(%rbp), %rdx
leaq 0x19f2(%rip), %rsi      # 0xa7e7
callq 0x54b0
jmp 0x8dfc
leaq -0x2a(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
leaq -0x2b(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x34b0
movq -0x48(%rbp), %rdi
movq -0xc8(%rbp), %rdx
leaq 0x19ac(%rip), %rsi      # 0xa7ec
callq 0x54b0
jmp 0x8e47
leaq -0x2b(%rbp), %rdi
callq 0x32e0
jmp 0x8e6b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x2b(%rbp), %rdi
callq 0x32e0
jmp 0x8e78
ud2
movq -0x40(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x34a0
nopw %cs:(%rax,%rax)