// File: /workspace/github_cpp_makefile_star2_O1/mattdibi[P]Programmatore-JTAG-per-Xilinx/main.cpp
// Function: ExtractBitstream(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, long)
vector<string> ExtractBitstream(vector<string> instructionsFile, long int currentIndex)
{
      vector<string> stream;
      string tmp, tmp2;
      int i = 0, k = 0;

      // Prima riga: ignoro tutto ciò che viene prima delle parentesi
      while(instructionsFile[currentIndex][i] != '(')
      {
            i++;
      }

      i++;

      // Arrivato alla parentesi prendo tutto
      while(instructionsFile[currentIndex][i] != '\n' && instructionsFile[currentIndex][i] != '\r')
      {
            tmp += instructionsFile[currentIndex][i];
            i++;
      }

      stream.push_back(tmp);

      currentIndex++;

      // Immetto righe finchè l'ultimo carattere di una riga è ')' si noti che così viene caricata anche l'SMASK
      while(instructionsFile[currentIndex][instructionsFile[currentIndex].size() - 4] != ')')
      {
            stream.push_back(instructionsFile[currentIndex]);
            currentIndex++;
      }

      // Immetto ultima riga fino al carattere di ')'
      while(instructionsFile[currentIndex][k] != ')')
      {
            tmp2 += instructionsFile[currentIndex][k];
            k++;
      }

      stream.push_back(tmp2);

      return stream;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorl %r13d, %r13d
movq %r13, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r13, -0x8(%rax)
movb %r13b, (%rax)
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq %r13, -0x8(%rax)
movb %r13b, (%rax)
movq (%rsi), %rax
shlq $0x5, %r14
movq (%rax,%r14), %rax
cmpb $0x28, (%rax,%r13)
leaq 0x1(%r13), %r13
jne 0x4dab
leaq -0x68(%rbp), %r12
movq (%r15), %rax
movq (%rax,%r14), %rax
movzbl (%rax,%r13), %eax
cmpl $0xa, %eax
je 0x4de0
cmpl $0xd, %eax
je 0x4de0
incq %r13
movsbl %al, %esi
movq %r12, %rdi
callq 0x31f0
jmp 0x4dba
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x50da
addq $0x20, %r14
movq (%r15), %rsi
movq (%rsi,%r14), %rax
movq 0x8(%rsi,%r14), %rcx
cmpb $0x29, -0x4(%rax,%rcx)
je 0x4e14
addq %r14, %rsi
addq $0x20, %r14
movq %rbx, %rdi
callq 0x50da
jmp 0x4df0
movq (%r15), %rax
movq (%rax,%r14), %rax
movb (%rax), %al
cmpb $0x29, %al
je 0x4e48
movl $0x1, %r13d
leaq -0x48(%rbp), %r12
movsbl %al, %esi
movq %r12, %rdi
callq 0x31f0
movq (%r15), %rax
movq (%rax,%r14), %rax
movb (%rax,%r13), %al
incq %r13
cmpb $0x29, %al
jne 0x4e2b
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x50da
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e6d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4e86
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3250
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e9e
jmp 0x4e9e
jmp 0x4e9e
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4eba
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4ed3
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3250
movq %rbx, %rdi
callq 0x4fce
movq %r14, %rdi
callq 0x33e0