// File: billDrett[P]Bulletin-Boards/boardPost.cpp
// Function: BoardPost::sendMessage(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void BoardPost::sendMessage(string message, int Id)
{
    int nwrite;
    char convert[24];
    string name;
    if((nwrite = write(pipeBoardPost2Server, "<Message><start>", 16))== -1) //eisagwgika tag gia message
    {
        perror("Cant write to pipe BP2S");
    }

    sprintf(convert, "%d", Id); //metatrepw to Id se string
    name = "*";
    name.append(convert); //stelnw to chanel mesa se *ID*
    name.append("*");

    if((nwrite = write(pipeBoardPost2Server, name.c_str(), name.size()))== -1) //grafw to chanelID
    {
        perror("Cant write to pipe BP2S");
    }

    if((nwrite = write(pipeBoardPost2Server, message.c_str(), message.size()))== -1) // grafw to message
    {
        perror("Cant write to pipe BP2S");
    }

    if((nwrite = write(pipeBoardPost2Server, "<end><Message>", 14))== -1) //telos message tags
    {
        perror("Cant write to pipe BP2S");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rsi, -0x78(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x2260
movq -0x70(%rbp), %rax
movl (%rax), %edi
leaq 0xfbe(%rip), %rsi       # 0x4096
movl $0x10, %edx
callq 0x20b0
movq %rax, -0x68(%rbp)
jmp 0x30e8
movq -0x68(%rbp), %rax
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
jne 0x311e
leaq 0xfac(%rip), %rdi       # 0x40a7
callq 0x2180
jmp 0x3102
jmp 0x311e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x2150
jmp 0x327f
movl -0x14(%rbp), %edx
leaq 0xf97(%rip), %rsi       # 0x40bf
xorl %eax, %eax
leaq -0x30(%rbp), %rdi
callq 0x2050
leaq 0xf88(%rip), %rsi       # 0x40c2
leaq -0x50(%rbp), %rdi
callq 0x2250
jmp 0x3145
leaq -0x50(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x22c0
jmp 0x3154
leaq 0xf67(%rip), %rsi       # 0x40c2
leaq -0x50(%rbp), %rdi
callq 0x22c0
jmp 0x3166
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x8c(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x98(%rbp)
callq 0x20d0
movq -0x98(%rbp), %rdi
movq %rax, -0x88(%rbp)
callq 0x2160
movl -0x8c(%rbp), %edi
movq -0x88(%rbp), %rsi
movq %rax, %rdx
callq 0x20b0
movq %rax, -0x80(%rbp)
jmp 0x31b0
movq -0x80(%rbp), %rax
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
jne 0x31cc
leaq 0xee4(%rip), %rdi       # 0x40a7
callq 0x2180
jmp 0x31ca
jmp 0x31cc
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xac(%rbp)
callq 0x20d0
movq -0x78(%rbp), %rdi
movq %rax, -0xa8(%rbp)
callq 0x2160
movl -0xac(%rbp), %edi
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
callq 0x20b0
movq %rax, -0xa0(%rbp)
jmp 0x320f
movq -0xa0(%rbp), %rax
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
jne 0x322e
leaq 0xe82(%rip), %rdi       # 0x40a7
callq 0x2180
jmp 0x322c
jmp 0x322e
movq -0x70(%rbp), %rax
movl (%rax), %edi
leaq 0xe89(%rip), %rsi       # 0x40c4
movl $0xe, %edx
callq 0x20b0
movq %rax, -0xb8(%rbp)
jmp 0x324e
movq -0xb8(%rbp), %rax
movl %eax, -0x18(%rbp)
cmpl $-0x1, %eax
jne 0x326d
leaq 0xe43(%rip), %rdi       # 0x40a7
callq 0x2180
jmp 0x326b
jmp 0x326d
leaq -0x50(%rbp), %rdi
callq 0x2150
addq $0xc0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x22a0
nopl (%rax,%rax)