// File: /workspace/github_c_makefile_star2_O0/jfriesse[P]omping/aiifunc.c
// Function: aii_ifa_local_to_ai
void
aii_ifa_local_to_ai(struct aii_list *aii_list, struct ai_item *ai_local,
    const struct ifaddrs *ifa_local, int ip_ver, struct ai_item *local_addr, int *single_addr)
{
	size_t addr_len;
	uint16_t port;

	switch (ifa_local->ifa_addr->sa_family) {
	case AF_INET:
		addr_len = sizeof(struct sockaddr_in);
		port = ((struct sockaddr_in *)&ai_local->sas)->sin_port;
		break;
	case AF_INET6:
		addr_len = sizeof(struct sockaddr_in6);
		port = ((struct sockaddr_in6 *)&ai_local->sas)->sin6_port;
		break;
	default:
		DEBUG_PRINTF("Internal program error");
		err(1, "Internal program error");
		break;
	}

	memcpy(&local_addr->sas, ifa_local->ifa_addr, addr_len);
	local_addr->host_name = strdup(ai_local->host_name);
	if (local_addr->host_name == NULL) {
		err(1, "Can't alloc memory");
		/* NOTREACHED */
	}

	switch (ifa_local->ifa_addr->sa_family) {
	case AF_INET:
		((struct sockaddr_in *)&local_addr->sas)->sin_port = port;
		break;
	case AF_INET6:
		((struct sockaddr_in6 *)&local_addr->sas)->sin6_port = port;
		break;
	default:
		DEBUG_PRINTF("Internal program error");
		err(1, "Internal program error");
		break;
	}

	*single_addr = (TAILQ_NEXT(TAILQ_FIRST(aii_list), entries) == NULL);

	if (!*single_addr) {
		TAILQ_REMOVE(aii_list, ai_local, entries);

		free(ai_local->host_name);
		free(ai_local);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movzwl (%rax), %eax
movl %eax, -0x40(%rbp)
subl $0x2, %eax
je 0x39ce
jmp 0x39c4
movl -0x40(%rbp), %eax
subl $0xa, %eax
je 0x39e4
jmp 0x39fa
movq $0x10, -0x38(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3a(%rbp)
jmp 0x3a2c
movq $0x1c, -0x38(%rbp)
movq -0x10(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x3a(%rbp)
jmp 0x3a2c
leaq 0xa7f1(%rip), %rdi      # 0xe1f2
movl $0xda, %esi
movl $0x2, %edx
leaq 0xa615(%rip), %rcx      # 0xe027
movb $0x0, %al
callq 0x5dc0
movl $0x1, %edi
leaq 0xa602(%rip), %rsi      # 0xe027
movb $0x0, %al
callq 0x2240
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x38(%rbp), %rdx
callq 0x2200
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x2330
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x3a80
movl $0x1, %edi
leaq 0xa75b(%rip), %rsi      # 0xe1d4
movb $0x0, %al
callq 0x2240
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movzwl (%rax), %eax
movl %eax, -0x44(%rbp)
subl $0x2, %eax
je 0x3a9f
jmp 0x3a95
movl -0x44(%rbp), %eax
subl $0xa, %eax
je 0x3aad
jmp 0x3abb
movw -0x3a(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x2(%rax)
jmp 0x3aed
movw -0x3a(%rbp), %cx
movq -0x28(%rbp), %rax
movw %cx, 0x2(%rax)
jmp 0x3aed
leaq 0xa730(%rip), %rdi      # 0xe1f2
movl $0xee, %esi
movl $0x2, %edx
leaq 0xa554(%rip), %rcx      # 0xe027
movb $0x0, %al
callq 0x5dc0
movl $0x1, %edi
leaq 0xa541(%rip), %rsi      # 0xe027
movb $0x0, %al
callq 0x2240
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, 0x88(%rax)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x30(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x3b87
jmp 0x3b15
movq -0x10(%rbp), %rax
cmpq $0x0, 0x88(%rax)
je 0x3b42
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rax
movq %rcx, 0x90(%rax)
jmp 0x3b55
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x88(%rax), %rcx
movq -0x10(%rbp), %rax
movq 0x90(%rax), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
callq 0x2040
movq -0x10(%rbp), %rdi
callq 0x2040
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)