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

/* Variables and functions */
int HOST_NOT_FOUND;
int NO_ADDRESS;
int NO_DATA;
int NO_RECOVERY;
int TRY_AGAIN;
const char *host_strerror(int h_err) {
  if (h_err == HOST_NOT_FOUND)
    return ("Unknown host");
  else if (h_err == TRY_AGAIN)
    return ("Transient host name lookup failure");
  else if (h_err == NO_RECOVERY)
    return ("Unknown server error");
  else if ((h_err == NO_ADDRESS) || (h_err == NO_DATA))
    return ("No address associated with name");
  return ("Unknown error");
}


x86 assembly (clang, -O0):
<host_strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ed7(%rip),%rcx
cmp    (%rcx),%eax
jne    1129 <host_strerror+0x29>
lea    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <host_strerror+0xbb>
mov    -0xc(%rbp),%eax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
jne    114b <host_strerror+0x4b>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <host_strerror+0xbb>
mov    -0xc(%rbp),%eax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%eax
jne    116d <host_strerror+0x6d>
lea    0xecc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <host_strerror+0xbb>
mov    -0xc(%rbp),%eax
mov    0x2e41(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <host_strerror+0x91>
mov    -0xc(%rbp),%eax
mov    0x2e3f(%rip),%rcx
cmp    (%rcx),%eax
jne    11a1 <host_strerror+0xa1>
lea    0xead(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11bb <host_strerror+0xbb>
jmp    11a6 <host_strerror+0xa6>
jmp    11ab <host_strerror+0xab>
jmp    11b0 <host_strerror+0xb0>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<host_strerror>:
mov    0x2ee1(%rip),%rax
cmp    %edi,(%rax)
jne    1113 <host_strerror+0x13>
lea    0xeee(%rip),%rax
ret
mov    0x2ebe(%rip),%rax
cmp    %edi,(%rax)
jne    1126 <host_strerror+0x26>
lea    0xee8(%rip),%rax
ret
mov    0x2ea3(%rip),%rax
cmp    %edi,(%rax)
jne    1139 <host_strerror+0x39>
lea    0xef8(%rip),%rax
ret
mov    0x2e78(%rip),%rcx
mov    0x2e81(%rip),%rax
cmp    %edi,(%rax)
lea    0xef5(%rip),%rdx
lea    0xf0e(%rip),%rax
cmove  %rdx,%rax
cmp    %edi,(%rcx)
cmove  %rdx,%rax
ret

LLVM IR (-O0):
@HOST_NOT_FOUND = global i32 0
@.str = [13 x i8] c"Unknown host\00"
@TRY_AGAIN = global i32 0
@.str.1 = [35 x i8] c"Transient host name lookup failure\00"
@NO_RECOVERY = global i32 0
@.str.2 = [21 x i8] c"Unknown server error\00"
@NO_ADDRESS = global i32 0
@NO_DATA = global i32 0
@.str.3 = [32 x i8] c"No address associated with name\00"
@.str.4 = [14 x i8] c"Unknown error\00"
define i8* @host_strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @HOST_NOT_FOUND
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %2
br label %31
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* @TRY_AGAIN
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %31
13: ; preds = %8
%14 = load i32, i32* %3
%15 = load i32, i32* @NO_RECOVERY
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %31
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* @NO_ADDRESS
%21 = icmp eq i32 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = load i32, i32* @NO_DATA
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %27
26: ; preds = %22, %18
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %31
27: ; preds = %22
br label %28
28: ; preds = %27
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %31
31: ; preds = %30, %26, %17, %12, %7
%32 = load i8*, i8** %2
ret i8* %32
}

LLVM IR (-O2):
@HOST_NOT_FOUND = global i32 0
@.str = [13 x i8] c"Unknown host\00"
@TRY_AGAIN = global i32 0
@.str.1 = [35 x i8] c"Transient host name lookup failure\00"
@NO_RECOVERY = global i32 0
@.str.2 = [21 x i8] c"Unknown server error\00"
@NO_ADDRESS = global i32 0
@NO_DATA = global i32 0
@.str.3 = [32 x i8] c"No address associated with name\00"
@.str.4 = [14 x i8] c"Unknown error\00"
define i8* @host_strerror(i32 %0) {
%2 = load i32, i32* @HOST_NOT_FOUND
%3 = icmp eq i32 %2, %0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = load i32, i32* @TRY_AGAIN
%6 = icmp eq i32 %5, %0
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = load i32, i32* @NO_RECOVERY
%9 = icmp eq i32 %8, %0
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = load i32, i32* @NO_ADDRESS
%12 = icmp eq i32 %11, %0
%13 = load i32, i32* @NO_DATA
%14 = icmp eq i32 %13, %0
%15 = select i1 %12, i1 true, i1 %14
%16 = select i1 %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0)
br label %17
17: ; preds = %10, %7, %4, %1
%18 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %7 ], [ %16, %10 ]
ret i8* %18
}