// File: nightmeng[P]net/src/acceptor.cpp
// Function: acceptor::ievent()
void acceptor::ievent(){
	if(!status)
		return;

	int fd;
	while(true){
		std::shared_ptr<struct sockaddr_in> addr(new struct sockaddr_in());
		socklen_t len = sizeof(struct sockaddr_in);

		fd = ::accept(sock, reinterpret_cast<struct sockaddr*>(addr.get()),
				&len);
		
		if(fd > 0){
			singleton<scheduler>::instance()->arrange(std::bind(acb, 0, std::shared_ptr<class socket>(
							new class socket(fd, addr))));
		}
		else{
			if(errno != EAGAIN && errno != ECONNABORTED && errno != EPROTO
					&& errno != EINTR){
				singleton<scheduler>::instance()->arrange(std::bind(acb, errno, nullptr));
				return;
			}
			else{
				return;
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x128(%rbp)
testb $0x1, 0x30(%rax)
jne 0x63e5
jmp 0x676e
jmp 0x63e7
movl $0x10, %edi
callq 0x4210
movq %rax, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
leaq -0x20(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x68c0
movq -0x128(%rbp), %rax
movq -0x138(%rbp), %rdi
movl $0x10, -0x24(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x130(%rbp)
callq 0x68f0
movl -0x130(%rbp), %edi
movq %rax, %rsi
leaq -0x24(%rbp), %rdx
callq 0x40b0
movl %eax, -0x12c(%rbp)
jmp 0x6447
movl -0x12c(%rbp), %eax
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x6613
callq 0x6910
movq %rax, -0x140(%rbp)
jmp 0x6468
movq -0x140(%rbp), %rdi
callq 0x6a00
movq %rax, -0x148(%rbp)
jmp 0x647d
movq -0x128(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x158(%rbp)
movl $0x0, -0x94(%rbp)
movl $0x228, %edi            # imm = 0x228
callq 0x4210
movq %rax, -0x150(%rbp)
jmp 0x64ac
movb $0x1, -0xb9(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x164(%rbp)
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x160(%rbp)
leaq -0x20(%rbp), %rsi
callq 0x6a50
movq -0x150(%rbp), %rdi
movl -0x164(%rbp), %esi
movq -0x160(%rbp), %rdx
callq 0xa620
jmp 0x64ee
movq -0x150(%rbp), %rsi
movb $0x0, -0xb9(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x6a80
jmp 0x650a
movq -0x158(%rbp), %rsi
leaq -0x90(%rbp), %rdi
leaq -0x94(%rbp), %rdx
leaq -0xa8(%rbp), %rcx
callq 0x6a10
jmp 0x652d
leaq -0x58(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x6ab0
jmp 0x653f
movq -0x148(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x8e20
jmp 0x6551
leaq -0x58(%rbp), %rdi
callq 0x6b50
leaq -0x90(%rbp), %rdi
callq 0x6b70
leaq -0xa8(%rbp), %rdi
callq 0x5030
leaq -0xb8(%rbp), %rdi
callq 0x6ba0
jmp 0x673d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6763
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x65eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x65df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x65d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x6b50
leaq -0x90(%rbp), %rdi
callq 0x6b70
leaq -0xa8(%rbp), %rdi
callq 0x5030
leaq -0xb8(%rbp), %rdi
callq 0x6ba0
testb $0x1, -0xb9(%rbp)
jne 0x6602
jmp 0x660e
movq -0x150(%rbp), %rdi
callq 0x41f0
jmp 0x6763
callq 0x4030
cmpl $0xb, (%rax)
je 0x6731
callq 0x4030
cmpl $0x67, (%rax)
je 0x6731
callq 0x4030
cmpl $0x47, (%rax)
je 0x6731
callq 0x4030
cmpl $0x4, (%rax)
je 0x6731
callq 0x6910
movq %rax, -0x170(%rbp)
jmp 0x6659
movq -0x170(%rbp), %rdi
callq 0x6a00
movq %rax, -0x178(%rbp)
jmp 0x666e
movq -0x128(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x180(%rbp)
callq 0x4030
movq -0x180(%rbp), %rsi
movq %rax, %rdx
movq $0x0, -0x118(%rbp)
leaq -0x110(%rbp), %rdi
leaq -0x118(%rbp), %rcx
callq 0x6bc0
jmp 0x66af
leaq -0xe0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x6c00
jmp 0x66c4
movq -0x178(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x8e20
jmp 0x66d9
leaq -0xe0(%rbp), %rdi
callq 0x6b50
leaq -0x110(%rbp), %rdi
callq 0x6ca0
movl $0x1, -0x11c(%rbp)
jmp 0x6747
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x6723
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x6b50
leaq -0x110(%rbp), %rdi
callq 0x6ca0
jmp 0x6763
movl $0x1, -0x11c(%rbp)
jmp 0x6747
movl $0x0, -0x11c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x6ba0
movl -0x11c(%rbp), %eax
testl %eax, %eax
je 0x675e
jmp 0x675c
jmp 0x676e
jmp 0x63e7
leaq -0x20(%rbp), %rdi
callq 0x6ba0
jmp 0x6777
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x4360