// File: /workspace/github_c_makefile_star2_O0/MartinDrab[P]netpipe/netpipe.c
// Function: sockaddrstr
char *sockaddrstr(const struct sockaddr *Addr)
{
	size_t len = 0;
	char *ret = NULL;
	const struct sockaddr_in *in4 = NULL;
	const struct sockaddr_in6 *in6 = NULL;
	const unsigned char *bytes = NULL;
	const unsigned short *words = NULL;

	len = 128;
	ret = (char *)malloc(len);
	if (ret == NULL)
		return ret;

	memset(ret, 0, len);
	switch (Addr->sa_family) {
		case AF_INET:
			in4 = (struct sockaddr_in *)Addr;
			bytes = (unsigned char *)&in4->sin_addr;
			snprintf(ret, len, "%u.%u.%u.%u:%u", bytes[0], bytes[1], bytes[2], bytes[3], ntohs(in4->sin_port));
			break;
		case AF_INET6:
			in6 = (struct sockaddr_in6 *)Addr;
			words = (unsigned short *)&in6->sin6_addr;
			snprintf(ret, len, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%u", words[0], words[1], words[2], words[3], words[4], words[5], words[6], words[7], ntohs(in6->sin6_port));
			break;
		default:
			free(ret);
			ret = NULL;
			break;
	}

	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x80, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x2180
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x724d
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x741c
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
xorl %esi, %esi
callq 0x2100
movq -0x28(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x5c(%rbp)
subl $0x2, %eax
je 0x727e
jmp 0x726d
movl -0x5c(%rbp), %eax
subl $0xa, %eax
je 0x730f
jmp 0x7403
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x50(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x6c(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, -0x68(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x2(%rax), %eax
movl %eax, -0x64(%rbp)
movq -0x50(%rbp), %rax
movzbl 0x3(%rax), %eax
movl %eax, -0x60(%rbp)
movq -0x40(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x21b0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movl -0x6c(%rbp), %ecx
movl -0x68(%rbp), %r8d
movl -0x64(%rbp), %r9d
movl -0x60(%rbp), %r10d
movzwl %ax, %eax
leaq 0x8fb1(%rip), %rdx      # 0x102ac
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x20e0
jmp 0x7414
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x58(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x94(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x90(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x58(%rbp), %rax
movzwl 0x6(%rax), %r15d
movq -0x58(%rbp), %rax
movzwl 0x8(%rax), %r14d
movq -0x58(%rbp), %rax
movzwl 0xa(%rax), %ebx
movq -0x58(%rbp), %rax
movzwl 0xc(%rax), %eax
movl %eax, -0x88(%rbp)
movq -0x58(%rbp), %rax
movzwl 0xe(%rax), %eax
movl %eax, -0x84(%rbp)
movq -0x48(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x21b0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl -0x94(%rbp), %ecx
movl -0x90(%rbp), %r8d
movl -0x8c(%rbp), %r9d
movl -0x88(%rbp), %r11d
movl -0x84(%rbp), %r10d
movzwl %ax, %eax
leaq 0x8edc(%rip), %rdx      # 0x102bb
movl %r15d, (%rsp)
movl %r14d, 0x8(%rsp)
movl %ebx, 0x10(%rsp)
movl %r11d, 0x18(%rsp)
movl %r10d, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movb $0x0, %al
callq 0x20e0
jmp 0x7414
movq -0x38(%rbp), %rdi
callq 0x2030
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop