// File: /workspace/github_c_makefile_star2_O3/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 0x49a7
movl 0x10(%r14), %eax
testb $0x8, %al
jne 0x2ac0
testb $0x1, %al
jne 0x2af3
movq 0x8(%r14), %r8
leaq 0x7573(%rip), %rdi      # 0xa020
leaq 0x765d(%rip), %rcx      # 0xa111
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x193, %esi            # imm = 0x193
jmp 0x2adc
movq 0x8(%r14), %r8
leaq 0x7555(%rip), %rdi      # 0xa020
leaq 0x7623(%rip), %rcx      # 0xa0f5
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x18d, %esi            # imm = 0x18D
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
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 0x2b24
movq 0x8(%r14), %r8
leaq 0x750f(%rip), %rdi      # 0xa020
leaq 0x7613(%rip), %rcx      # 0xa12b
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x19a, %esi            # imm = 0x19A
jmp 0x2adc
testb $0x2, %bl
sete %cl
andl $0x2, %eax
shrl %eax
orb %cl, %al
jne 0x2b51
movq 0x8(%r14), %r8
leaq 0x74e2(%rip), %rdi      # 0xa020
leaq 0x760c(%rip), %rcx      # 0xa151
xorl %ebx, %ebx
movq %rsp, %r9
movl $0x1a3, %esi            # imm = 0x1A3
jmp 0x2adc
movq 0x18(%r14), %rax
movzwl (%rax), %eax
testl %ebp, %ebp
je 0x2ba4
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 0x2bd6
leaq 0x749f(%rip), %rdi      # 0xa020
leaq 0x75f3(%rip), %rcx      # 0xa17b
movq %rsp, %r8
movl $0x1aa, %esi            # imm = 0x1AA
movl $0x3, %edx
movl %ebp, %r9d
xorl %eax, %eax
callq 0x4ad6
jmp 0x2ae8
cmpw $0x2, %ax
jne 0x2bd6
leaq 0x746f(%rip), %rdi      # 0xa020
leaq 0x75e6(%rip), %rcx      # 0xa19e
movq %rsp, %r8
movl $0x1b1, %esi            # imm = 0x1B1
movl $0x3, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0x2, %ebx
jmp 0x2ae8
movq 0x8(%r14), %r9
leaq 0x743f(%rip), %rdi      # 0xa020
leaq 0x75e7(%rip), %rcx      # 0xa1cf
movq %rsp, %r8
movl $0x1b6, %esi            # imm = 0x1B6
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
movl $0x1, %ebx
jmp 0x2ae8