// File: /workspace/github_cpp_makefile_star2_O3/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 0x4d37
leaq -0x68(%rbp), %r12
movq (%r15), %rax
movq (%rax,%r14), %rax
movzbl (%rax,%r13), %eax
cmpl $0xa, %eax
je 0x4d6c
cmpl $0xd, %eax
je 0x4d6c
incq %r13
movsbl %al, %esi
movq %r12, %rdi
callq 0x31f0
jmp 0x4d46
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x5064
addq $0x20, %r14
movq (%r15), %rsi
movq (%rsi,%r14), %rax
movq 0x8(%rsi,%r14), %rcx
cmpb $0x29, -0x4(%rax,%rcx)
je 0x4da0
addq %r14, %rsi
addq $0x20, %r14
movq %rbx, %rdi
callq 0x5064
jmp 0x4d7c
movb (%rax), %al
cmpb $0x29, %al
je 0x4dcd
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 0x4db0
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x5064
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4df2
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4e0b
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 0x4e23
jmp 0x4e23
jmp 0x4e23
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x4e3f
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3250
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x4e58
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x3250
movq %rbx, %rdi
callq 0x4f54
movq %r14, %rdi
callq 0x33d0