#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 */
#define EACCES 142
#define EADDRINUSE 141
#define EAFNOSUPPORT 140
#define EAGAIN 139
#define EALREADY 138
#define EBADF 137
#define ECONNREFUSED 136
#define EFAULT 135
#define EINPROGRESS 134
#define EINTR 133
#define EISCONN 132
#define ENETUNREACH 131
#define ENOTSOCK 130
#define EPERM 129
#define ETIMEDOUT 128
int /*<<< orphan*/ printf(char *, int);
void print_errno(int err) {
  switch (err) {
  case EACCES:
    printf("EACCES (%d): For UNIX domain sockets, which are identified by "
           "pathname: Write permission is denied on the socket file, or search "
           "permission is denied for one of the directories in the path "
           "prefix. (See also path_resolution(7).)\n",
           err);
    break;
  case EPERM:
    printf("EPERM (%d): The user tried to connect to a broadcast address "
           "without having the socket broadcast flag enabled or the connection "
           "request failed because of a local firewall rule.\n",
           err);
    break;
  case EADDRINUSE:
    printf("EADDRINUSE (%d): Local address is already in use.\n", err);
    break;
  case EAFNOSUPPORT:
    printf("EAFNOSUPPORT (%d): The passed address didn't have the correct "
           "address family in its sa_family field.\n",
           err);
    break;
  case EAGAIN:
    printf("EAGAIN (%d): No more free local ports or insufficient entries in "
           "the routing cache. For AF_INET see the description of "
           "/proc/sys/net/ipv4/ip_local_port_range ip(7) for information on "
           "how to increase the number of local ports.\n",
           err);
    break;
  case EALREADY:
    printf("EALREADY (%d): The socket is nonblocking and a previous connection "
           "attempt has not yet been completed.\n",
           err);
    break;
  case EBADF:
    printf("EBADF (%d): The file descriptor is not a valid index in the "
           "descriptor table.\n",
           err);
    break;
  case ECONNREFUSED:
    printf("ECONNREFUSED (%d): No-one listening on the remote address.\n", err);
    break;
  case EFAULT:
    printf("EFAULT (%d): The socket structure address is outside the user's "
           "address space.\n",
           err);
    break;
  case EINPROGRESS:
    printf("EINPROGRESS (%d): The socket is nonblocking and the connection "
           "cannot be completed immediately. It is possible to select(2) or "
           "poll(2) for completion by selecting the socket for writing. After "
           "select(2) indicates writability, use getsockopt(2) to read the "
           "SO_ERROR option at level SOL_SOCKET to determine whether connect() "
           "completed successfully (SO_ERROR is zero) or unsuccessfully "
           "(SO_ERROR is one of the usual error codes listed here, explaining "
           "the reason for the failure).\n",
           err);
    break;
  case EINTR:
    printf("EINTR (%d): The system call was interrupted by a signal that was "
           "caught; see signal(7).\n",
           err);
    break;
  case EISCONN:
    printf("EISCONN (%d): The socket is already connected.\n", err);
    break;
  case ENETUNREACH:
    printf("ENETUNREACH (%d): Network is unreachable.\n", err);
    break;
  case ENOTSOCK:
    printf(
        "ENOTSOCK (%d): The file descriptor is not associated with a socket.\n",
        err);
    break;
  case ETIMEDOUT:
    printf(
        "ETIMEDOUT (%d): Timeout while attempting connection. The server may "
        "be too busy to accept new connections. Note that for IP sockets the "
        "timeout may be very long when syncookies are enabled on the server.\n",
        err);
    break;
  }
}


x86 assembly (clang, -O0):
<print_errno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xe,%eax
ja     126b <print_errno+0x15b>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x4(%rbp),%esi
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0xfbf(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x105d(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x107c(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x10ce(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x119d(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x11f1(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x122c(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x1254(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x1290(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x145b(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x14a0(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x14bc(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x14d3(%rip),%rdi
call   1030 <printf@plt>
jmp    126b <print_errno+0x15b>
mov    -0x4(%rbp),%esi
lea    0x1504(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_errno>:
add    $0xffffff80,%edi
cmp    $0xe,%edi
ja     1139 <print_errno+0x29>
lea    0xee1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x163b(%rip),%rdi
mov    $0x80,%esi
jmp    1030 <printf@plt>
ret
lea    0xfe0(%rip),%rdi
mov    $0x81,%esi
jmp    1030 <printf@plt>
lea    0x15d3(%rip),%rdi
mov    $0x82,%esi
jmp    1030 <printf@plt>
lea    0x1597(%rip),%rdi
mov    $0x83,%esi
jmp    1030 <printf@plt>
lea    0x1556(%rip),%rdi
mov    $0x84,%esi
jmp    1030 <printf@plt>
lea    0x14ec(%rip),%rdi
mov    $0x85,%esi
jmp    1030 <printf@plt>
lea    0x12fc(%rip),%rdi
mov    $0x86,%esi
jmp    1030 <printf@plt>
lea    0x129b(%rip),%rdi
mov    $0x87,%esi
jmp    1030 <printf@plt>
lea    0x124e(%rip),%rdi
mov    $0x88,%esi
jmp    1030 <printf@plt>
lea    0x11ee(%rip),%rdi
mov    $0x89,%esi
jmp    1030 <printf@plt>
lea    0x1175(%rip),%rdi
mov    $0x8a,%esi
jmp    1030 <printf@plt>
lea    0x1081(%rip),%rdi
mov    $0x8b,%esi
jmp    1030 <printf@plt>
lea    0x100a(%rip),%rdi
mov    $0x8c,%esi
jmp    1030 <printf@plt>
lea    0xfc6(%rip),%rdi
mov    $0x8d,%esi
jmp    1030 <printf@plt>
lea    0xe1e(%rip),%rdi
mov    $0x8e,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [229 x i8] c"EACCES (%d): For UNIX domain sockets, which are identified by pathname: Write permission is denied on the socket file, or search permission is denied for one of the directories in the path prefix. (See also path_resolution(7).)\0A\00"
@.str.1 = [178 x i8] c"EPERM (%d): The user tried to connect to a broadcast address without having the socket broadcast flag enabled or the connection request failed because of a local firewall rule.\0A\00"
@.str.2 = [51 x i8] c"EADDRINUSE (%d): Local address is already in use.\0A\00"
@.str.3 = [102 x i8] c"EAFNOSUPPORT (%d): The passed address didn't have the correct address family in its sa_family field.\0A\00"
@.str.4 = [227 x i8] c"EAGAIN (%d): No more free local ports or insufficient entries in the routing cache. For AF_INET see the description of /proc/sys/net/ipv4/ip_local_port_range ip(7) for information on how to increase the number of local ports.\0A\00"
@.str.5 = [104 x i8] c"EALREADY (%d): The socket is nonblocking and a previous connection attempt has not yet been completed.\0A\00"
@.str.6 = [79 x i8] c"EBADF (%d): The file descriptor is not a valid index in the descriptor table.\0A\00"
@.str.7 = [60 x i8] c"ECONNREFUSED (%d): No-one listening on the remote address.\0A\00"
@.str.8 = [80 x i8] c"EFAULT (%d): The socket structure address is outside the user's address space.\0A\00"
@.str.9 = [479 x i8] c"EINPROGRESS (%d): The socket is nonblocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by selecting the socket for writing. After select(2) indicates writability, use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET to determine whether connect() completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error codes listed here, explaining the reason for the failure).\0A\00"
@.str.10 = [89 x i8] c"EINTR (%d): The system call was interrupted by a signal that was caught; see signal(7).\0A\00"
@.str.11 = [48 x i8] c"EISCONN (%d): The socket is already connected.\0A\00"
@.str.12 = [43 x i8] c"ENETUNREACH (%d): Network is unreachable.\0A\00"
@.str.13 = [69 x i8] c"ENOTSOCK (%d): The file descriptor is not associated with a socket.\0A\00"
@.str.14 = [205 x i8] c"ETIMEDOUT (%d): Timeout while attempting connection. The server may be too busy to accept new connections. Note that for IP sockets the timeout may be very long when syncookies are enabled on the server.\0A\00"
define void @print_errno(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %49 [
i32 142, label %4
i32 129, label %7
i32 141, label %10
i32 140, label %13
i32 139, label %16
i32 138, label %19
i32 137, label %22
i32 136, label %25
i32 135, label %28
i32 134, label %31
i32 133, label %34
i32 132, label %37
i32 131, label %40
i32 130, label %43
i32 128, label %46
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([229 x i8], [229 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %49
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %49
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %49
13: ; preds = %1
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %49
16: ; preds = %1
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([227 x i8], [227 x i8]* @.str.4, i64 0, i64 0), i32 %17)
br label %49
19: ; preds = %1
%20 = load i32, i32* %2
%21 = call i32 @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.5, i64 0, i64 0), i32 %20)
br label %49
22: ; preds = %1
%23 = load i32, i32* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0), i32 %23)
br label %49
25: ; preds = %1
%26 = load i32, i32* %2
%27 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 %26)
br label %49
28: ; preds = %1
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0), i32 %29)
br label %49
31: ; preds = %1
%32 = load i32, i32* %2
%33 = call i32 @printf(i8* getelementptr inbounds ([479 x i8], [479 x i8]* @.str.9, i64 0, i64 0), i32 %32)
br label %49
34: ; preds = %1
%35 = load i32, i32* %2
%36 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.10, i64 0, i64 0), i32 %35)
br label %49
37: ; preds = %1
%38 = load i32, i32* %2
%39 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i32 %38)
br label %49
40: ; preds = %1
%41 = load i32, i32* %2
%42 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 %41)
br label %49
43: ; preds = %1
%44 = load i32, i32* %2
%45 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.13, i64 0, i64 0), i32 %44)
br label %49
46: ; preds = %1
%47 = load i32, i32* %2
%48 = call i32 @printf(i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.14, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %1, %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %7, %4
ret void
}

LLVM IR (-O2):
@.str = [229 x i8] c"EACCES (%d): For UNIX domain sockets, which are identified by pathname: Write permission is denied on the socket file, or search permission is denied for one of the directories in the path prefix. (See also path_resolution(7).)\0A\00"
@.str.1 = [178 x i8] c"EPERM (%d): The user tried to connect to a broadcast address without having the socket broadcast flag enabled or the connection request failed because of a local firewall rule.\0A\00"
@.str.2 = [51 x i8] c"EADDRINUSE (%d): Local address is already in use.\0A\00"
@.str.3 = [102 x i8] c"EAFNOSUPPORT (%d): The passed address didn't have the correct address family in its sa_family field.\0A\00"
@.str.4 = [227 x i8] c"EAGAIN (%d): No more free local ports or insufficient entries in the routing cache. For AF_INET see the description of /proc/sys/net/ipv4/ip_local_port_range ip(7) for information on how to increase the number of local ports.\0A\00"
@.str.5 = [104 x i8] c"EALREADY (%d): The socket is nonblocking and a previous connection attempt has not yet been completed.\0A\00"
@.str.6 = [79 x i8] c"EBADF (%d): The file descriptor is not a valid index in the descriptor table.\0A\00"
@.str.7 = [60 x i8] c"ECONNREFUSED (%d): No-one listening on the remote address.\0A\00"
@.str.8 = [80 x i8] c"EFAULT (%d): The socket structure address is outside the user's address space.\0A\00"
@.str.9 = [479 x i8] c"EINPROGRESS (%d): The socket is nonblocking and the connection cannot be completed immediately. It is possible to select(2) or poll(2) for completion by selecting the socket for writing. After select(2) indicates writability, use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET to determine whether connect() completed successfully (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error codes listed here, explaining the reason for the failure).\0A\00"
@.str.10 = [89 x i8] c"EINTR (%d): The system call was interrupted by a signal that was caught; see signal(7).\0A\00"
@.str.11 = [48 x i8] c"EISCONN (%d): The socket is already connected.\0A\00"
@.str.12 = [43 x i8] c"ENETUNREACH (%d): Network is unreachable.\0A\00"
@.str.13 = [69 x i8] c"ENOTSOCK (%d): The file descriptor is not associated with a socket.\0A\00"
@.str.14 = [205 x i8] c"ETIMEDOUT (%d): Timeout while attempting connection. The server may be too busy to accept new connections. Note that for IP sockets the timeout may be very long when syncookies are enabled on the server.\0A\00"
define void @print_errno(i32 %0) {
switch i32 %0, label %32 [
i32 142, label %2
i32 129, label %4
i32 141, label %6
i32 140, label %8
i32 139, label %10
i32 138, label %12
i32 137, label %14
i32 136, label %16
i32 135, label %18
i32 134, label %20
i32 133, label %22
i32 132, label %24
i32 131, label %26
i32 130, label %28
i32 128, label %30
]
2: ; preds = %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([229 x i8], [229 x i8]* @.str, i64 0, i64 0), i32 142)
br label %32
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 129)
br label %32
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i32 141)
br label %32
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.3, i64 0, i64 0), i32 140)
br label %32
10: ; preds = %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([227 x i8], [227 x i8]* @.str.4, i64 0, i64 0), i32 139)
br label %32
12: ; preds = %1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.5, i64 0, i64 0), i32 138)
br label %32
14: ; preds = %1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0), i32 137)
br label %32
16: ; preds = %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i32 136)
br label %32
18: ; preds = %1
%19 = tail call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.8, i64 0, i64 0), i32 135)
br label %32
20: ; preds = %1
%21 = tail call i32 @printf(i8* getelementptr inbounds ([479 x i8], [479 x i8]* @.str.9, i64 0, i64 0), i32 134)
br label %32
22: ; preds = %1
%23 = tail call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.10, i64 0, i64 0), i32 133)
br label %32
24: ; preds = %1
%25 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.11, i64 0, i64 0), i32 132)
br label %32
26: ; preds = %1
%27 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.12, i64 0, i64 0), i32 131)
br label %32
28: ; preds = %1
%29 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.13, i64 0, i64 0), i32 130)
br label %32
30: ; preds = %1
%31 = tail call i32 @printf(i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.14, i64 0, i64 0), i32 128)
br label %32
32: ; preds = %1, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}