// File: /workspace/github_c_makefile_star2_O0/hkshenSmart[P]ONVIF-discovery_cs/discovery-nvt.c
// Function: main
int main(int argc, char *argv[])
{
	struct soap soap;
	struct ip_mreq mcast;
	int count=1;
	
	soap_init2(&soap, SOAP_IO_UDP|SOAP_IO_FLUSH, SOAP_IO_UDP|SOAP_IO_FLUSH);
	
    soap_set_namespaces(&soap, namespaces); 
	//soap_set_mode(&soap, SOAP_C_UTFSTRING);
	
	if(!soap_valid_socket(soap_bind(&soap, NULL, 3702, 10)))
	{ 
		soap_print_fault(&soap, stderr);
		exit(1);
	}
	
	mcast.imr_multiaddr.s_addr = inet_addr("239.255.255.250");
	mcast.imr_interface.s_addr = htonl(INADDR_ANY);
	if(setsockopt(soap.master, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mcast, sizeof(mcast)) < 0)
	{
		printf("setsockopt error!\n");
		return 0;
	}	

	for(;;)
	{ 
		printf("Now Accepting requests...waiting\n");
		if(soap_serve(&soap))
			soap_print_fault(&soap, stderr);
	
		soap_destroy(&soap);
		soap_end(&soap);

		printf("�ͻ��˵�IP��ַ��\n");
		printf("Accepted count:%d, connection from IP = %lu.%lu.%lu.%lu socket = %d \r\n",
				count, ((soap.ip)>>24)&0xFF, ((soap.ip)>>16)&0xFF, ((soap.ip)>>8)&0xFF, (soap.ip)&0xFF, (soap.socket));
		count++;
		printf("====================================================================\r\n");

	}
	
	soap_done(&soap);
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x278a0, %rsp          # imm = 0x278A0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x2788c(%rbp)
leaq -0x27880(%rbp), %rdi
movl $0x4, %edx
movl %edx, %esi
callq 0x23280
leaq -0x27880(%rbp), %rdi
leaq 0x40aac(%rip), %rsi     # 0x441e0
callq 0x273f0
leaq -0x27880(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xe76, %edx            # imm = 0xE76
movl $0xa, %ecx
callq 0x1d900
cmpl $-0x1, %eax
jne 0x3778
movq 0x40899(%rip), %rax     # 0x43ff8
movq (%rax), %rsi
leaq -0x27880(%rbp), %rdi
callq 0x37240
movl $0x1, %edi
callq 0x3340
leaq 0x34a4f(%rip), %rdi     # 0x381ce
callq 0x3200
movl %eax, -0x27888(%rbp)
xorl %edi, %edi
callq 0x3190
movl %eax, -0x27884(%rbp)
movl -0x1b750(%rbp), %edi
xorl %esi, %esi
movl $0x23, %edx
leaq -0x27888(%rbp), %rcx
movl $0x8, %r8d
callq 0x30a0
cmpl $0x0, %eax
jge 0x37d4
leaq 0x34a1c(%rip), %rdi     # 0x381de
movb $0x0, %al
callq 0x3150
xorl %eax, %eax
addq $0x278a0, %rsp          # imm = 0x278A0
popq %rbp
retq
jmp 0x37d6
leaq 0x34a14(%rip), %rdi     # 0x381f1
movb $0x0, %al
callq 0x3150
leaq -0x27880(%rbp), %rdi
callq 0x16500
cmpl $0x0, %eax
je 0x380b
movq 0x407fc(%rip), %rax     # 0x43ff8
movq (%rax), %rsi
leaq -0x27880(%rbp), %rdi
callq 0x37240
leaq -0x27880(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x24db0
leaq -0x27880(%rbp), %rdi
callq 0x286a0
leaq 0x349e5(%rip), %rdi     # 0x38213
movb $0x0, %al
callq 0x3150
movl -0x2788c(%rbp), %esi
movq -0x8660(%rbp), %rdx
shrq $0x18, %rdx
andq $0xff, %rdx
movq -0x8660(%rbp), %rcx
shrq $0x10, %rcx
andq $0xff, %rcx
movq -0x8660(%rbp), %r8
shrq $0x8, %r8
andq $0xff, %r8
movq -0x8660(%rbp), %r9
andq $0xff, %r9
movl -0x1b74c(%rbp), %eax
leaq 0x34999(%rip), %rdi     # 0x38225
movl %eax, (%rsp)
movb $0x0, %al
callq 0x3150
movl -0x2788c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2788c(%rbp)
leaq 0x349c0(%rip), %rdi     # 0x3826c
movb $0x0, %al
callq 0x3150
jmp 0x37d6
nopl (%rax,%rax)