// File: /workspace/github_cpp_makefile_star2_O3/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 0x1ceae(%rip), %rsi     # 0x75dda
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
leaq 0x30(%rbx), %r14
movq %r14, %rdi
callq 0x8900
movq 0x58(%rbx), %r15
movl (%rbx), %edx
testq %r15, %r15
je 0x58f77
decl %edx
cmpl $0xf, %edx
ja 0x590c6
leaq 0x1cc7f(%rip), %rax     # 0x75be0
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r15, %rdi
callq 0x591a4
jmp 0x590c6
leaq 0x1ce77(%rip), %rsi     # 0x75df5
movl $0x2, %edi
xorl %eax, %eax
callq 0x4d55d
jmp 0x590c6
movq %r15, %rdi
callq 0x59220
jmp 0x590c6
movq %r15, %rdi
callq 0x591dc
jmp 0x590c6
movq 0x608(%r15), %rdi
callq 0x59169
jmp 0x590be
movl 0x11c(%r15), %edx
leaq 0x1d592(%rip), %rsi     # 0x7655a
jmp 0x59006
leaq 0x1d5b5(%rip), %rsi     # 0x76586
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movq 0x38(%r15), %rdi
callq 0x87a0
jmp 0x590be
movq %r15, %rdi
callq 0x5910b
jmp 0x590c6
movl 0x11c(%r15), %edx
leaq 0x1d56a(%rip), %rsi     # 0x76570
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movl 0x11c(%r15), %edi
callq 0x8c40
jmp 0x590be
movl (%r15), %edx
leaq 0x1d4a0(%rip), %rsi     # 0x764cd
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movl (%r15), %edi
callq 0x8c40
movq 0x8(%r15), %rdi
testq %rdi, %rdi
jne 0x590b9
jmp 0x590be
movq (%r15), %rdx
leaq 0x1d48c(%rip), %rsi     # 0x764e2
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
leaq 0x20(%r15), %rdx
leaq 0x1d487(%rip), %rsi     # 0x764f4
movl $0x3, %edi
xorl %eax, %eax
callq 0x5342c
movq (%r15), %rdi
testq %rdi, %rdi
je 0x59086
callq 0x8630
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x59094
callq 0x8630
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x590a2
callq 0x8630
movq 0x18(%r15), %rdi
testq %rdi, %rdi
je 0x590be
callq 0x8630
jmp 0x590be
movq 0x608(%r15), %rdi
callq 0x5910b
movq %r15, %rdi
callq 0x87a0
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 0x59169
jmp 0x590c6