// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::strclose(bamboo::stream_t*)
extern void strclose(stream_t *stream)
	{
		tracet(3, "strclose: type=%d mode=%d\n", stream->type, stream->mode);

		strlock(stream);

		if (stream->port) {
			switch (stream->type) {
			case STR_SERIAL: closeserial((serial_t *)stream->port); break;
			case STR_FILE: closefile((file_t   *)stream->port); break;
			case STR_TCPSVR: closetcpsvr((tcpsvr_t *)stream->port); break;
			case STR_TCPCLI: closetcpcli((tcpcli_t *)stream->port); break;
			case STR_NTRIPSVR: closentrip((ntrip_t  *)stream->port); break;
			case STR_NTRIPCLI: closentrip((ntrip_t  *)stream->port); break;
			case STR_NTRIPC_S: closentripc((ntripc_t *)stream->port); break;
			case STR_NTRIPC_C: closentripc((ntripc_t *)stream->port); break;
			case STR_UDPSVR: closeudpsvr((udp_t    *)stream->port); break;
			case STR_UDPCLI: closeudpcli((udp_t    *)stream->port); break;
			case STR_MEMBUF: closemembuf((membuf_t *)stream->port); break;
			case STR_FTP: closeftp((ftp_t    *)stream->port); break;
			case STR_HTTP: closeftp((ftp_t    *)stream->port); break;
			case STR_VRSCONCLI: closevrsconcli((vrscon_cli_t*)stream->port); break;
			case STR_VRSCONSVR: closevrsconsvr((vrscon_svr_t*)stream->port); break;
			}
		}
		else {
			trace(2, "no port to close stream: type=%d\n", stream->type);
		}
		stream->type = 0;
		stream->mode = 0;
		stream->state = 0;
		stream->inr = stream->outr = 0;
		stream->path[0] = '\0';
		stream->msg[0] = '\0';
		stream->port = NULL;

		strunlock(stream);
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edx
movl 0x4(%rdi), %ecx
leaq 0x1bd64(%rip), %rsi     # 0x6be1a
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x8900
movq 0x58(%rbx), %r15
movl (%rbx), %edx
testq %r15, %r15
je 0x500ff
decl %edx
cmpl $0xf, %edx
ja 0x50246
leaq 0x1bb37(%rip), %rax     # 0x6bc20
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r15, %rdi
callq 0x50325
jmp 0x50246
leaq 0x1bd2f(%rip), %rsi     # 0x6be35
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x455bc
jmp 0x50246
movq %r15, %rdi
callq 0x5039d
jmp 0x50246
movq %r15, %rdi
callq 0x5035b
jmp 0x50246
movq 0x608(%r15), %rdi
callq 0x502ec
jmp 0x5023e
movl 0x11c(%r15), %edx
leaq 0x1c44c(%rip), %rsi     # 0x6c59a
jmp 0x5018a
leaq 0x1c46f(%rip), %rsi     # 0x6c5c6
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movq 0x38(%r15), %rdi
callq 0x8780
jmp 0x5023e
movq %r15, %rdi
callq 0x5028e
jmp 0x50246
movl 0x11c(%r15), %edx
leaq 0x1c426(%rip), %rsi     # 0x6c5b0
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movl 0x11c(%r15), %edi
callq 0x8c70
jmp 0x5023e
movl (%r15), %edx
leaq 0x1c35e(%rip), %rsi     # 0x6c50d
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x4acf2
movl (%r15), %edi
callq 0x8c70
movq 0x8(%r15), %rdi
testq %rdi, %rdi
jne 0x50239
jmp 0x5023e
movq (%r15), %rdx
leaq 0x1c34c(%rip), %rsi     # 0x6c522
pushq $0x3
popq %r12
movl %r12d, %edi
xorl %eax, %eax
callq 0x4acf2
leaq 0x20(%r15), %rdx
leaq 0x1c345(%rip), %rsi     # 0x6c534
movl %r12d, %edi
xorl %eax, %eax
callq 0x4acf2
movq (%r15), %rdi
testq %rdi, %rdi
je 0x50206
callq 0x8620
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x50214
callq 0x8620
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x50222
callq 0x8620
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x5023e
callq 0x8620
jmp 0x5023e
movq 0x608(%r15), %rdi
callq 0x5028e
movq %r15, %rdi
callq 0x8780
andq $0x0, (%rbx)
andl $0x0, 0x8(%rbx)
andl $0x0, 0x18(%rbx)
andl $0x0, 0x10(%rbx)
xorl %eax, %eax
movb %al, 0x60(%rbx)
movb %al, 0x460(%rbx)
andq $0x0, 0x58(%rbx)
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x84b0
movq %r15, %rdi
callq 0x502ec
jmp 0x50246