// File: /workspace/github_cpp_makefile_star2_O2/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 $0x618, %rsp            # imm = 0x618
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r13
leaq -0x230(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq -0x130(%rbp), %rdi
movl $0x100, %edx            # imm = 0x100
xorl %esi, %esi
callq 0x8390
leaq 0x1c75d(%rip), %rsi     # 0x6c2f8
pushq $0x3
popq %rdi
movq %r13, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x4acf2
movl $0x8518, %edi           # imm = 0x8518
callq 0x8830
testq %rax, %rax
je 0x4fcff
movq %rax, %r14
andl $0x0, (%rax)
movl %r15d, 0x4(%rax)
andl $0x0, 0x8(%rax)
addq $0xc, %rax
movq %rax, -0x30(%rbp)
xorl %edx, %edx
movb %dl, 0xc(%r14)
leaq 0x40c(%r14), %rax
movb %dl, 0x40c(%r14)
leaq 0x30c(%r14), %r8
movb %dl, 0x30c(%r14)
leaq 0x20c(%r14), %rcx
movb %dl, 0x20c(%r14)
movq %r14, %r9
addq $0x10c, %r9             # imm = 0x10C
movb %dl, 0x10c(%r14)
movl $0x50c, %edx            # imm = 0x50C
cmpq $0x850c, %rdx           # imm = 0x850C
je 0x4fc2d
movb $0x0, (%r14,%rdx)
incq %rdx
jmp 0x4fc1a
movq %rax, (%rsp)
leaq -0x230(%rbp), %rsi
leaq -0x130(%rbp), %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x4ede4
cmpb $0x0, (%r12)
jne 0x4fc74
testl %r15d, %r15d
pushq $0x50
popq %rax
movl $0x835, %edx            # imm = 0x835
cmovel %eax, %edx
leaq 0x1c505(%rip), %rsi     # 0x6c16b
leaq -0x130(%rbp), %rdi
xorl %eax, %eax
callq 0x8110
leaq 0x1c699(%rip), %rsi     # 0x6c314
leaq -0x630(%rbp), %rdi
leaq -0x230(%rbp), %rdx
leaq -0x130(%rbp), %rcx
xorl %eax, %eax
callq 0x8110
cmpb $0x0, 0x4e802(%rip)     # 0x9e4a0
je 0x4fccb
leaq 0x1c673(%rip), %rsi     # 0x6c31a
leaq -0x630(%rbp), %r15
movq -0x30(%rbp), %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x8110
leaq 0x4e7dd(%rip), %rsi     # 0x9e4a0
movq %r15, %rdi
callq 0x85c0
leaq -0x630(%rbp), %rdi
movq %rbx, %rsi
callq 0x4fa46
movq %rax, 0x8510(%r14)
testq %rax, %rax
jne 0x4fd02
leaq 0x1c637(%rip), %rsi     # 0x6c324
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movq %r14, %rdi
callq 0x8780
xorl %r14d, %r14d
movq %r14, %rax
addq $0x618, %rsp            # imm = 0x618
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq