#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 */

/* Type definitions */
struct in_addr {
  int dummy;
};
struct hostent {
  int dummy;
};
typedef int socklen_t;
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int AF_INET;
int EAFNOSUPPORT;
int EINVAL;
int NO_DATA;
int NO_RECOVERY;
int NSS_STATUS_UNAVAIL;
enum nss_status _nss_etcd_gethostbyaddr_r(const void *addr, socklen_t len,
                                          int af, struct hostent *result,
                                          char *buffer, size_t buflen,
                                          int *errnop, int *h_errnop) {
  if (af != AF_INET) {
    *errnop = EAFNOSUPPORT;
    *h_errnop = NO_DATA;
    return NSS_STATUS_UNAVAIL;
  }
  if (len != sizeof(struct in_addr)) {
    *errnop = EINVAL;
    *h_errnop = NO_RECOVERY;
    return NSS_STATUS_UNAVAIL;
  }
  *errnop = EAFNOSUPPORT;
  *h_errnop = NO_DATA;
  return NSS_STATUS_UNAVAIL;
}


x86 assembly (clang, -O0):
<_nss_etcd_gethostbyaddr_r>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2ebc(%rip),%rcx
cmp    (%rcx),%eax
je     1163 <_nss_etcd_gethostbyaddr_r+0x63>
mov    0x2e7d(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e7e(%rip),%rax
mov    (%rax),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ca <_nss_etcd_gethostbyaddr_r+0xca>
movslq -0x14(%rbp),%rax
cmp    $0x4,%rax
je     11a0 <_nss_etcd_gethostbyaddr_r+0xa0>
mov    0x2e48(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e49(%rip),%rax
mov    (%rax),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ca <_nss_etcd_gethostbyaddr_r+0xca>
mov    0x2e11(%rip),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e12(%rip),%rax
mov    (%rax),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_etcd_gethostbyaddr_r>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ea8(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%edi
cmp    $0x4,%esi
je     1122 <_nss_etcd_gethostbyaddr_r+0x22>
mov    0x2ea0(%rip),%rdi
mov    (%rdi),%edi
cmp    %edx,%eax
cmove  %edi,%ecx
mov    0x8(%rsp),%rdi
mov    %ecx,(%rdi)
mov    0x2e93(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%edi
cmp    $0x4,%esi
je     1147 <_nss_etcd_gethostbyaddr_r+0x47>
mov    0x2e8b(%rip),%rsi
mov    (%rsi),%edi
cmp    %edx,%eax
cmove  %edi,%ecx
mov    0x10(%rsp),%rax
mov    %ecx,(%rax)
mov    0x2e86(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
@EAFNOSUPPORT = global i32 0
@NO_DATA = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
@EINVAL = global i32 0
@NO_RECOVERY = global i32 0
define i32 @_nss_etcd_gethostbyaddr_r(i8* %0, i32 %1, i32 %2, %struct.hostent* %3, i8* %4, i64 %5, i32* %6, i32* %7) {
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.hostent*
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i32*
%17 = alloca i32*
store i8* %0, i8** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store %struct.hostent* %3, %struct.hostent** %13
store i8* %4, i8** %14
store i64 %5, i64* %15
store i32* %6, i32** %16
store i32* %7, i32** %17
%18 = load i32, i32* %12
%19 = load i32, i32* @AF_INET
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %8
%22 = load i32, i32* @EAFNOSUPPORT
%23 = load i32*, i32** %16
store i32 %22, i32* %23
%24 = load i32, i32* @NO_DATA
%25 = load i32*, i32** %17
store i32 %24, i32* %25
%26 = load i32, i32* @NSS_STATUS_UNAVAIL
store i32 %26, i32* %9
br label %43
27: ; preds = %8
%28 = load i32, i32* %11
%29 = sext i32 %28 to i64
%30 = icmp ne i64 %29, 4
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i32, i32* @EINVAL
%33 = load i32*, i32** %16
store i32 %32, i32* %33
%34 = load i32, i32* @NO_RECOVERY
%35 = load i32*, i32** %17
store i32 %34, i32* %35
%36 = load i32, i32* @NSS_STATUS_UNAVAIL
store i32 %36, i32* %9
br label %43
37: ; preds = %27
%38 = load i32, i32* @EAFNOSUPPORT
%39 = load i32*, i32** %16
store i32 %38, i32* %39
%40 = load i32, i32* @NO_DATA
%41 = load i32*, i32** %17
store i32 %40, i32* %41
%42 = load i32, i32* @NSS_STATUS_UNAVAIL
store i32 %42, i32* %9
br label %43
43: ; preds = %37, %31, %21
%44 = load i32, i32* %9
ret i32 %44
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
@EAFNOSUPPORT = global i32 0
@NO_DATA = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
@EINVAL = global i32 0
@NO_RECOVERY = global i32 0
define i32 @_nss_etcd_gethostbyaddr_r(i8* nocapture readnone %0, i32 %1, i32 %2, %struct.hostent* nocapture readnone %3, i8* nocapture readnone %4, i64 %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7) {
%9 = load i32, i32* @AF_INET
%10 = icmp eq i32 %9, %2
%11 = icmp eq i32 %1, 4
%12 = load i32, i32* @EAFNOSUPPORT
%13 = load i32, i32* @EINVAL
%14 = select i1 %11, i32 %12, i32 %13
%15 = select i1 %10, i32 %14, i32 %12
store i32 %15, i32* %6
%16 = load i32, i32* @NO_DATA
%17 = load i32, i32* @NO_RECOVERY
%18 = select i1 %11, i32 %16, i32 %17
%19 = select i1 %10, i32 %18, i32 %16
store i32 %19, i32* %7
%20 = load i32, i32* @NSS_STATUS_UNAVAIL
ret i32 %20
}