// File: salihbektas[P]Simple-CPU-emulator/cpu.cpp
// Function: CPU::split(int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string CPU::split(int& i, string str)
{
    char temp[100];
    string result;
    int j= 0;
    while(str[i] != ' ' && str[i] != ',' && str[i] != ';' && str[i] != '\n'
            && str[i] != '\t' && str[i] != '\0')
    {
        temp[j] = str[i];
        ++(i);
        ++j;
    }

    temp[j] = '\0';

    result = temp;
    //set index for ignore space and coma and tab
    if(str[i] == ' ' || str[i] == ',' || str[i] == '\t')
    {
        i += 1;
    }
    //if result stay empty fonction call itself
    if(j == 0)
    {
        result = split(i, str);
    }
    return result;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rcx, -0x108(%rbp)
movq %rdi, -0x100(%rbp)
movq %rdi, %rax
movq %rax, -0xf8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf0(%rbp)
movb $0x0, -0x91(%rbp)
callq 0x2190
movl $0x0, -0x98(%rbp)
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x110(%rbp)
jmp 0x9a80
movq -0x110(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x20, %ecx
movb %al, -0x111(%rbp)
je 0x9ba1
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x120(%rbp)
jmp 0x9ab7
movq -0x120(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2c, %ecx
movb %al, -0x111(%rbp)
je 0x9ba1
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x128(%rbp)
jmp 0x9aee
movq -0x128(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3b, %ecx
movb %al, -0x111(%rbp)
je 0x9ba1
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x130(%rbp)
jmp 0x9b25
movq -0x130(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x111(%rbp)
je 0x9ba1
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x138(%rbp)
jmp 0x9b58
movq -0x138(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x111(%rbp)
je 0x9ba1
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x140(%rbp)
jmp 0x9b8b
movq -0x140(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x111(%rbp)
movb -0x111(%rbp), %al
testb $0x1, %al
jne 0x9bad
jmp 0x9c16
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x148(%rbp)
jmp 0x9bc9
movq -0x148(%rbp), %rax
movb (%rax), %cl
movslq -0x98(%rbp), %rax
movb %cl, -0x90(%rbp,%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x9a64
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x9d8f
movq -0x100(%rbp), %rdi
movslq -0x98(%rbp), %rax
movb $0x0, -0x90(%rbp,%rax)
leaq -0x90(%rbp), %rsi
callq 0x2170
jmp 0x9c3a
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x150(%rbp)
jmp 0x9c56
movq -0x150(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x9cbb
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x158(%rbp)
jmp 0x9c81
movq -0x158(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x9cbb
movq -0x108(%rbp), %rdi
movq -0x18(%rbp), %rax
movslq (%rax), %rsi
callq 0x2200
movq %rax, -0x160(%rbp)
jmp 0x9cac
movq -0x160(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
jne 0x9cc6
movq -0x18(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
cmpl $0x0, -0x98(%rbp)
jne 0x9d63
movq -0x108(%rbp), %rsi
movq -0x18(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x2090
jmp 0x9cf3
movq -0x168(%rbp), %rdx
movq -0xf0(%rbp), %rsi
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rcx
callq 0x9a10
jmp 0x9d16
movq -0x100(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x2150
leaq -0xc8(%rbp), %rdi
callq 0x20a0
leaq -0xe8(%rbp), %rdi
callq 0x20a0
jmp 0x9d63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x20a0
jmp 0x9d8f
movb $0x1, -0x91(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x9d7f
movq -0x100(%rbp), %rdi
callq 0x20a0
movq -0xf8(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x100(%rbp), %rdi
callq 0x20a0
movq -0xa0(%rbp), %rdi
callq 0x21d0
nopw (%rax,%rax)