// File: /workspace/github_c_makefile_star2_O0/jfriesse[P]omping/aiifunc.c
// Function: aii_mcast_to_ai
void
aii_mcast_to_ai(int ip_ver, struct ai_item *mcast_addr, const char *mcast_addr_s,
    const char *port_s)
{
	struct addrinfo *ai_res, *ai_i;

	if (mcast_addr_s == NULL) {
		switch (ip_ver) {
		case 4:
			mcast_addr_s = DEFAULT_MCAST4_ADDR;
			break;
		case 6:
			mcast_addr_s = DEFAULT_MCAST6_ADDR;
			break;
		default:
			DEBUG_PRINTF("Internal program error");
			err(1, "Internal program error");
			break;
		}
	}

	mcast_addr->host_name = (char *)malloc(strlen(mcast_addr_s) + 1);
	if (mcast_addr->host_name == NULL) {
		errx(1, "Can't alloc memory");
	}
	memcpy(mcast_addr->host_name, mcast_addr_s, strlen(mcast_addr_s) + 1);

	ai_res = af_host_to_ai(mcast_addr_s, port_s, ip_ver);

	for (ai_i = ai_res; ai_i != NULL; ai_i = ai_i->ai_next) {
		if (af_ai_supported_ipv(ai_i) == ip_ver) {
			memcpy(&mcast_addr->sas, ai_i->ai_addr, ai_i->ai_addrlen);
			break;
		}
	}

	if (ai_i == NULL) {
		DEBUG_PRINTF("Internal program error");
		err(1, "Internal program error");
	}

	freeaddrinfo(ai_res);

	/*
	 * Test if addr is really multicast
	 */
	if (!af_is_sa_mcast(AF_CAST_SA(&mcast_addr->sas))) {
		errx(1, "Given address %s is not valid multicast address", mcast_addr_s);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x3e33
movl -0x4(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x4, %eax
je 0x3de5
jmp 0x3ddb
movl -0x34(%rbp), %eax
subl $0x6, %eax
je 0x3df2
jmp 0x3dff
leaq 0xa4e5(%rip), %rax      # 0xe2d1
movq %rax, -0x18(%rbp)
jmp 0x3e31
leaq 0xa4e7(%rip), %rax      # 0xe2e0
movq %rax, -0x18(%rbp)
jmp 0x3e31
leaq 0xa3ec(%rip), %rdi      # 0xe1f2
movl $0x156, %esi            # imm = 0x156
movl $0x2, %edx
leaq 0xa210(%rip), %rcx      # 0xe027
movb $0x0, %al
callq 0x5dc0
movl $0x1, %edi
leaq 0xa1fd(%rip), %rsi      # 0xe027
movb $0x0, %al
callq 0x2240
jmp 0x3e33
movq -0x18(%rbp), %rdi
callq 0x20c0
movq %rax, %rdi
addq $0x1, %rdi
callq 0x2250
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x80(%rax)
jne 0x3e77
movl $0x1, %edi
leaq 0xa364(%rip), %rsi      # 0xe1d4
movb $0x0, %al
callq 0x20d0
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20c0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
callq 0x2200
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl -0x4(%rbp), %edx
callq 0x2db0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x3f08
movq -0x30(%rbp), %rdi
callq 0x29d0
cmpl -0x4(%rbp), %eax
jne 0x3ef8
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
callq 0x2200
jmp 0x3f08
jmp 0x3efa
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x3ec7
cmpq $0x0, -0x30(%rbp)
jne 0x3f41
leaq 0xa2dc(%rip), %rdi      # 0xe1f2
movl $0x16c, %esi            # imm = 0x16C
movl $0x2, %edx
leaq 0xa100(%rip), %rcx      # 0xe027
movb $0x0, %al
callq 0x5dc0
movl $0x1, %edi
leaq 0xa0ed(%rip), %rsi      # 0xe027
movb $0x0, %al
callq 0x2240
movq -0x28(%rbp), %rdi
callq 0x2340
movq -0x10(%rbp), %rdi
callq 0x2840
cmpl $0x0, %eax
jne 0x3f6f
movq -0x18(%rbp), %rdx
movl $0x1, %edi
leaq 0xa388(%rip), %rsi      # 0xe2f0
movb $0x0, %al
callq 0x20d0
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)