// File: nightmeng[P]net/examples/echo/client.cpp
// Function: main
int main(){
	socket sock;

	if(!sock.connect("localhost", 1234)){
		std::cout << "connect failed!" << std::endl;
		return -1;
	}
	std::cout << "connect successfully" << std::endl;

	std::string msg;
	while(true){
		std::cout << "[send]: ";
		std::cin >> msg;

		sock.sync_write(msg.c_str(), msg.size());

		char buff[2049] = {0};
		sock.sync_read(buff, 2048);

		std::cout << "[recv]: " << buff << std::endl;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xae0, %rsp            # imm = 0xAE0
movl $0x0, -0x4(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3840
leaq -0x251(%rbp), %rdi
movq %rdi, -0xa98(%rbp)
callq 0x3350
movq -0xa98(%rbp), %rdx
leaq 0xfa35(%rip), %rsi      # 0x13004
leaq -0x250(%rbp), %rdi
callq 0x3260
jmp 0x35dd
leaq -0x230(%rbp), %rdi
leaq -0x250(%rbp), %rsi
movl $0x4d2, %edx            # imm = 0x4D2
callq 0x4240
movb %al, -0xa99(%rbp)
jmp 0x35fd
movb -0xa99(%rbp), %al
xorb $-0x1, %al
movb %al, -0xa9a(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3140
leaq -0x251(%rbp), %rdi
callq 0x3220
movb -0xa9a(%rbp), %al
testb $0x1, %al
jne 0x3632
jmp 0x36dc
movq 0x1b997(%rip), %rdi     # 0x1efd0
leaq 0xf9ce(%rip), %rsi      # 0x1300e
callq 0x31f0
movq %rax, -0xaa8(%rbp)
jmp 0x364e
movq -0xaa8(%rbp), %rdi
movq 0x1b954(%rip), %rsi     # 0x1efb0
callq 0x3210
jmp 0x3663
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
leaq -0x230(%rbp), %rdi
callq 0x4030
movl -0x4(%rbp), %eax
addq $0xae0, %rsp            # imm = 0xAE0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x260(%rbp)
movl %eax, -0x264(%rbp)
jmp 0x36b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x260(%rbp)
movl %eax, -0x264(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x3140
leaq -0x251(%rbp), %rdi
callq 0x3220
jmp 0x3827
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x260(%rbp)
movl %eax, -0x264(%rbp)
jmp 0x3827
movq 0x1b8ed(%rip), %rdi     # 0x1efd0
leaq 0xf934(%rip), %rsi      # 0x1301e
callq 0x31f0
movq %rax, -0xab0(%rbp)
jmp 0x36f8
movq -0xab0(%rbp), %rdi
movq 0x1b8aa(%rip), %rsi     # 0x1efb0
callq 0x3210
jmp 0x370d
leaq -0x288(%rbp), %rdi
callq 0x3280
jmp 0x371b
movq 0x1b8ae(%rip), %rdi     # 0x1efd0
leaq 0xf90a(%rip), %rsi      # 0x13033
callq 0x31f0
jmp 0x3730
movq 0x1b8a9(%rip), %rdi     # 0x1efe0
leaq -0x288(%rbp), %rsi
callq 0x3240
jmp 0x3745
leaq -0x288(%rbp), %rdi
movq %rdi, -0xac0(%rbp)
callq 0x30e0
movq -0xac0(%rbp), %rdi
movq %rax, -0xab8(%rbp)
callq 0x3160
movq -0xab8(%rbp), %rsi
movq %rax, %rdx
leaq -0x230(%rbp), %rdi
callq 0x4b30
jmp 0x3783
leaq -0xa90(%rbp), %rdi
movq %rdi, -0xac8(%rbp)
xorl %esi, %esi
movl $0x801, %edx            # imm = 0x801
callq 0x3120
movq -0xac8(%rbp), %rsi
leaq -0x230(%rbp), %rdi
movl $0x800, %edx            # imm = 0x800
callq 0x4e40
jmp 0x37b7
movq 0x1b812(%rip), %rdi     # 0x1efd0
leaq 0xf877(%rip), %rsi      # 0x1303c
callq 0x31f0
movq %rax, -0xad0(%rbp)
jmp 0x37d3
movq -0xad0(%rbp), %rdi
leaq -0xa90(%rbp), %rsi
callq 0x31f0
movq %rax, -0xad8(%rbp)
jmp 0x37ef
movq -0xad8(%rbp), %rdi
movq 0x1b7b3(%rip), %rsi     # 0x1efb0
callq 0x3210
jmp 0x3804
jmp 0x3719
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x260(%rbp)
movl %eax, -0x264(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x3140
leaq -0x230(%rbp), %rdi
callq 0x4030
movq -0x260(%rbp), %rdi
callq 0x3340
nop