// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %r13d, %r13d
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq 0x1d747(%rip), %rsi     # 0x762fe
movl $0x3, %edi
movq %r12, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x5342c
movl $0x820f48, %edi         # imm = 0x820F48
callq 0x8840
testq %rax, %rax
je 0x58d1f
movq %rax, %rbx
movq %r14, -0x40(%rbp)
movl $0x0, (%rax)
movl %r15d, 0x4(%rax)
movq $0x0, 0x308(%rax)
addq $0x208, %rax            # imm = 0x208
movq %rax, -0x38(%rbp)
movb %r13b, 0x208(%rbx)
leaq 0x108(%rbx), %rax
movq %rax, -0x30(%rbp)
movb %r13b, 0x108(%rbx)
movb %r13b, 0x8(%rbx)
movl $0x548, %r14d           # imm = 0x548
leaq (%rbx,%r14), %rdi
movl %r13d, -0x208(%rbx,%r14)
movb %r13b, -0x204(%rbx,%r14)
movb %r13b, -0x104(%rbx,%r14)
movl %r13d, -0x4(%rbx,%r14)
movl $0x8000, %edx           # imm = 0x8000
xorl %esi, %esi
callq 0x8390
addq $0x820c, %r14           # imm = 0x820C
cmpq $0x821148, %r14         # imm = 0x821148
jne 0x58c25
movq %rbx, %rdi
addq $0x310, %rdi            # imm = 0x310
xorl %esi, %esi
callq 0x8910
movq $0x0, (%rsp)
leaq -0x140(%rbp), %r13
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %r8
xorl %r9d, %r9d
callq 0x57bb4
cmpb $0x0, (%r13)
jne 0x58cc6
testl %r15d, %r15d
movl $0x50, %eax
movl $0x835, %edx            # imm = 0x835
cmovel %eax, %edx
leaq 0x1d473(%rip), %rsi     # 0x7612b
leaq -0x140(%rbp), %rdi
xorl %eax, %eax
callq 0x8120
leaq 0x1d29f(%rip), %rsi     # 0x75f6c
leaq -0x540(%rbp), %r14
leaq -0x140(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x8120
movq %r14, %rdi
movq -0x40(%rbp), %rsi
callq 0x58784
movq %rax, 0x338(%rbx)
testq %rax, %rax
jne 0x58d21
leaq 0x1d617(%rip), %rsi     # 0x7631b
leaq -0x140(%rbp), %rdx
movl $0x1, %edi
xorl %eax, %eax
callq 0x5342c
movq %rbx, %rdi
callq 0x87a0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq