// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::readntripc(bamboo::ntripc_t*, unsigned char*, int, char*)
static int readntripc(ntripc_t *ntripc, unsigned char *buff, int n, char *msg)
	{
		int i, nr, err;

		tracet(4, "readntripc:\n");

		wait_ntripc(ntripc, msg);

		for (i = 0; i < MAXCLI; i++) {
			if (!ntripc->con[i].state) continue;

			nr = recv_nb(ntripc->tcp->cli[i].sock, buff, n);

			if (nr < 0) {
				if ((err = errsock())) {
					tracet(1, "readntripc: recv error i=%d sock=%d err=%d\n", i,
						ntripc->tcp->cli[i].sock, err);
				}
				discon_ntripc(ntripc, i);
			}
			else if (nr > 0) {
				ntripc->tcp->cli[i].tact = tickget();
				/* record received mountpoint */
				strcpy(ntripc->mntpnt, ntripc->con[i].mntpnt);
				/* record msgid,self defined code */
				ntripc->msgid = ntripc->con[i].msgid;
				return nr;
			}
		}
		return 0;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x4, %edi
leaq 0x299ef(%rip), %rsi     # 0xc99e2
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0xa6600
movl $0x0, -0x2c(%rbp)
cmpl $0x100, -0x2c(%rbp)     # imm = 0x100
jge 0xa0176
movq -0x10(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x2c(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0xa003d
jmp 0xa0168
movq -0x10(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x2c(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %edi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0xa4ca0
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jge 0xa00d4
callq 0xa43f0
movl %eax, -0x34(%rbp)
cmpl $0x0, %eax
je 0xa00c3
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x2c(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %ecx
movl -0x34(%rbp), %r8d
movl $0x1, %edi
leaq 0x29933(%rip), %rsi     # 0xc99ef
movb $0x0, %al
callq 0x95890
movq -0x10(%rbp), %rdi
movl -0x2c(%rbp), %esi
callq 0xa6820
jmp 0xa0166
cmpl $0x0, -0x30(%rbp)
jle 0xa0164
callq 0x8f860
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x2c(%rbp), %rdx
imulq $0x128, %rdx, %rdx      # imm = 0x128
addq %rdx, %rax
movl %ecx, 0x120(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
addq $0x340, %rsi            # imm = 0x340
movslq -0x2c(%rbp), %rax
imulq $0x820c, %rax, %rax     # imm = 0x820C
addq %rax, %rsi
addq $0x4, %rsi
callq 0x96f0
movq -0x10(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x2c(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
movl 0x8208(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x820f40(%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xa017d
jmp 0xa0166
jmp 0xa0168
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa000e
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)