// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::openntrip(char const*, int, char*)
static ntrip_t *openntrip(const char *path, int type, char *msg)
	{
		ntrip_t *ntrip;
		int i;
		char addr[256] = "", port[256] = "", tpath[MAXSTRPATH];

		tracet(3, "openntrip: path=%s type=%d\n", path, type);

		if (!(ntrip = (ntrip_t *)malloc(sizeof(ntrip_t)))) return NULL;

		ntrip->state = 0;
		ntrip->type = type; /* 0:server,1:client */
		ntrip->nb = 0;
		ntrip->url[0] = '\0';
		ntrip->mntpnt[0] = ntrip->user[0] = ntrip->passwd[0] = ntrip->str[0] = '\0';
		for (i = 0; i < NTRIP_MAXRSP; i++) ntrip->buff[i] = 0;

		/* decode tcp/ntrip path */
		decodetcppath(path, addr, port, ntrip->user, ntrip->passwd, ntrip->mntpnt,
			ntrip->str);

		/* use default port if no port specified */
		if (!*port) {
			sprintf(port, "%d", type ? NTRIP_CLI_PORT : NTRIP_SVR_PORT);
		}
		sprintf(tpath, "%s:%s", addr, port);

		/* ntrip access via proxy server */
		if (*proxyaddr) {
			sprintf(ntrip->url, "http://%s", tpath);
			strcpy(tpath, proxyaddr);
		}
		/* open tcp client stream */
		if (!(ntrip->tcp = opentcpcli(tpath, msg))) {
			tracet(1, "openntrip: opentcp error\n");
			free(ntrip);
			return NULL;
		}
		return ntrip;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x638, %rsp            # imm = 0x638
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r12
leaq -0x250(%rbp), %rdi
xorl %r13d, %r13d
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq -0x150(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq 0x1d8c8(%rip), %rsi     # 0x762b8
movl $0x3, %edi
movq %r12, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x5342c
movl $0x8518, %edi           # imm = 0x8518
callq 0x8840
testq %rax, %rax
je 0x58b65
movq %rax, %r14
movq %rbx, -0x48(%rbp)
movl %r13d, (%rax)
movl %r15d, 0x4(%rax)
movl %r13d, 0x8(%rax)
movb %r13b, 0xc(%rax)
leaq 0x40c(%rax), %rbx
movb %r13b, 0x40c(%rax)
addq $0x30c, %rax            # imm = 0x30C
movq %rax, -0x40(%rbp)
movb %r13b, 0x30c(%r14)
leaq 0x20c(%r14), %rax
movq %rax, -0x38(%rbp)
movb %r13b, 0x20c(%r14)
leaq 0x10c(%r14), %rax
movq %rax, -0x30(%rbp)
movb %r13b, 0x10c(%r14)
leaq 0x50c(%r14), %rdi
movl $0x8000, %edx           # imm = 0x8000
xorl %esi, %esi
callq 0x8390
movq %rbx, (%rsp)
leaq -0x250(%rbp), %rsi
leaq -0x150(%rbp), %rbx
movq %r12, %rdi
movq %rbx, %rdx
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %r8
movq -0x30(%rbp), %r9
callq 0x57bb4
cmpb %r13b, (%rbx)
jne 0x58ad4
testl %r15d, %r15d
movl $0x50, %eax
movl $0x835, %edx            # imm = 0x835
cmovel %eax, %edx
leaq 0x1d665(%rip), %rsi     # 0x7612b
leaq -0x150(%rbp), %rdi
xorl %eax, %eax
callq 0x8120
leaq 0x1d7f9(%rip), %rsi     # 0x762d4
leaq -0x650(%rbp), %rdi
leaq -0x250(%rbp), %rdx
leaq -0x150(%rbp), %rcx
xorl %eax, %eax
callq 0x8120
cmpb $0x0, 0x4d992(%rip)     # 0xa6490
je 0x58b2e
movq %r14, %rdi
addq $0xc, %rdi
leaq 0x1d7cc(%rip), %rsi     # 0x762da
leaq -0x650(%rbp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x8120
leaq 0x4d96a(%rip), %rsi     # 0xa6490
movq %rbx, %rdi
callq 0x85c0
leaq -0x650(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x58890
movq %rax, 0x8510(%r14)
testq %rax, %rax
jne 0x58b68
leaq 0x1d793(%rip), %rsi     # 0x762e4
movl $0x1, %edi
xorl %eax, %eax
callq 0x5342c
movq %r14, %rdi
callq 0x87a0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x638, %rsp            # imm = 0x638
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq