// File: Cicko[P]Ram-Machine/Program.cpp
// Function: Program::getTagFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string Program::getTagFromString(string data) {
    string result = "noTag";
    //cout << "Analize string for tag : " << endl << data << endl;
    if (data.find(":") != string::npos) {                                    // If there is a tag
      for (int i = 0; i < data.size(); i++) {
        if (data[i] == ':'){                                              // When we detect Tag
          int it = i;                                                // we create iterator to go backwards
          string tag;
          while(data[--it] == ' ' || data[it] == '\t' || data[it] == ':');                         // until we search any character to save the tag name
          while(data[it] != ' '  &&                                          // then we continue saving characters backwards until we reach space again
                data[it] != '\t' && it >= 0) {                                          // or tabulator.
             //cout << "We push : data[" << it << "] = " << data[it] << endl;
              tag.push_back(data[it--]);
          }
          reverse(tag.rbegin(), tag.rend());
          result = tag;
        }
      }
    }
    return result;

}

// Assembly:
subq $0xf8, %rsp
movq %rdx, 0x70(%rsp)
movq %rdi, 0x80(%rsp)
movq %rdi, %rax
movq %rax, 0x78(%rsp)
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movq %rdx, 0xe0(%rsp)
movb $0x0, 0xdf(%rsp)
leaq 0xde(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x67c0
movq 0x80(%rsp), %rdi
movq 0x88(%rsp), %rdx
leaq 0x310d4(%rip), %rsi     # 0x3a3fc
callq 0x6610
jmp 0x932f
leaq 0xde(%rsp), %rdi
callq 0x64a0
movq 0x70(%rsp), %rdi
leaq 0x3224c(%rip), %rsi     # 0x3b594
xorl %eax, %eax
movl %eax, %edx
callq 0x6850
cmpq $-0x1, %rax
je 0x960d
movl $0x0, 0xc8(%rsp)
movq 0x70(%rsp), %rdi
movslq 0xc8(%rsp), %rax
movq %rax, 0x68(%rsp)
callq 0x6330
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jae 0x960b
movq 0x70(%rsp), %rdi
movslq 0xc8(%rsp), %rsi
callq 0x6860
movq %rax, 0x60(%rsp)
jmp 0x93a7
movq 0x60(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x95f3
movl 0xc8(%rsp), %eax
movl %eax, 0xc4(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x6620
movq 0x70(%rsp), %rdi
movl 0xc4(%rsp), %eax
decl %eax
movl %eax, 0xc4(%rsp)
movslq %eax, %rsi
callq 0x6860
movq %rax, 0x58(%rsp)
jmp 0x93f7
movq 0x58(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, 0x57(%rsp)
je 0x9461
movq 0x70(%rsp), %rdi
movslq 0xc4(%rsp), %rsi
callq 0x6860
movq %rax, 0x48(%rsp)
jmp 0x9423
movq 0x48(%rsp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x9, %ecx
movb %al, 0x57(%rsp)
je 0x9461
movq 0x70(%rsp), %rdi
movslq 0xc4(%rsp), %rsi
callq 0x6860
movq %rax, 0x40(%rsp)
jmp 0x944f
movq 0x40(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
sete %al
movb %al, 0x57(%rsp)
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x946b
jmp 0x94d5
jmp 0x93d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xde(%rsp), %rdi
callq 0x64a0
jmp 0x9646
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
jmp 0x9639
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd0(%rsp)
movl %eax, 0xcc(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x62a0
jmp 0x9639
jmp 0x94d7
movq 0x70(%rsp), %rdi
movslq 0xc4(%rsp), %rsi
callq 0x6860
movq %rax, 0x38(%rsp)
jmp 0x94f0
movq 0x38(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, 0x37(%rsp)
je 0x953e
movq 0x70(%rsp), %rdi
movslq 0xc4(%rsp), %rsi
callq 0x6860
movq %rax, 0x28(%rsp)
jmp 0x951c
movq 0x28(%rsp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, 0x37(%rsp)
je 0x953e
cmpl $0x0, 0xc4(%rsp)
setge %al
movb %al, 0x37(%rsp)
movb 0x37(%rsp), %al
testb $0x1, %al
jne 0x9548
jmp 0x9588
movq 0x70(%rsp), %rdi
movslq 0xc4(%rsp), %rsi
movl %esi, %eax
decl %eax
movl %eax, 0xc4(%rsp)
callq 0x6860
movq %rax, 0x20(%rsp)
jmp 0x956c
movq 0x20(%rsp), %rax
movsbl (%rax), %esi
leaq 0xa0(%rsp), %rdi
callq 0x63b0
jmp 0x9583
jmp 0x94d7
leaq 0x98(%rsp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0xa0(%rsp), %rsi
movq %rsi, 0x8(%rsp)
callq 0x6790
movq 0x8(%rsp), %rsi
leaq 0x90(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x6530
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0xa320
jmp 0x95cf
movq 0x80(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x6060
jmp 0x95e6
leaq 0xa0(%rsp), %rdi
callq 0x62a0
jmp 0x95f5
movl 0xc8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc8(%rsp)
jmp 0x9366
jmp 0x960d
movb $0x1, 0xdf(%rsp)
testb $0x1, 0xdf(%rsp)
jne 0x962c
movq 0x80(%rsp), %rdi
callq 0x62a0
movq 0x78(%rsp), %rax
addq $0xf8, %rsp
retq
movq 0x80(%rsp), %rdi
callq 0x62a0
movq 0xd0(%rsp), %rdi
callq 0x67b0
nopw %cs:(%rax,%rax)