// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
pushq %rax
movq %rdi, %rbx
movl (%rdi), %edx
movl 0x4(%rdi), %ecx
leaq 0x1c2e8(%rip), %rsi     # 0x75e2a
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x8910
movq 0x58(%rbx), %r15
movl (%rbx), %edx
testq %r15, %r15
je 0x59b8d
decl %edx
cmpl $0xf, %edx
ja 0x59ce8
leaq 0x1c0b9(%rip), %rax     # 0x75c30
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r15, %rdi
callq 0x59dc6
jmp 0x59ce8
leaq 0x1c2b1(%rip), %rsi     # 0x75e45
movl $0x2, %edi
xorl %eax, %eax
callq 0x4ded0
jmp 0x59ce8
movq %r15, %rdi
callq 0x59e42
jmp 0x59ce8
movq %r15, %rdi
callq 0x59dfe
jmp 0x59ce8
movq 0x608(%r15), %rdi
callq 0x59d8b
jmp 0x59ce0
movl 0x11c(%r15), %edx
leaq 0x1c9f7(%rip), %rsi     # 0x765d5
jmp 0x59c1c
leaq 0x1ca1a(%rip), %rsi     # 0x76601
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movq 0x38(%r15), %rdi
callq 0x87b0
jmp 0x59ce0
movq %r15, %rdi
callq 0x59d2d
jmp 0x59ce8
movl 0x11c(%r15), %edx
leaq 0x1c9cf(%rip), %rsi     # 0x765eb
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movl 0x11c(%r15), %edi
callq 0x8c50
jmp 0x59ce0
movl (%r15), %edx
leaq 0x1c905(%rip), %rsi     # 0x76548
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movl (%r15), %edi
callq 0x8c50
movq 0x8(%r15), %rdi
testq %rdi, %rdi
jne 0x59cdb
jmp 0x59ce0
movq (%r15), %rdx
leaq 0x1c8f1(%rip), %rsi     # 0x7655d
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
leaq 0x20(%r15), %rdx
leaq 0x1c8ec(%rip), %rsi     # 0x7656f
movl $0x3, %edi
xorl %eax, %eax
callq 0x53ec4
movq (%r15), %rdi
testq %rdi, %rdi
je 0x59c9c
callq 0x8630
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x59caa
callq 0x8630
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x59cb8
callq 0x8630
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x59cc6
callq 0x8630
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r15)
movups %xmm0, (%r15)
jmp 0x59ce0
movq 0x608(%r15), %rdi
callq 0x59d2d
movq %r15, %rdi
callq 0x87b0
xorl %eax, %eax
movq %rax, (%rbx)
movl %eax, 0x8(%rbx)
movl %eax, 0x18(%rbx)
movl %eax, 0x10(%rbx)
movb %al, 0x60(%rbx)
movb %al, 0x460(%rbx)
movq %rax, 0x58(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x84b0
movq %r15, %rdi
callq 0x59d8b
jmp 0x59ce8