#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct in6_addr {
  int /*<<< orphan*/ *s6_addr;
};
struct sockaddr_in6 {
  struct in6_addr sin6_addr;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int sa_family;
};

/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ abort();
int ishostnull(struct sockaddr *ia) {
  struct in6_addr *ap;
  switch (ia->sa_family) {
  case AF_INET:
    return (((struct sockaddr_in *)(ia))->sin_addr.s_addr == INADDR_ANY);
  case AF_INET6:
    ap = &((struct sockaddr_in6 *)(ia))->sin6_addr;
    return ((*(const uint32_t *)(const void *)(&ap->s6_addr[0]) == 0) &&
            (*(const uint32_t *)(const void *)(&ap->s6_addr[4]) == 0) &&
            (*(const uint32_t *)(const void *)(&ap->s6_addr[8]) == 0) &&
            (*(const uint32_t *)(const void *)(&ap->s6_addr[12]) == 0));
  default:
    break;
  }
  abort();
}


x86 assembly (clang, -O0):
<ishostnull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x80,%eax
je     1167 <ishostnull+0x57>
jmp    1135 <ishostnull+0x25>
mov    -0x1c(%rbp),%eax
sub    $0x81,%eax
jne    11d1 <ishostnull+0xc1>
jmp    1148 <ishostnull+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11dd <ishostnull+0xcd>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x1d(%rbp)
jne    11c1 <ishostnull+0xb1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmpl   $0x0,0x10(%rcx)
mov    %al,-0x1d(%rbp)
jne    11c1 <ishostnull+0xb1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmpl   $0x0,0x20(%rcx)
mov    %al,-0x1d(%rbp)
jne    11c1 <ishostnull+0xb1>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmpl   $0x0,0x30(%rax)
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11dd <ishostnull+0xcd>
jmp    11d6 <ishostnull+0xc6>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishostnull>:
push   %rax
mov    (%rdi),%edx
cmp    $0x81,%edx
je     112f <ishostnull+0x1f>
cmp    $0x80,%edx
jne    1153 <ishostnull+0x43>
mov    (%rdi),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
je     113f <ishostnull+0x2f>
pop    %rcx
ret
mov    0x2eb2(%rip),%rcx
xor    %eax,%eax
cmp    %edx,(%rcx)
sete   %al
pop    %rcx
ret
cmpl   $0x0,0x10(%rcx)
jne    112d <ishostnull+0x1d>
cmpl   $0x0,0x20(%rcx)
jne    112d <ishostnull+0x1d>
add    $0x30,%rcx
xor    %edx,%edx
jmp    1136 <ishostnull+0x26>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.in6_addr = type { i32* }
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_in6 = type { %struct.in6_addr }
@INADDR_ANY = global i32 0
define i32 @ishostnull(%struct.sockaddr* %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr*
%4 = alloca %struct.in6_addr*
store %struct.sockaddr* %0, %struct.sockaddr** %3
%5 = load %struct.sockaddr*, %struct.sockaddr** %3
%6 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %5, i32 0, i32 0
%7 = load i32, i32* %6
switch i32 %7, label %59 [
i32 129, label %8
i32 128, label %17
]
8: ; preds = %1
%9 = load %struct.sockaddr*, %struct.sockaddr** %3
%10 = bitcast %struct.sockaddr* %9 to %struct.sockaddr_in*
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32, i32* @INADDR_ANY
%15 = icmp eq i32 %13, %14
%16 = zext i1 %15 to i32
store i32 %16, i32* %2
br label %62
17: ; preds = %1
%18 = load %struct.sockaddr*, %struct.sockaddr** %3
%19 = bitcast %struct.sockaddr* %18 to %struct.sockaddr_in6*
%20 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %19, i32 0, i32 0
store %struct.in6_addr* %20, %struct.in6_addr** %4
%21 = load %struct.in6_addr*, %struct.in6_addr** %4
%22 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %21, i32 0, i32 0
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = bitcast i32* %24 to i8*
%26 = bitcast i8* %25 to i32*
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %56
29: ; preds = %17
%30 = load %struct.in6_addr*, %struct.in6_addr** %4
%31 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %30, i32 0, i32 0
%32 = load i32*, i32** %31
%33 = getelementptr inbounds i32, i32* %32, i64 4
%34 = bitcast i32* %33 to i8*
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %56
38: ; preds = %29
%39 = load %struct.in6_addr*, %struct.in6_addr** %4
%40 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %39, i32 0, i32 0
%41 = load i32*, i32** %40
%42 = getelementptr inbounds i32, i32* %41, i64 8
%43 = bitcast i32* %42 to i8*
%44 = bitcast i8* %43 to i32*
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %56
47: ; preds = %38
%48 = load %struct.in6_addr*, %struct.in6_addr** %4
%49 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %48, i32 0, i32 0
%50 = load i32*, i32** %49
%51 = getelementptr inbounds i32, i32* %50, i64 12
%52 = bitcast i32* %51 to i8*
%53 = bitcast i8* %52 to i32*
%54 = load i32, i32* %53
%55 = icmp eq i32 %54, 0
br label %56
56: ; preds = %47, %38, %29, %17
%57 = phi i1 [ false, %38 ], [ false, %29 ], [ false, %17 ], [ %55, %47 ]
%58 = zext i1 %57 to i32
store i32 %58, i32* %2
br label %62
59: ; preds = %1
br label %60
60: ; preds = %59
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %56, %8
%63 = load i32, i32* %2
ret i32 %63
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@INADDR_ANY = global i32 0
define i32 @ishostnull(%struct.sockaddr* nocapture %0) {
%2 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %0, i64 0, i32 0
%3 = load i32, i32* %2
switch i32 %3, label %19 [
i32 129, label %21
i32 128, label %4
]
4: ; preds = %1
%5 = bitcast %struct.sockaddr* %0 to i32**
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %4
%10 = getelementptr inbounds i32, i32* %6, i64 4
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = getelementptr inbounds i32, i32* %6, i64 8
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = getelementptr inbounds i32, i32* %6, i64 12
br label %21
19: ; preds = %1
%20 = tail call i32 (...) @abort()
unreachable
21: ; preds = %1, %17
%22 = phi i32* [ %18, %17 ], [ @INADDR_ANY, %1 ]
%23 = phi i32 [ 0, %17 ], [ %3, %1 ]
%24 = load i32, i32* %22
%25 = icmp eq i32 %24, %23
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %21, %4, %9, %13
%28 = phi i32 [ 0, %13 ], [ 0, %9 ], [ 0, %4 ], [ %26, %21 ]
ret i32 %28
}