// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::rspntrip_c(bamboo::ntrip_t*, char*)
static int rspntrip_c(ntrip_t *ntrip, char *msg)
	{
		int i;
		char *p, *q;

		tracet(3, "rspntrip_c: state=%d nb=%d\n", ntrip->state, ntrip->nb);
		ntrip->buff[ntrip->nb] = '0';
		tracet(5, "rspntrip_c: n=%d buff=\n%s\n", ntrip->nb, ntrip->buff);

		if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_OK_CLI))) { /* ok */
			q = (char *)ntrip->buff;
			p += strlen(NTRIP_RSP_OK_CLI);
			ntrip->nb -= p - q;
			for (i = 0; i < ntrip->nb; i++) *q++ = *p++;
			ntrip->state = 2;
			sprintf(msg, "%s/%s", ntrip->tcp->svr.saddr, ntrip->mntpnt);
			tracet(2, "rspntrip_c: response ok nb=%d\n", ntrip->nb);
			return 1;
		}
		if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_SRCTBL))) { /* source table */
			if (!*ntrip->mntpnt) { /* source table request */
				ntrip->state = 2;
				sprintf(msg, "source table received");
				tracet(2, "rspntrip_c: receive source table nb=%d\n", ntrip->nb);
				return 1;
			}
			sprintf(msg, "no mountp. reconnect...");
			tracet(2, "rspntrip_c: no mount point nb=%d\n", ntrip->nb);
			ntrip->nb = 0;
			ntrip->buff[0] = '\0';
			ntrip->state = 0;
			discontcp(&ntrip->tcp->svr, ntrip->tcp->tirecon);
		}
		else if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_HTTP))) { /* http response */
			if ((q = strchr(p, '\r'))) *q = '\0'; else ntrip->buff[128] = '\0';
			strcpy(msg, p);
			tracet(1, "rspntrip_s: %s nb=%d\n", msg, ntrip->nb);
			ntrip->nb = 0;
			ntrip->buff[0] = '\0';
			ntrip->state = 0;
			discontcp(&ntrip->tcp->svr, ntrip->tcp->tirecon);
		}
		else if (ntrip->nb >= NTRIP_MAXRSP) { /* buffer overflow */
			sprintf(msg, "response overflow");
			tracet(1, "rspntrip_s: response overflow nb=%d\n", ntrip->nb);
			ntrip->nb = 0;
			ntrip->buff[0] = '\0';
			ntrip->state = 0;
			discontcp(&ntrip->tcp->svr, ntrip->tcp->tirecon);
		}
		tracet(5, "rspntrip_c: exit state=%d nb=%d\n", ntrip->state, ntrip->nb);
		return 0;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movl $0x3, %edi
leaq 0x237b2(%rip), %rsi     # 0xc98cb
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq 0x8(%rcx), %rcx
movb $0x30, 0x50c(%rax,%rcx)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x10(%rbp), %rcx
addq $0x50c, %rcx            # imm = 0x50C
movl $0x5, %edi
leaq 0x23795(%rip), %rsi     # 0xc98e7
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
addq $0x50c, %rdi            # imm = 0x50C
leaq 0x23797(%rip), %rsi     # 0xc9902
callq 0x91b0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xa624d
movq -0x10(%rbp), %rax
addq $0x50c, %rax            # imm = 0x50C
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
addq $0xc, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rax
subq %rax, %rdx
movq -0x10(%rbp), %rax
movslq 0x8(%rax), %rcx
subq %rdx, %rcx
movl %ecx, 0x8(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0xa61f1
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa61b8
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rdx
addq $0x4, %rdx
movq -0x10(%rbp), %rcx
addq $0x10c, %rcx            # imm = 0x10C
leaq 0x179e4(%rip), %rsi     # 0xbdc04
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x2, %edi
leaq 0x236d5(%rip), %rsi     # 0xc990f
movb $0x0, %al
callq 0x95890
movl $0x1, -0x4(%rbp)
jmp 0xa6497
movq -0x10(%rbp), %rdi
addq $0x50c, %rdi            # imm = 0x50C
leaq 0x236cf(%rip), %rsi     # 0xc992e
callq 0x91b0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xa6333
movq -0x10(%rbp), %rax
cmpb $0x0, 0x10c(%rax)
jne 0xa62c1
movq -0x10(%rbp), %rax
movl $0x2, (%rax)
movq -0x18(%rbp), %rdi
leaq 0x236af(%rip), %rsi     # 0xc9943
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x2, %edi
leaq 0x236ab(%rip), %rsi     # 0xc9959
movb $0x0, %al
callq 0x95890
movl $0x1, -0x4(%rbp)
jmp 0xa6497
movq -0x18(%rbp), %rdi
leaq 0x236b5(%rip), %rsi     # 0xc9981
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x2, %edi
leaq 0x236b3(%rip), %rsi     # 0xc9999
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x50c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rax
movl 0x12c(%rax), %esi
callq 0xa4dd0
jmp 0xa6470
movq -0x10(%rbp), %rdi
addq $0x50c, %rdi            # imm = 0x50C
leaq 0x23676(%rip), %rsi     # 0xc99bb
callq 0x91b0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xa63f2
movq -0x28(%rbp), %rdi
movl $0xd, %esi
callq 0x9280
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xa6379
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
jmp 0xa6384
movq -0x10(%rbp), %rax
movb $0x0, 0x58c(%rax)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x96f0
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movl $0x1, %edi
leaq 0x234b5(%rip), %rsi     # 0xc985d
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x50c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rax
movl 0x12c(%rax), %esi
callq 0xa4dd0
jmp 0xa646e
movq -0x10(%rbp), %rax
cmpl $0x8000, 0x8(%rax)      # imm = 0x8000
jl 0xa646c
movq -0x18(%rbp), %rdi
leaq 0x23469(%rip), %rsi     # 0xc9873
movb $0x0, %al
callq 0x9150
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x1, %edi
leaq 0x23461(%rip), %rsi     # 0xc9885
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x50c(%rax)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x8510(%rax), %rax
movl 0x12c(%rax), %esi
callq 0xa4dd0
jmp 0xa646e
jmp 0xa6470
movq -0x10(%rbp), %rax
movl (%rax), %edx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movl $0x5, %edi
leaq 0x23538(%rip), %rsi     # 0xc99c1
movb $0x0, %al
callq 0x95890
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq