// File: /workspace/github_cpp_makefile_star2_O1/yuryu[P]tfoecho/server.cpp
// Function: process_client_socket(int, int)
void process_client_socket(int s, int epollfd)
{
    static std::vector<char> buf(BUFFER_SIZE);
    ssize_t rs;
    while( (rs = recv(s, &buf[0], buf.size(), 0)) != 0 )
    {
        if( rs == -1 )
        {
            if( errno == EINTR ) continue;
            if( errno == EAGAIN || errno == EWOULDBLOCK ) return;
            cerror("recv");
            break;
        }
        ssize_t sent;
        // EAGAIN or EWOULDBLOCK is retuned when the socket buffer is full
        // We should try with another socket for maximum performance, however,
        // we just wait until the buffer becomes available as we don't have
        // enough buffer for that.
        do {
            sent = send(s, &buf[0], rs, 0);
        } while( sent == -1 && 
                 (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) );
        if( sent == -1 )
        {
            cerror("send");
            break;
        }
    }
    if( epoll_ctl(epollfd, EPOLL_CTL_DEL, s, nullptr) == -1 )
        cerror("epoll_ctl: EPOLL_CTL_DEL");
    close(s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
movb 0x2ae9(%rip), %al       # 0x5188
testb %al, %al
je 0x27a8
leaq 0x9aa(%rip), %r14       # 0x3058
movq 0x2abb(%rip), %rsi      # 0x5170
movq 0x2abc(%rip), %rdx      # 0x5178
subq %rsi, %rdx
movl %ebx, %edi
xorl %ecx, %ecx
callq 0x2080
cmpq $-0x1, %rax
je 0x272c
movq %rax, %r15
testq %rax, %rax
je 0x2772
movq 0x2a8f(%rip), %rsi      # 0x5170
movl %ebx, %edi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20f0
cmpq $-0x1, %rax
sete %r13b
jne 0x26ae
callq 0x2040
movq %rax, %r12
movl (%r12), %eax
cmpl $0x4, %eax
je 0x270d
cmpl $0xb, %eax
jne 0x273e
movq 0x2a5c(%rip), %rsi      # 0x5170
movl %ebx, %edi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x20f0
cmpq $-0x1, %rax
sete %r13b
je 0x26ff
jmp 0x26ae
callq 0x2040
movl (%rax), %eax
cmpl $0x4, %eax
je 0x26ae
jmp 0x2752
movq %r14, %rdi
callq 0x2528
testb $0x1, %r13b
je 0x26ae
jmp 0x2772
cmpl $0xb, %eax
jne 0x2766
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e6(%rip), %rdi       # 0x3053
callq 0x2528
movl %ebp, %edi
movl $0x2, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x2200
cmpl $-0x1, %eax
jne 0x2793
leaq 0x8cf(%rip), %rdi       # 0x305d
callq 0x2528
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2280
leaq 0x29d9(%rip), %rdi      # 0x5188
callq 0x2270
testl %eax, %eax
je 0x26a7
xorps %xmm0, %xmm0
movups %xmm0, 0x29aa(%rip)     # 0x5170
movq $0x0, 0x29af(%rip) # 0x5180
movl $0x1000, %edi           # imm = 0x1000
callq 0x2180
movq %rax, 0x298e(%rip)      # 0x5170
leaq 0x2987(%rip), %r14      # 0x5170
movq %rax, 0x2988(%rip)      # 0x5178
movq %rax, %r15
addq $0x1000, %r15           # imm = 0x1000
movq %r15, 0x297f(%rip)      # 0x5180
movl $0x1000, %edx           # imm = 0x1000
movq %rax, %rdi
xorl %esi, %esi
callq 0x2100
movq %r15, 0x2961(%rip)      # 0x5178
leaq 0x1c6(%rip), %rdi       # 0x29e4
leaq 0x292b(%rip), %rdx      # 0x5150
movq %r14, %rsi
callq 0x2150
leaq 0x2954(%rip), %rdi      # 0x5188
callq 0x2120
jmp 0x26a7
movq %rax, %rbx
leaq 0x2940(%rip), %rdi      # 0x5188
callq 0x2110
movq %rbx, %rdi
callq 0x2250