// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::setsock(int, char*)
static int setsock(socket_t sock, char *msg)
	{
		int bs = buffsize, mode = 1;
#ifdef WIN32
		int tv = 0;
#else
		struct timeval tv = { 0 };
#endif
		tracet(3, "setsock: sock=%d\n", sock);

		if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char *)&tv, sizeof(tv)) == -1 ||
			setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *)&tv, sizeof(tv)) == -1) {
			sprintf(msg, "sockopt error: notimeo");
			tracet(1, "setsock: setsockopt error 1 sock=%d err=%d\n", sock, errsock());
			closesocket(sock);
			return 0;
		}
		if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char *)&bs, sizeof(bs)) == -1 ||
			setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char *)&bs, sizeof(bs)) == -1) {
			tracet(1, "setsock: setsockopt error 2 sock=%d err=%d bs=%d\n", sock, errsock(), bs);
			sprintf(msg, "sockopt error: bufsiz");
		}
		if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&mode, sizeof(mode)) == -1) {
			tracet(1, "setsock: setsockopt error 3 sock=%d err=%d\n", sock, errsock());
			sprintf(msg, "sockopt error: nodelay");
		}
		return 1;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r15
movl %edi, %ebx
movl 0x34a8e(%rip), %eax     # 0x87eb4
movl %eax, -0x24(%rbp)
movl $0x1, -0x28(%rbp)
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %r12
movaps %xmm0, (%r12)
leaq 0x18da3(%rip), %rsi     # 0x6c1e6
xorl %r14d, %r14d
pushq $0x3
popq %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x4acf2
pushq $0x1
popq %rsi
pushq $0x14
popq %rdx
pushq $0x10
popq %r8
movl %ebx, %edi
movq %r12, %rcx
callq 0x8b40
cmpl $-0x1, %eax
je 0x5354b
pushq $0x1
popq %rsi
pushq $0x15
popq %rdx
leaq -0x40(%rbp), %rcx
pushq $0x10
popq %r8
movl %ebx, %edi
callq 0x8b40
cmpl $-0x1, %eax
je 0x5354b
pushq $0x1
popq %r14
pushq $0x8
popq %rdx
leaq -0x24(%rbp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
movl %r14d, %esi
callq 0x8b40
cmpl $-0x1, %eax
je 0x534c5
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
leaq -0x24(%rbp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
callq 0x8b40
cmpl $-0x1, %eax
jne 0x534fc
callq 0x533ff
movl -0x24(%rbp), %r8d
leaq 0x18d66(%rip), %rsi     # 0x6c23b
pushq $0x1
popq %rdi
movl %ebx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x4acf2
movabsq $0x7a697366756220, %rax # imm = 0x7A697366756220
movq %rax, 0xe(%r15)
movups 0x18d75(%rip), %xmm0    # 0x6c26d
movups %xmm0, (%r15)
pushq $0x6
popq %rsi
leaq -0x28(%rbp), %rcx
pushq $0x4
popq %r8
movl %ebx, %edi
movl %r14d, %edx
callq 0x8b40
cmpl $-0x1, %eax
jne 0x53585
callq 0x533ff
leaq 0x18d61(%rip), %rsi     # 0x6c283
movl %r14d, %edi
movl %ebx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x4acf2
movabsq $0x79616c65646f6e, %rax # imm = 0x79616C65646F6E
movq %rax, 0xf(%r15)
movups 0x18d6a(%rip), %xmm0    # 0x6c2af
movups %xmm0, (%r15)
jmp 0x53585
movups 0x18ca6(%rip), %xmm0    # 0x6c1f8
movups %xmm0, (%r15)
movabsq $0x6f656d69746f6e, %rax # imm = 0x6F656D69746F6E
movq %rax, 0xf(%r15)
callq 0x533ff
leaq 0x18c9f(%rip), %rsi     # 0x6c20f
pushq $0x1
popq %rdi
movl %ebx, %edx
movl %eax, %ecx
xorl %eax, %eax
callq 0x4acf2
movl %ebx, %edi
callq 0x8c70
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq