// File: metopa[P]HTTP_Server/src/network/CSocketIO.cpp
// Function: CSocketIO::recvData[abi:cxx11]() const
string CSocketIO::recvData() const {
	char buf[1024];
	ssize_t bytesRecvd;
	int errNo;
	string data;

	while ( 1 ) {
		bytesRecvd = recv( sockfd_m, buf, sizeof( buf ), 0 );

		errNo = errno;
		if ( bytesRecvd == 0 )
			break;
		else if ( bytesRecvd < 0 ) {
			if ( errNo == EINTR )
				continue;
			else
				throw SocketReceiverException( "recv()", strerror( errNo ), port_m, sockfd_m );
		}

		data.insert( data.end(), buf, buf + bytesRecvd );

		if ( data.size() >= 4 &&
			 data[data.size() - 4] == 13 &&
			 data[data.size() - 3] == 10 &&
			 data[data.size() - 2] == 13 &&
			 data[data.size() - 1] == 10 )
			break;

		/** An RFC2616 recommendation since someone may want to break the standard.*/
		if ( data.size() >= 2 &&
			 data[data.size() - 2] == 10 &&
			 data[data.size() - 1] == 10 )
			break;


	}

	if ( data.size() == 0 )
		throw EmptyDataException();

	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movq %rdi, -0x4b0(%rbp)
movq %rdi, %rax
movq %rax, -0x4a8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x4a0(%rbp)
movb $0x0, -0x41d(%rbp)
callq 0x6730
jmp 0x2591d
movq -0x4a0(%rbp), %rax
movl (%rax), %edi
leaq -0x410(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x61e0
movq %rax, -0x4b8(%rbp)
jmp 0x25942
movq -0x4b8(%rbp), %rax
movq %rax, -0x418(%rbp)
callq 0x6080
movl (%rax), %eax
movl %eax, -0x41c(%rbp)
cmpq $0x0, -0x418(%rbp)
jne 0x25983
jmp 0x25ce4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x25d5e
cmpq $0x0, -0x418(%rbp)
jge 0x25afc
cmpl $0x4, -0x41c(%rbp)
jne 0x2599f
jmp 0x2591b
movb $0x1, -0x47a(%rbp)
movl $0x50, %edi
callq 0x6280
movq %rax, -0x4c8(%rbp)
leaq -0x451(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x6930
movq -0x4c0(%rbp), %rdx
leaq 0x715c(%rip), %rsi      # 0x2cb34
leaq -0x450(%rbp), %rdi
callq 0xa9d0
jmp 0x259e6
movl -0x41c(%rbp), %edi
callq 0x61f0
movq %rax, -0x4d8(%rbp)
leaq -0x479(%rbp), %rdi
movq %rdi, -0x4d0(%rbp)
callq 0x6930
movq -0x4d8(%rbp), %rsi
movq -0x4d0(%rbp), %rdx
leaq -0x478(%rbp), %rdi
callq 0xa9d0
jmp 0x25a27
movq -0x4c8(%rbp), %rdi
movq -0x4a0(%rbp), %rax
movl (%rax), %r8d
movl 0x4(%rax), %ecx
leaq -0x450(%rbp), %rsi
leaq -0x478(%rbp), %rdx
callq 0x25ed0
jmp 0x25a50
movq -0x4c8(%rbp), %rdi
movb $0x0, -0x47a(%rbp)
leaq 0x18fcb(%rip), %rsi     # 0x3ea30
leaq 0x4b4(%rip), %rdx       # 0x25f20
callq 0x68e0
jmp 0x25d76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x25ad4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
jmp 0x25abc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x428(%rbp)
movl %eax, -0x42c(%rbp)
leaq -0x478(%rbp), %rdi
callq 0x6310
leaq -0x479(%rbp), %rdi
callq 0x6550
leaq -0x450(%rbp), %rdi
callq 0x6310
leaq -0x451(%rbp), %rdi
callq 0x6550
testb $0x1, -0x47a(%rbp)
jne 0x25aeb
jmp 0x25af7
movq -0x4c8(%rbp), %rdi
callq 0x63b0
jmp 0x25d5e
jmp 0x25afe
movq -0x4b0(%rbp), %rdi
callq 0x62f0
movq %rax, -0x490(%rbp)
leaq -0x488(%rbp), %rdi
leaq -0x490(%rbp), %rsi
callq 0x14130
movq -0x4b0(%rbp), %rdi
movq -0x418(%rbp), %rax
leaq -0x410(%rbp,%rax), %rcx
movq -0x488(%rbp), %rsi
leaq -0x410(%rbp), %rdx
callq 0x25f40
movq %rax, -0x4e0(%rbp)
jmp 0x25b56
movq -0x4b0(%rbp), %rdi
movq -0x4e0(%rbp), %rax
movq %rax, -0x498(%rbp)
callq 0x6360
cmpq $0x4, %rax
jb 0x25c5e
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
addq $-0x4, %rsi
callq 0x6a00
movq %rax, -0x4e8(%rbp)
jmp 0x25ba2
movq -0x4e8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x25c5e
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
addq $-0x3, %rsi
callq 0x6a00
movq %rax, -0x4f0(%rbp)
jmp 0x25bdd
movq -0x4f0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x25c5e
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
addq $-0x2, %rsi
callq 0x6a00
movq %rax, -0x4f8(%rbp)
jmp 0x25c14
movq -0x4f8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
jne 0x25c5e
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x6a00
movq %rax, -0x500(%rbp)
jmp 0x25c4a
movq -0x500(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x25c5e
jmp 0x25ce4
movq -0x4b0(%rbp), %rdi
callq 0x6360
cmpq $0x2, %rax
jb 0x25cdf
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
addq $-0x2, %rsi
callq 0x6a00
movq %rax, -0x508(%rbp)
jmp 0x25c98
movq -0x508(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x25cdf
movq -0x4b0(%rbp), %rdi
callq 0x6360
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x6a00
movq %rax, -0x510(%rbp)
jmp 0x25cce
movq -0x510(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x25cdf
jmp 0x25ce4
jmp 0x2591b
movq -0x4b0(%rbp), %rdi
callq 0x6360
cmpq $0x0, %rax
jne 0x25d32
movl $0x8, %edi
callq 0x6280
movq %rax, %rdi
movq %rdi, -0x518(%rbp)
movq $0x0, (%rdi)
callq 0x25fd0
movq -0x518(%rbp), %rdi
leaq 0x18d24(%rip), %rsi     # 0x3ea48
leaq 0x2e5(%rip), %rdx       # 0x26010
callq 0x68e0
jmp 0x25d76
movb $0x1, -0x41d(%rbp)
testb $0x1, -0x41d(%rbp)
jne 0x25d4e
movq -0x4b0(%rbp), %rdi
callq 0x6310
movq -0x4a8(%rbp), %rax
addq $0x520, %rsp            # imm = 0x520
popq %rbp
retq
movq -0x4b0(%rbp), %rdi
callq 0x6310
movq -0x428(%rbp), %rdi
callq 0x6920
nopw %cs:(%rax,%rax)