// File: billDrett[P]Bulletin-Boards/boardServer.cpp
// Function: BoardServer::parser()
void BoardServer::parser()
{
    fd_set set_read, set_copy;
    int maxfd = 0;

    FD_ZERO(&set_read);
    FD_SET(pipeClient2Server, &set_read);
    FD_SET(pipeBoardPost2Server, &set_read);

    if(pipeClient2Server > pipeBoardPost2Server) maxfd = pipeClient2Server;
    else maxfd = pipeBoardPost2Server;

    while(1)
    {
        set_copy = set_read;
        select(maxfd + 1, &set_copy, NULL, NULL, NULL);
        if(FD_ISSET(pipeClient2Server, &set_copy)) //otan einai etoimo diavazw apo to pipe client to server
        {
            if(this->readFromC2S() == false)
            {
                return;
            }
        }
        if(FD_ISSET(pipeBoardPost2Server, &set_copy)) //otan einai etoimo diavazw apo to pipe boardPost to server
        {
            this->readFromBp2S();
        }

    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
movl $0x0, -0x10c(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x0, -0x110(%rbp)
movl -0x110(%rbp), %eax
cmpq $0x10, %rax
jae 0x6a0e
movq -0x118(%rbp), %rax
movl -0x110(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x69dc
jmp 0x6a10
movq -0x120(%rbp), %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x120(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, -0x130(%rbp)
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x130(%rbp), %rdx
movl %eax, %ecx
movq -0x120(%rbp), %rax
movslq %ecx, %rcx
orq -0x88(%rbp,%rcx,8), %rdx
movq %rdx, -0x88(%rbp,%rcx,8)
movl 0x8(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq -0x120(%rbp), %rcx
movq %rax, -0x128(%rbp)
movl 0x8(%rcx), %eax
movl $0x40, %esi
cltd
idivl %esi
movq -0x128(%rbp), %rdx
cltq
orq -0x88(%rbp,%rax,8), %rdx
movq %rdx, -0x88(%rbp,%rax,8)
movl (%rcx), %eax
cmpl 0x8(%rcx), %eax
jle 0x6ac7
movq -0x120(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x10c(%rbp)
jmp 0x6ad7
movq -0x120(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x10c(%rbp)
jmp 0x6ad9
leaq -0x108(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x80, %edx
callq 0x3250
movl -0x10c(%rbp), %edi
addl $0x1, %edi
leaq -0x108(%rbp), %rsi
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rdx
movq %r8, %rcx
callq 0x32b0
movq -0x120(%rbp), %rax
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x120(%rbp), %rax
movslq %ecx, %rcx
movq -0x108(%rbp,%rcx,8), %rcx
movq %rcx, -0x138(%rbp)
movl (%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x138(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6b85
movq -0x120(%rbp), %rdi
callq 0x6bf0
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x6b83
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
jmp 0x6b85
movq -0x120(%rbp), %rax
movl 0x8(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x120(%rbp), %rax
movslq %ecx, %rcx
movq -0x108(%rbp,%rcx,8), %rcx
movq %rcx, -0x140(%rbp)
movl 0x8(%rax), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x140(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x6be6
movq -0x120(%rbp), %rdi
callq 0x7270
jmp 0x6ad9
nopl (%rax,%rax)