// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::openntripc(char const*, int, char*)
static ntripc_t *openntripc(const char *path, int type, char *msg)
	{
		ntripc_t *ntripc;
		int i, j;
		char port[256] = "", tpath[MAXSTRPATH];

		tracet(3, "openntripc: path=%s type=%d\n", path, type);

		if (!(ntripc = (ntripc_t *)malloc(sizeof(ntripc_t)))) return NULL;

		ntripc->state = 0;
		ntripc->type = type; /* 0:server,1:client */
		ntripc->srctbl = NULL;
		ntripc->mntpnt[0] = ntripc->user[0] = ntripc->passwd[0] = '\0';
		for (i = 0; i < MAXCLI; i++) {
			ntripc->con[i].state = 0;
			ntripc->con[i].mntpnt[0] = '\0';
			ntripc->con[i].str[0] = '\0';
			ntripc->con[i].nb = 0;
			for (j = 0; j < NTRIP_MAXRSP; j++) ntripc->con[i].buff[j] = 0;
		}
		initlock(&ntripc->lock_srctbl);

		/* decode tcp/ntrip path */
		decodetcppath(path, NULL, port, ntripc->user, ntripc->passwd, NULL, NULL);

		/* use default port if no port specified */
		if (!*port) {
			sprintf(port, "%d", type ? NTRIP_CLI_PORT : NTRIP_SVR_PORT);
		}
		sprintf(tpath, ":%s", port);

		/* open tcp server stream */
		if (!(ntripc->tcp = opentcpsvr(tpath, msg))) {
			tracet(1, "openntripc: opentcpsvr error port=%d\n", port);
			free(ntripc);
			return NULL;
		}
		return ntripc;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %r12
leaq -0x140(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq 0x1c5f0(%rip), %rsi     # 0x6c33e
pushq $0x3
popq %rdi
movq %r12, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4acf2
movl $0x820f48, %edi         # imm = 0x820F48
callq 0x8830
testq %rax, %rax
je 0x4feb5
movq %rax, %rbx
movq %r14, -0x38(%rbp)
andl $0x0, (%rax)
movl %r15d, 0x4(%rax)
andq $0x0, 0x308(%rax)
addq $0x208, %rax            # imm = 0x208
movq %rax, -0x30(%rbp)
xorl %eax, %eax
movb %al, 0x208(%rbx)
leaq 0x108(%rbx), %r14
movb %al, 0x108(%rbx)
movb %al, 0x8(%rbx)
leaq 0x340(%rbx), %rcx
leaq 0x548(%rbx), %rdx
xorl %esi, %esi
cmpq $0x100, %rsi            # imm = 0x100
je 0x4fe00
imulq $0x820c, %rsi, %rdi     # imm = 0x820C
andl $0x0, (%rcx,%rdi)
movb %al, 0x4(%rcx,%rdi)
movb %al, 0x104(%rcx,%rdi)
andl $0x0, 0x204(%rcx,%rdi)
xorl %edi, %edi
cmpq $0x8000, %rdi           # imm = 0x8000
je 0x4fdf4
movb $0x0, (%rdx,%rdi)
incq %rdi
jmp 0x4fde2
incq %rsi
addq $0x820c, %rdx           # imm = 0x820C
jmp 0x4fdb9
movq %rbx, %rdi
addq $0x310, %rdi            # imm = 0x310
xorl %esi, %esi
callq 0x8910
andq $0x0, (%rsp)
leaq -0x140(%rbp), %r13
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r14, %rcx
movq -0x30(%rbp), %r8
xorl %r9d, %r9d
callq 0x4ede4
cmpb $0x0, (%r13)
jne 0x4fe5e
testl %r15d, %r15d
pushq $0x50
popq %rax
movl $0x835, %edx            # imm = 0x835
cmovel %eax, %edx
leaq 0x1c31b(%rip), %rsi     # 0x6c16b
leaq -0x140(%rbp), %rdi
xorl %eax, %eax
callq 0x8110
leaq 0x1c147(%rip), %rsi     # 0x6bfac
leaq -0x540(%rbp), %r14
leaq -0x140(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x8110
movq %r14, %rdi
movq -0x38(%rbp), %rsi
callq 0x4f946
movq %rax, 0x338(%rbx)
testq %rax, %rax
jne 0x4feb7
leaq 0x1c4bf(%rip), %rsi     # 0x6c35b
pushq $0x1
popq %rdi
leaq -0x140(%rbp), %rdx
xorl %eax, %eax
callq 0x4acf2
movq %rbx, %rdi
callq 0x8780
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq