// File: /workspace/github_c_makefile_star2_O1/jfriesse[P]omping/addrfunc.c
// Function: af_is_supported_local_ifa
int
af_is_supported_local_ifa(const struct ifaddrs *ifa, int ip_ver, unsigned int if_flags)
{
	char ai_s[LOGGING_SA_TO_STR_LEN];

	logging_sa_to_str(ifa->ifa_addr, ai_s, sizeof(ai_s));

	if (ifa->ifa_flags & IFF_LOOPBACK) {
		DEBUG2_PRINTF("%s with addr %s is loopback", ifa->ifa_name, ai_s);

		return (0);
	}

	if (!(ifa->ifa_flags & IFF_UP)) {
		DEBUG2_PRINTF("%s with addr %s is not up", ifa->ifa_name, ai_s);

		return (0);
	}

	if (if_flags & IFF_MULTICAST) {
		if (!(ifa->ifa_flags & IFF_MULTICAST)) {
			DEBUG2_PRINTF("%s with addr %s doesn't support mcast", ifa->ifa_name, ai_s);

			return (0);
		}
	}

	if (if_flags & IFF_BROADCAST) {
		if (!(ifa->ifa_flags & IFF_BROADCAST)) {
			DEBUG2_PRINTF("%s with addr %s doesn't support broadcast", ifa->ifa_name,
			    ai_s);

			return (0);
		}
	}

	if (ip_ver != 0 && af_sa_supported_ipv(ifa->ifa_addr) != ip_ver) {
		DEBUG2_PRINTF("%s doesn't support requested ipv%d", ai_s, ip_ver);

		return (0);
	}


	if (ip_ver == 0 && af_sa_supported_ipv(ifa->ifa_addr) == 4) {
		DEBUG2_PRINTF("%s doesn't support ipv6. Saving ipv4 as fallback", ai_s);

		return (2);
	}

	DEBUG_PRINTF("Found local addr %s as device %s", ai_s, ifa->ifa_name);
	return (1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq 0x18(%rdi), %rdi
movq %rsp, %rsi
movl $0x3e, %edx
callq 0x49ab
movl 0x10(%r14), %eax
testb $0x8, %al
jne 0x2abc
testb $0x1, %al
jne 0x2aef
movq 0x8(%r14), %r8
leaq 0x7577(%rip), %rdi      # 0xa020
leaq 0x7661(%rip), %rcx      # 0xa111
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x193, %esi            # imm = 0x193
jmp 0x2ad8
movq 0x8(%r14), %r8
leaq 0x7559(%rip), %rdi      # 0xa020
leaq 0x7627(%rip), %rcx      # 0xa0f5
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x18d, %esi            # imm = 0x18D
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ada
movl %ebx, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
btl $0xc, %ebx
setae %cl
movl %eax, %edx
shrl $0xc, %edx
andl $0x1, %edx
orb %cl, %dl
jne 0x2b20
movq 0x8(%r14), %r8
leaq 0x7513(%rip), %rdi      # 0xa020
leaq 0x7617(%rip), %rcx      # 0xa12b
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x19a, %esi            # imm = 0x19A
jmp 0x2ad8
testb $0x2, %bl
sete %cl
andl $0x2, %eax
shrl %eax
orb %cl, %al
jne 0x2b4d
movq 0x8(%r14), %r8
leaq 0x74e6(%rip), %rdi      # 0xa020
leaq 0x7610(%rip), %rcx      # 0xa151
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x1a3, %esi            # imm = 0x1A3
jmp 0x2ad8
movq 0x18(%r14), %rax
movzwl (%rax), %eax
testl %ebp, %ebp
je 0x2ba0
xorl %ebx, %ebx
cmpw $0xa, %ax
movl $0x6, %ecx
cmovnel %ebx, %ecx
cmpw $0x2, %ax
movl $0x4, %eax
cmovnel %ecx, %eax
cmpl %ebp, %eax
je 0x2bd2
leaq 0x74a3(%rip), %rdi      # 0xa020
leaq 0x75f7(%rip), %rcx      # 0xa17b
movq %rsp, %r8
movl $0x1aa, %esi            # imm = 0x1AA
movl $0x3, %edx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x4ada
jmp 0x2ae4
cmpw $0x2, %ax
jne 0x2bd2
leaq 0x7473(%rip), %rdi      # 0xa020
leaq 0x75ea(%rip), %rcx      # 0xa19e
movq %rsp, %r8
movl $0x1b1, %esi            # imm = 0x1B1
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ada
movl $0x2, %ebx
jmp 0x2ae4
movq 0x8(%r14), %r9
leaq 0x7443(%rip), %rdi      # 0xa020
leaq 0x75eb(%rip), %rcx      # 0xa1cf
movq %rsp, %r8
movl $0x1b6, %esi            # imm = 0x1B6
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ada
movl $0x1, %ebx
jmp 0x2ae4