// File: /workspace/github_c_makefile_star2_O2/shifengbin[P]bishe/Output/output.c
// Function: output
void output( char *host , char *body , int type)
{
	char *regexstr = "<tr\\s+logr=[\\d\\D]*?>[\\d\\D]*?</tr>";//get house info
	char *cityreg = "locallist\\\":\\[\\{\\\"dispid\\\":\\\"\\d*\\\",\\\"name\\\":\\\".*?\\\"";//get city
	char *temp = NULL;//temp var
	char *ctmp = NULL;// city temp var
	char cityName[50] ={ 0 };//city name
	regex_t reg;//get house info reg
	regex_t cityr;//get city info reg
	regmatch_t pmatch;//reg return value
	int len = 0;
	
	initDB("house.db");

	if ( type != 2 )
	{
		return;
	}
//	pthread_mutex_lock(&outlock);
	if (regcomp(&reg,regexstr,0)!=0 || regcomp(&cityr,cityreg,0)!=0 )
	{
		puts("comp err");
//		pthread_mutex_unlock(&outlock);
		return;
	}
	temp = body;
	if ( regexec(&cityr,temp,1,&pmatch,0) == REG_NOMATCH )
	{
		//	puts("No City");
		sprintf(cityName,"%s","other");
	}
	else
	{
		temp+=pmatch.rm_so;
		len = pmatch.rm_eo-pmatch.rm_so;
		*(temp+len-1)=0;
		ctmp = temp+len-1;
		while( *ctmp !='\"'&& ctmp > temp )
		{
			ctmp--;
		}
		if ( ctmp == temp )
		{
			sprintf(cityName,"%s","other");
		}
		else
		{
			ctmp++;
			sprintf(cityName,"%s",ctmp);
		}
		//		save(cityName);
		temp+=len+1;
	}

	//	puts(cityName);

	for(;;)
	{
		if (regexec(&reg, temp ,1,&pmatch,0 ) == REG_NOMATCH)
		{
			//			puts("no match");
			break;
		}
		else
		{
			//			puts("match");
			len = pmatch.rm_eo - pmatch.rm_so;
			temp = temp + pmatch.rm_so;
			*(temp+len) = 0;
			save(host, cityName, temp);
			temp+=len+1;
			//	printf("%d\n",len);
		}
	}
	regfree(&reg);
	regfree(&cityr);
//	pthread_mutex_unlock(&outlock);
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
andw $0x0, -0x40(%rbp)
leaq 0x5d3bf(%rip), %rdi     # 0x681fa
callq 0xa170
cmpl $0x2, %r14d
jne 0xae84
leaq 0x5d357(%rip), %rsi     # 0x681a4
leaq -0xd0(%rbp), %rdi
xorl %edx, %edx
callq 0xa7b0
testl %eax, %eax
jne 0xae78
leaq 0x5d360(%rip), %rsi     # 0x681c6
leaq -0xa0(%rbp), %rdi
xorl %edx, %edx
callq 0xa7b0
testl %eax, %eax
je 0xae96
leaq 0x5d384(%rip), %rdi     # 0x68203
callq 0xa120
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
pushq $0x1
popq %rdx
leaq -0x30(%rbp), %rcx
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0xa780
cmpl $0x11, %eax
jne 0xaec3
movw $0x72, -0x6c(%rbp)
movl $0x6568746f, -0x70(%rbp) # imm = 0x6568746F
jmp 0xaf1f
movslq -0x30(%rbp), %rax
addq %rax, %rbx
movslq -0x2c(%rbp), %rdx
movq %rdx, %rcx
subq %rax, %rcx
leaq (%rbx,%rcx), %r14
addq %rbx, %rcx
decq %rcx
movb $0x0, (%rcx)
subq %rdx, %rax
leaq -0x1(%rcx), %rsi
incq %rax
cmpq %rbx, %rcx
jbe 0xaef8
cmpb $0x22, (%rcx)
movq %rsi, %rcx
jne 0xaee4
testq %rax, %rax
je 0xaf0c
addq $0x2, %rsi
leaq -0x70(%rbp), %rdi
callq 0xa0d0
jmp 0xaf19
movw $0x72, -0x6c(%rbp)
movl $0x6568746f, -0x70(%rbp) # imm = 0x6568746F
incq %r14
movq %r14, %rbx
pushq $0x1
popq %r12
leaq -0x30(%rbp), %r13
leaq -0x70(%rbp), %r15
leaq -0xd0(%rbp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa780
cmpl $0x11, %eax
je 0xaf76
movslq -0x2c(%rbp), %rax
movslq -0x30(%rbp), %rcx
subq %rcx, %rax
addq %rcx, %rbx
leaq (%rax,%rbx), %r14
incq %r14
movb $0x0, -0x1(%r14)
movq -0x38(%rbp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0xa240
movq %r14, %rbx
jmp 0xaf2b
leaq -0xd0(%rbp), %rdi
callq 0xa370
leaq -0xa0(%rbp), %rdi
callq 0xa370
jmp 0xae84
nop