// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::rsp_ntripc_s(bamboo::ntripc_t*, int)
static void rsp_ntripc_s(ntripc_t *ntripc, int i)
	{
		const char *rsp1 = NTRIP_RSP_ERR_MNTP, *rsp2 = NTRIP_RSP_ERR_PWD;
		const char *rsp3 = NTRIP_RSP_OK_CLI;
		ntripc_con_t *con = ntripc->con + i;
		char passwd[256] = "", mntpnt[256] = "", str[NTRIP_MAXSTR] = "", *p, *q;
		int j, n;

		tracet(3, "rspntripc_s i=%d\n", i);
		con->buff[con->nb] = '\0';
		tracet(5, "rsp_ntripc_s: n=%d,buff=\n%s\n", con->nb, con->buff);

		if (con->nb >= NTRIP_MAXRSP - 1) { /* buffer overflow */
			tracet(1, "rspntripc_s: request buffer overflow\n");
			discon_ntripc(ntripc, i);
			return;
		}
		/* test SOURCE and Source-Agent */
		if (!(p = strstr((char *)con->buff, "SOURCE")) || !(q = strstr(p, "\r\n")) ||
			!(q = strstr(q, "Source-Agent:")) || !strstr(q, "\r\n\r\n")) {
			tracet(2, "rsp_ntripc_s: NTRIP request error\n");
			discon_ntripc(ntripc, i);
			return;
		}
		sscanf(p, "SOURCE %255s %255s", passwd, mntpnt);

		if ((p = strstr((char *)con->buff, "STR: ")) && (q = strstr(p, "\r\n"))) {
			n = MIN(q - (p + 5), 255);
			strncpy(str, p + 5, n);
			str[n] = '\0';
		}
		/* test mountpoint */
		if (!*mntpnt || !test_mntpnt(ntripc, mntpnt)) {
			tracet(2, "rsp_ntripc_s: no mountpoint\n");
			send_nb(ntripc->tcp->cli[i].sock, (unsigned char *)rsp1, strlen(rsp1));
			discon_ntripc(ntripc, i);
			return;
		}
		/* test password */
		if (*ntripc->passwd&&strcmp(passwd, ntripc->passwd)) {
			tracet(2, "rsp_ntripc_s: bad password %s\n", passwd);
			send_nb(ntripc->tcp->cli[i].sock, (unsigned char *)rsp2, strlen(rsp2));
			discon_ntripc(ntripc, i);
			return;
		}
		/* test mountpoint busy */
		for (j = 0; j < MAXCLI; j++) {
			if (ntripc->con[j].state && !strcmp(mntpnt, ntripc->con[j].mntpnt)) {
				tracet(2, "rsp_ntripc_s: bad password %s\n", passwd);
				send_nb(ntripc->tcp->cli[i].sock, (unsigned char *)rsp1, strlen(rsp1));
				discon_ntripc(ntripc, i);
				return;
			}
		}
		/* send OK response */
		send_nb(ntripc->tcp->cli[i].sock, (unsigned char *)rsp3, strlen(rsp3));

		con->state = 1;
		con->msgid = MSG_NOTUSE;
		strcpy(con->mntpnt, mntpnt);
		strcpy(con->str, str);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq 0x22dec(%rip), %rax     # 0xc9bf5
movq %rax, -0x18(%rbp)
leaq 0x22dfa(%rip), %rax     # 0xc9c0e
movq %rax, -0x20(%rbp)
leaq 0x22ae3(%rip), %rax     # 0xc9902
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0xc(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
movq %rax, -0x30(%rbp)
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x93d0
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x93d0
leaq -0x330(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x93d0
movl -0xc(%rbp), %edx
movl $0x3, %edi
leaq 0x22d9d(%rip), %rsi     # 0xc9c24
movb $0x0, %al
callq 0x95890
movq -0x30(%rbp), %rax
movq -0x30(%rbp), %rcx
movslq 0x204(%rcx), %rcx
movb $0x0, 0x208(%rax,%rcx)
movq -0x30(%rbp), %rax
movl 0x204(%rax), %edx
movq -0x30(%rbp), %rcx
addq $0x208, %rcx            # imm = 0x208
movl $0x5, %edi
leaq 0x22d70(%rip), %rsi     # 0xc9c36
movb $0x0, %al
callq 0x95890
movq -0x30(%rbp), %rax
cmpl $0x7fff, 0x204(%rax)    # imm = 0x7FFF
jl 0xa6f01
movl $0x1, %edi
leaq 0x22d6a(%rip), %rsi     # 0xc9c53
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa6820
jmp 0xa736d
movq -0x30(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
leaq 0x22d66(%rip), %rsi     # 0xc9c79
callq 0x91b0
movq %rax, -0x338(%rbp)
cmpq $0x0, %rax
je 0xa6f7e
movq -0x338(%rbp), %rdi
leaq 0x22cbf(%rip), %rsi     # 0xc9bf2
callq 0x91b0
movq %rax, -0x340(%rbp)
cmpq $0x0, %rax
je 0xa6f7e
movq -0x340(%rbp), %rdi
leaq 0x22d2d(%rip), %rsi     # 0xc9c80
callq 0x91b0
movq %rax, -0x340(%rbp)
cmpq $0x0, %rax
je 0xa6f7e
movq -0x340(%rbp), %rdi
leaq 0x22c7d(%rip), %rsi     # 0xc9bf0
callq 0x91b0
cmpq $0x0, %rax
jne 0xa6fa2
movl $0x2, %edi
leaq 0x22d04(%rip), %rsi     # 0xc9c8e
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa6820
jmp 0xa736d
movq -0x338(%rbp), %rdi
leaq -0x130(%rbp), %rdx
leaq -0x230(%rbp), %rcx
leaq 0x22cf3(%rip), %rsi     # 0xc9cb1
movb $0x0, %al
callq 0x9750
movq -0x30(%rbp), %rdi
addq $0x208, %rdi            # imm = 0x208
leaq 0x22ced(%rip), %rsi     # 0xc9cc4
callq 0x91b0
movq %rax, -0x338(%rbp)
cmpq $0x0, %rax
je 0xa7094
movq -0x338(%rbp), %rdi
leaq 0x22bf7(%rip), %rsi     # 0xc9bf2
callq 0x91b0
movq %rax, -0x340(%rbp)
cmpq $0x0, %rax
je 0xa7094
movq -0x340(%rbp), %rax
movq -0x338(%rbp), %rcx
addq $0x5, %rcx
subq %rcx, %rax
cmpq $0xff, %rax
jge 0xa704c
movq -0x340(%rbp), %rax
movq -0x338(%rbp), %rcx
addq $0x5, %rcx
subq %rcx, %rax
movq %rax, -0x350(%rbp)
jmp 0xa705a
movl $0xff, %eax
movq %rax, -0x350(%rbp)
jmp 0xa705a
movq -0x350(%rbp), %rax
movl %eax, -0x348(%rbp)
leaq -0x330(%rbp), %rdi
movq -0x338(%rbp), %rsi
addq $0x5, %rsi
movslq -0x348(%rbp), %rdx
callq 0x93b0
movslq -0x348(%rbp), %rax
movb $0x0, -0x330(%rbp,%rax)
cmpb $0x0, -0x230(%rbp)
je 0xa70b2
movq -0x8(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0xa7380
cmpl $0x0, %eax
jne 0xa7129
movl $0x2, %edi
leaq 0x22c0c(%rip), %rsi     # 0xc9cca
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0xc(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %eax
movl %eax, -0x35c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x358(%rbp)
movq -0x18(%rbp), %rdi
callq 0x92e0
movl -0x35c(%rbp), %edi
movq -0x358(%rbp), %rsi
movl %eax, %edx
callq 0xa76b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa6820
jmp 0xa736d
movq -0x8(%rbp), %rax
cmpb $0x0, 0x208(%rax)
je 0xa71d4
leaq -0x130(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x208, %rsi            # imm = 0x208
callq 0x9a60
cmpl $0x0, %eax
je 0xa71d4
leaq -0x130(%rbp), %rdx
movl $0x2, %edi
leaq 0x22b7e(%rip), %rsi     # 0xc9ce7
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0xc(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %eax
movl %eax, -0x36c(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x368(%rbp)
movq -0x20(%rbp), %rdi
callq 0x92e0
movl -0x36c(%rbp), %edi
movq -0x368(%rbp), %rsi
movl %eax, %edx
callq 0xa76b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa6820
jmp 0xa736d
movl $0x0, -0x344(%rbp)
cmpl $0x100, -0x344(%rbp)    # imm = 0x100
jge 0xa72d7
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x344(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0xa72c1
leaq -0x230(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x340, %rsi            # imm = 0x340
movslq -0x344(%rbp), %rax
imulq $0x820c, %rax, %rax     # imm = 0x820C
addq %rax, %rsi
addq $0x4, %rsi
callq 0x9a60
cmpl $0x0, %eax
jne 0xa72c1
leaq -0x130(%rbp), %rdx
movl $0x2, %edi
leaq 0x22a91(%rip), %rsi     # 0xc9ce7
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0xc(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %eax
movl %eax, -0x37c(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x378(%rbp)
movq -0x18(%rbp), %rdi
callq 0x92e0
movl -0x37c(%rbp), %edi
movq -0x378(%rbp), %rsi
movl %eax, %edx
callq 0xa76b0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xa6820
jmp 0xa736d
jmp 0xa72c3
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
jmp 0xa71de
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0xc(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %eax
movl %eax, -0x38c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x388(%rbp)
movq -0x28(%rbp), %rdi
callq 0x92e0
movl -0x38c(%rbp), %edi
movq -0x388(%rbp), %rsi
movl %eax, %edx
callq 0xa76b0
movq -0x30(%rbp), %rax
movl $0x1, (%rax)
movq -0x30(%rbp), %rax
movl $0xffffffff, 0x8208(%rax) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
leaq -0x230(%rbp), %rsi
callq 0x96f0
movq -0x30(%rbp), %rdi
addq $0x104, %rdi            # imm = 0x104
leaq -0x330(%rbp), %rsi
callq 0x96f0
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
nopw %cs:(%rax,%rax)