// File: /workspace/github_c_makefile_star2_O3/shifengbin[P]bishe/Output/output.c
// Function: save
void save(char *host,char *cityName ,  char  *body)
{


	regex_t reg;
	regex_t titlereg;
	regex_t xiaoqureg;
	regex_t pricereg;
	regex_t showroomreg;

	regmatch_t pmatch;
	char *href = "href=\\\"http.*?\\\"";//get info url reg
	char *title = "<a.*?onclick.*?>.*?</a>";
	char *xiaoqu = "<a href.*?class=\\\"a_xq1\\\">.*?</a>";
	char *price = "<b\\sclass=\'pri\'>.*?</b>";
	char *showroom="<span\\sclass=\\\"showroom\\\">.*?</span>";

	char ref[1024] = { 0 };
	char t_title[512] = { 0 };
	char t_xiaoqu[255] = { 0 };
	char t_price[16] = { 0 };
	char t_showroom[32] = { 0 };

	char *temp = body;
	char *ti;

	int len = 0;
	if ( body == NULL || strlen(body) == 0 )
	{
		return;
	}

	if ( regcomp(&reg , href , 0) !=0 || regcomp( &titlereg , title , 0)!=0||regcomp(&xiaoqureg, xiaoqu ,0) != 0 || regcomp( &pricereg ,price,0)!= 0||regcomp(&showroomreg,showroom,0) != 0)
	{
		return;
	}
	// get info url
	if ( regexec( &reg , body , 1, &pmatch,0) == REG_NOMATCH )
	{
		return;
	}

	len = pmatch.rm_eo - pmatch.rm_so;
	temp+=pmatch.rm_so;
	*(temp+len-1) = 0;	
	sprintf(ref , "%s",temp+6);
	temp+=len;
	// get title
	if ( regexec( &titlereg,temp,1,&pmatch, 0 ) == REG_NOMATCH )
	{
		return;
	}
	len = pmatch.rm_eo - pmatch.rm_so;
	temp+=pmatch.rm_so;
	if ( (ti = strstr(temp , ">")) == NULL)
	{
		return;
	}
	ti++;
	*(temp+len-4) = 0;	
	sprintf(t_title , "%s",ti);
	temp+=len;
	// get xiaoqu	
	if ( regexec( &xiaoqureg,temp,1,&pmatch, 0 ) == REG_NOMATCH )
	{
		return;
	}
	len = pmatch.rm_eo - pmatch.rm_so;
	temp+=pmatch.rm_so;
	if ( (ti = strstr(temp , ">")) == NULL)
	{
		return;
	}
	ti++;
	*(temp+len-4) = 0;	
	sprintf(t_xiaoqu , "%s",ti);
	temp+=len;
	//get price
	if ( regexec( &pricereg,temp,1,&pmatch, 0 ) == REG_NOMATCH )
	{
		return;
	}
	len = pmatch.rm_eo - pmatch.rm_so;
	temp+=pmatch.rm_so;
	if ( (ti = strstr(temp , ">")) == NULL)
	{
		return;
	}
	ti++;
	*(temp+len-4) = 0;	
	sprintf(t_price , "%s",ti);
	temp+=len;
	//get showroom
	if ( regexec( &showroomreg,temp,1,&pmatch, 0 ) == REG_NOMATCH )
	{
		return;
	}
	len = pmatch.rm_eo - pmatch.rm_so;
	temp+=pmatch.rm_so;
	if ( (ti = strstr(temp , ">")) == NULL)
	{
		return;
	}
	ti++;
	*(temp+len-7) = 0;	
	sprintf(t_showroom , "%s",ti);
	temp+=len;
	///////////////////////
	puts(host);
	puts(cityName);
	puts(ref);	
	puts(t_title);
	puts(t_xiaoqu);
	puts(t_price);
	puts(t_showroom);
	saveToDB(t_title,cityName,t_xiaoqu,t_showroom,t_price,ref,host);
	//////////////////////
	regfree(&reg);
	regfree(&titlereg);
	regfree(&xiaoqureg);
	regfree(&pricereg);
	regfree(&showroomreg);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x838, %rsp            # imm = 0x838
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x850(%rbp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0xa220
leaq -0x450(%rbp), %rdi
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0xa220
leaq -0x250(%rbp), %rdi
movl $0xff, %edx
xorl %esi, %esi
callq 0xa220
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
testq %r15, %r15
je 0xac09
cmpb $0x0, (%r15)
je 0xac09
leaq 0x6c81e(%rip), %rsi     # 0x7711c
leaq -0x150(%rbp), %rdi
xorl %edx, %edx
callq 0xa5d0
testl %eax, %eax
jne 0xac09
leaq 0x6c812(%rip), %rsi     # 0x7712d
leaq -0x120(%rbp), %rdi
xorl %edx, %edx
callq 0xa5d0
testl %eax, %eax
jne 0xac09
leaq 0x6c80d(%rip), %rsi     # 0x77145
leaq -0xf0(%rbp), %rdi
xorl %edx, %edx
callq 0xa5d0
testl %eax, %eax
jne 0xac09
leaq 0x6c812(%rip), %rsi     # 0x77167
leaq -0xc0(%rbp), %rdi
xorl %edx, %edx
callq 0xa5d0
testl %eax, %eax
jne 0xac09
leaq 0x6c80d(%rip), %rsi     # 0x7717f
leaq -0x90(%rbp), %rdi
xorl %edx, %edx
callq 0xa5d0
testl %eax, %eax
jne 0xac09
leaq -0x150(%rbp), %rdi
leaq -0x30(%rbp), %rcx
movl $0x1, %edx
movq %r15, %rsi
xorl %r8d, %r8d
callq 0xa5b0
cmpl $0x11, %eax
je 0xac09
leaq -0x30(%rbp), %r13
movslq 0x4(%r13), %rax
movslq (%r13), %rcx
subq %rcx, %rax
leaq (%r15,%rcx), %rdx
leaq (%rdx,%rax), %r12
movb $0x0, -0x1(%rax,%rdx)
leaq (%r15,%rcx), %rsi
addq $0x6, %rsi
leaq -0x850(%rbp), %rdi
callq 0xa0d0
leaq -0x120(%rbp), %rdi
movl $0x1, %edx
movq %r12, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa5b0
cmpl $0x11, %eax
je 0xac09
movslq -0x30(%rbp), %r15
addq %r15, %r12
movq %r12, %rdi
movl $0x3e, %esi
callq 0xa1a0
testq %rax, %rax
je 0xac09
movslq 0x4(%r13), %rcx
subq %r15, %rcx
incq %rax
leaq (%r12,%rcx), %r15
movb $0x0, -0x4(%r12,%rcx)
leaq -0x450(%rbp), %rdi
movq %rax, %rsi
callq 0xa0d0
leaq -0xf0(%rbp), %rdi
movl $0x1, %edx
movq %r15, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa5b0
cmpl $0x11, %eax
je 0xac09
movslq -0x30(%rbp), %r12
addq %r12, %r15
movq %r15, %rdi
movl $0x3e, %esi
callq 0xa1a0
testq %rax, %rax
je 0xac09
movslq 0x4(%r13), %rcx
subq %r12, %rcx
incq %rax
leaq (%r15,%rcx), %r12
movb $0x0, -0x4(%r15,%rcx)
leaq -0x250(%rbp), %rdi
movq %rax, %rsi
callq 0xa0d0
leaq -0xc0(%rbp), %rdi
movl $0x1, %edx
movq %r12, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa5b0
cmpl $0x11, %eax
je 0xac09
movslq -0x30(%rbp), %r15
addq %r15, %r12
movq %r12, %rdi
movl $0x3e, %esi
callq 0xa1a0
testq %rax, %rax
je 0xac09
movslq 0x4(%r13), %rcx
subq %r15, %rcx
incq %rax
leaq (%r12,%rcx), %r15
movb $0x0, -0x4(%r12,%rcx)
leaq -0x40(%rbp), %rdi
movq %rax, %rsi
callq 0xa0d0
leaq -0x90(%rbp), %rdi
movl $0x1, %edx
movq %r15, %rsi
movq %r13, %rcx
xorl %r8d, %r8d
callq 0xa5b0
cmpl $0x11, %eax
je 0xac09
movslq -0x30(%rbp), %r12
addq %r12, %r15
movq %r15, %rdi
movl $0x3e, %esi
callq 0xa1a0
testq %rax, %rax
je 0xac09
movslq -0x2c(%rbp), %rcx
subq %r12, %rcx
incq %rax
movb $0x0, -0x7(%r15,%rcx)
leaq -0x60(%rbp), %rdi
movq %rax, %rsi
callq 0xa0d0
movq %r14, %rdi
callq 0xa110
movq %rbx, %rdi
callq 0xa110
leaq -0x850(%rbp), %rdi
callq 0xa110
leaq -0x450(%rbp), %r13
movq %r13, %rdi
callq 0xa110
leaq -0x250(%rbp), %r12
movq %r12, %rdi
callq 0xa110
leaq -0x40(%rbp), %r15
movq %r15, %rdi
callq 0xa110
leaq -0x60(%rbp), %rdi
callq 0xa110
movq %r14, (%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, %rdx
leaq -0x60(%rbp), %rcx
movq %r15, %r8
leaq -0x850(%rbp), %r9
callq 0xa240
leaq -0x150(%rbp), %rdi
callq 0xa2f0
leaq -0x120(%rbp), %rdi
callq 0xa2f0
leaq -0xf0(%rbp), %rdi
callq 0xa2f0
leaq -0xc0(%rbp), %rdi
callq 0xa2f0
leaq -0x90(%rbp), %rdi
callq 0xa2f0
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq