// File: /workspace/github_cpp_makefile_star2_O1/billDrett[P]Bulletin-Boards/boardPost.cpp
// Function: BoardPost::menu(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
int BoardPost::menu(string& line)
{
    string command, msg;
    int id;
    istringstream iss(line);

    iss>> command;
    if(iss.fail())
    {
        cout<<"error command"<<endl;
        cout<<line<<endl;
        return 0;
    }
    if(command == "list")
    {
        cout<<"Available chanels: "<<endl;
        this->getChanels();
    }
    else if(command == "write") //theloume na steiloume mnm me space
    {
        iss >>id >> msg ;
        if(!iss)
        {
            cout<<"error command"<<endl;
        }
        msg.insert(0, " "); //mporei to msg na einai substring tou command gia auto to logo vazoume to space etsi eksasfalizoume oti to find dn tha vrei kapoio substring tou command
        int pos = line.find(msg);
        line.erase(0, pos+1); //thelw na svisw to space pou prosthesa arxika gia auto to kanw pos+1

        this->sendMessage(line, id);
        cout<<"Message send"<<endl;
    }
    else if(command == "send")
    {
        iss >>id >> msg ;
        if(!iss)
        {
            cout<<"error command"<<endl;
        }
        this->sendFile(msg, id);
        cout<<"File send"<<endl;
    }
    else if(command == "exit")
    {
        cout<<"Exit boardPost"<<endl;
        this->exitBoardPost();
        return -1;
    }
    else //error
    {
        cout<<"error"<<endl;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x60(%rbp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb %al, (%r12)
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb %al, (%r13)
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x2230
leaq -0x230(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x21e0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x210(%rbp,%rax)
je 0x34f4
movq 0x2bb7(%rip), %rbx      # 0x5fd0
leaq 0xcfb(%rip), %rsi       # 0x411b
movl $0xd, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2b85(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq 0x2b6a(%rip), %rdi      # 0x5fd0
callq 0x21b0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
xorl %ebx, %ebx
movq 0x2b2a(%rip), %rsi      # 0x5fc8
leaq -0x230(%rbp), %rdi
callq 0x21f0
leaq -0x1b8(%rbp), %rdi
callq 0x2090
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x34cb
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x34e0
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc2e(%rip), %rsi       # 0x4129
leaq -0x70(%rbp), %rdi
callq 0x2070
testl %eax, %eax
je 0x3562
leaq 0xc33(%rip), %rsi       # 0x4142
leaq -0x70(%rbp), %rdi
callq 0x2070
testl %eax, %eax
je 0x35b5
leaq 0xc29(%rip), %rsi       # 0x4150
leaq -0x70(%rbp), %rdi
callq 0x2070
testl %eax, %eax
je 0x3700
leaq 0xc20(%rip), %rsi       # 0x415f
leaq -0x70(%rbp), %rdi
callq 0x2070
testl %eax, %eax
je 0x37ff
movl $0x5, %r14d
leaq 0xc16(%rip), %r15       # 0x4173
jmp 0x37d1
movq 0x2a67(%rip), %r14      # 0x5fd0
leaq 0xbbe(%rip), %rsi       # 0x412e
movl $0x13, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2a35(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x2cd2
jmp 0x3495
leaq -0x230(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20f0
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x21e0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x210(%rbp,%rax)
je 0x362c
movq 0x29e3(%rip), %r15      # 0x5fd0
leaq 0xb27(%rip), %rsi       # 0x411b
movl $0xd, %edx
movq %r15, %rdi
callq 0x21b0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x29b1(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
leaq 0xb0d(%rip), %rcx       # 0x4140
leaq -0x50(%rbp), %rdi
movl $0x1, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x21a0
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq %r14, %rdi
xorl %edx, %edx
callq 0x2240
incl %eax
movslq %eax, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2050
leaq -0xa0(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x2b84
movl -0x2c(%rbp), %edx
leaq -0xb0(%rbp), %rsi
movq %rbx, %rdi
callq 0x2f7e
movq -0xb0(%rbp), %rdi
cmpq %r15, %rdi
je 0x36b5
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
movq 0x2914(%rip), %rbx      # 0x5fd0
leaq 0xa85(%rip), %rsi       # 0x4148
movl $0xc, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x28e2(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
jmp 0x3495
leaq -0x230(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x20f0
leaq -0x50(%rbp), %rsi
movq %rax, %rdi
callq 0x21e0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x210(%rbp,%rax)
je 0x3777
movq 0x2898(%rip), %r14      # 0x5fd0
leaq 0x9dc(%rip), %rsi       # 0x411b
movl $0xd, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2866(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x2b84
movl -0x2c(%rbp), %edx
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x30d4
movq -0x90(%rbp), %rdi
movl $0x9, %r14d
leaq 0x999(%rip), %r15       # 0x4155
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x37d1
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
movq 0x27f8(%rip), %rbx      # 0x5fd0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x21b0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
jmp 0x3482
movq 0x27ca(%rip), %r14      # 0x5fd0
leaq 0x957(%rip), %rsi       # 0x4164
movl $0xe, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x2798(%rip), %rdi      # 0x5fd0
callq 0x2030
movq %rax, %rdi
callq 0x2100
movl (%rbx), %edi
callq 0x2290
movl (%rbx), %edi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x2290
jmp 0x3497
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x38a0
movq -0x80(%rbp), %rsi
jmp 0x388c
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r15, %rdi
je 0x38a0
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
jmp 0x38a0
jmp 0x389d
movq %rax, %rbx
jmp 0x38bf
movq %rax, %rbx
movq 0x2721(%rip), %rsi      # 0x5fc8
leaq -0x230(%rbp), %rdi
callq 0x21f0
leaq -0x1b8(%rbp), %rdi
callq 0x2090
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x38d4
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2180
movq -0x70(%rbp), %rdi
cmpq %r12, %rdi
je 0x38e9
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2180
movq %rbx, %rdi
callq 0x2250