// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::wait_ntripc(bamboo::ntripc_t*, char*)
static void wait_ntripc(ntripc_t *ntripc, char *msg)
	{
		unsigned char *buff;
		int i, n, nmax, err;

		tracet(4, "wait_ntripc\n");

		ntripc->state = ntripc->tcp->svr.state;

		if (!waittcpsvr(ntripc->tcp, msg)) return;

		for (i = 0; i < MAXCLI; i++) {
			if (ntripc->tcp->cli[i].state != 2 || ntripc->con[i].state) continue;

			/* receive ntrip-caster request */
			buff = ntripc->con[i].buff + ntripc->con[i].nb;
			nmax = NTRIP_MAXRSP - ntripc->con[i].nb - 1;

			if ((n = recv_nb(ntripc->tcp->cli[i].sock, buff, nmax)) == -1) {
				if ((err = errsock())) {
					tracet(1, "accept_ntripc: recv error sock=%d err=%d\n",
						ntripc->tcp->cli[i].sock, err);
				}
				discon_ntripc(ntripc, i);
				continue;
			}
			if (n <= 0) continue;

			/* test ntrip-caster request */
			ntripc->con[i].nb += n;
			if (ntripc->type) {
				rsp_ntripc_c(ntripc, i);
			}
			else {
				rsp_ntripc_s(ntripc, i);
			}
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x4, %edi
leaq 0x233ff(%rip), %rsi     # 0xc9a1b
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
movl (%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0xa4c10
cmpl $0x0, %eax
jne 0xa6654
jmp 0xa680f
movl $0x0, -0x1c(%rbp)
cmpl $0x100, -0x1c(%rbp)     # imm = 0x100
jge 0xa680f
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x1c(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
cmpl $0x2, (%rax)
jne 0xa66a9
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x1c(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0xa66ae
jmp 0xa6801
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x1c(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
addq $0x208, %rax            # imm = 0x208
movq -0x8(%rbp), %rcx
addq $0x340, %rcx            # imm = 0x340
movslq -0x1c(%rbp), %rdx
imulq $0x820c, %rdx, %rdx     # imm = 0x820C
addq %rdx, %rcx
movslq 0x204(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rcx
addq $0x340, %rcx            # imm = 0x340
movslq -0x1c(%rbp), %rax
imulq $0x820c, %rax, %rax     # imm = 0x820C
addq %rax, %rcx
movl $0x8000, %eax           # imm = 0x8000
subl 0x204(%rcx), %eax
subl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x1c(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %edi
movq -0x18(%rbp), %rsi
movl -0x24(%rbp), %edx
callq 0xa4ca0
movl %eax, -0x20(%rbp)
cmpl $-0x1, %eax
jne 0xa67ac
callq 0xa43f0
movl %eax, -0x28(%rbp)
cmpl $0x0, %eax
je 0xa679e
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x1c(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %edx
movl -0x28(%rbp), %ecx
movl $0x1, %edi
leaq 0x23291(%rip), %rsi     # 0xc9a28
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa6820
jmp 0xa6801
cmpl $0x0, -0x20(%rbp)
jg 0xa67b4
jmp 0xa6801
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x1c(%rbp), %rdx
imulq $0x820c, %rdx, %rdx     # imm = 0x820C
addq %rdx, %rax
addl 0x204(%rax), %ecx
movl %ecx, 0x204(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x4(%rax)
je 0xa67f3
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa68e0
jmp 0xa67ff
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0xa6df0
jmp 0xa6801
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa665b
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)