// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::writentripc(bamboo::ntripc_t*, unsigned char*, int, char*)
static int writentripc(ntripc_t *ntripc, unsigned char *buff, int n, char *msg)
	{
		int i, ns = 0, err;

		tracet(4, "writentripc: n=%d\n", n);

		wait_ntripc(ntripc, msg);

		for (i = 0; i < MAXCLI; i++) {
			if (!ntripc->con[i].state) continue;
			/* skip if not selected mountpoint */
			if (*ntripc->mntpnt&&strcmp(ntripc->mntpnt, ntripc->con[i].mntpnt)) {
				continue;
			}
			/* skip if not the selected client,self defined code*/
			if (ntripc->msgid != MSG_NOTUSE && ntripc->msgid != ntripc->con[i].msgid) {
				continue;
			}
			ns = send_nb(ntripc->tcp->cli[i].sock, buff, n);

			if (ns < n) {
				if ((err = errsock())) {
					tracet(1, "writentripc: send error i=%d sock=%d err=%d\n", i,
						ntripc->tcp->cli[i].sock, err);
				}
				discon_ntripc(ntripc, i);
			}
			else {
				ntripc->tcp->cli[i].tact = tickget();
			}
		}
		return ns;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x14(%rbp), %edx
movl $0x4, %edi
leaq 0x28c63(%rip), %rsi     # 0xca0c0
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xa6600
movl $0x0, -0x24(%rbp)
cmpl $0x100, -0x24(%rbp)     # imm = 0x100
jge 0xa15f4
movq -0x8(%rbp), %rax
addq $0x340, %rax            # imm = 0x340
movslq -0x24(%rbp), %rcx
imulq $0x820c, %rcx, %rcx     # imm = 0x820C
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0xa14a7
jmp 0xa15e6
movq -0x8(%rbp), %rax
cmpb $0x0, 0x8(%rax)
je 0xa14e5
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
movq -0x8(%rbp), %rsi
addq $0x340, %rsi            # imm = 0x340
movslq -0x24(%rbp), %rax
imulq $0x820c, %rax, %rax     # imm = 0x820C
addq %rax, %rsi
addq $0x4, %rsi
callq 0x9a60
cmpl $0x0, %eax
je 0xa14e5
jmp 0xa15e6
movq -0x8(%rbp), %rax
cmpl $-0x1, 0x820f40(%rax)
je 0xa1522
movq -0x8(%rbp), %rax
movl 0x820f40(%rax), %eax
movq -0x8(%rbp), %rcx
addq $0x340, %rcx            # imm = 0x340
movslq -0x24(%rbp), %rdx
imulq $0x820c, %rdx, %rdx     # imm = 0x820C
addq %rdx, %rcx
cmpl 0x8208(%rcx), %eax
je 0xa1522
jmp 0xa15e6
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x24(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %edi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
callq 0xa76b0
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xa15b8
callq 0xa43f0
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
je 0xa15aa
movl -0x24(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x24(%rbp), %rcx
imulq $0x128, %rcx, %rcx      # imm = 0x128
addq %rcx, %rax
movl 0x118(%rax), %ecx
movl -0x2c(%rbp), %r8d
movl $0x1, %edi
leaq 0x28b30(%rip), %rsi     # 0xca0d3
movb $0x0, %al
callq 0x95890
movq -0x8(%rbp), %rdi
movl -0x24(%rbp), %esi
callq 0xa6820
jmp 0xa15e4
callq 0x8f860
movl %eax, %ecx
movq -0x8(%rbp), %rax
movq 0x338(%rax), %rax
addq $0x128, %rax            # imm = 0x128
movslq -0x24(%rbp), %rdx
imulq $0x128, %rdx, %rdx      # imm = 0x128
addq %rdx, %rax
movl %ecx, 0x120(%rax)
jmp 0xa15e6
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa1478
movl -0x28(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)