#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 EAGAIN 134
#define EBADF 133
#define ECONNREFUSED 132
#define EFAULT 131
#define EINVAL 130
#define ENOMEM 129
#define ENOTSOCK 128
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
void err_recvfrom(int err) {
  fprintf(stderr, "error: recvfrom(2) syscall failed\n");
  switch (err) {
  case EAGAIN:
    fprintf(stderr, "       The  socket  is  marked  non-blocking  and the "
                    "receive operation\n");
    fprintf(stderr, "       would block, or a receive timeout had been set and "
                    " the  timeout\n");
    fprintf(stderr, "       expired before data was received.\n");
    break;
  case EBADF:
    fprintf(stderr, "       The argument s is an invalid descriptor.\n");
    break;
  case ECONNREFUSED:
    fprintf(stderr, "       A remote host refused to allow the network "
                    "connection (typically\n");
    fprintf(stderr,
            "       because it is not running the requested service).\n");
    break;
  case EFAULT:
    fprintf(stderr, "       The  receive  was interrupted by delivery of a "
                    "signal before any\n");
    fprintf(stderr, "       data were available.\n");
    break;
  case EINVAL:
    fprintf(stderr, "       Invalid argument passed.\n");
    break;
  case ENOMEM:
    fprintf(stderr, "       The socket is associated with a "
                    "connection-oriented protocol and\n");
    fprintf(stderr,
            "       has not been connected (see connect(2) and accept(2)).\n");
    break;
  case ENOTSOCK:
    fprintf(stderr, "       The argument s does not refer to a socket.\n");
    break;
  }
  fprintf(stderr, "       errno is: %d\n", err);
  ;
  fprintf(stderr, "       %s\n", strerror(err));
  ;
  fflush(stderr);
}


x86 assembly (clang, -O0):
<err_recvfrom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     12ad <err_recvfrom+0x17d>
mov    -0x10(%rbp),%rax
lea    0xe8e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xf18(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xf26(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
lea    0xf3b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xf6d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xf8b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xfbd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
lea    0xfbe(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2d76(%rip),%rax
mov    (%rax),%edi
lea    0xfc3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
lea    0xff5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    12ad <err_recvfrom+0x17d>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
lea    0x1018(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0x1031(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0x101e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_recvfrom>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ea3(%rip),%r14
mov    (%r14),%edi
lea    0xed5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    -0x80(%rbx),%eax
cmp    $0x6,%eax
ja     1207 <err_recvfrom+0xd7>
lea    0xf9a(%rip),%rsi
lea    0xe98(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1146(%rip),%rsi
jmp    11fd <err_recvfrom+0xcd>
mov    (%r14),%edi
lea    0x10af(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x10ea(%rip),%rsi
jmp    11fd <err_recvfrom+0xcd>
lea    0x1077(%rip),%rsi
jmp    11fd <err_recvfrom+0xcd>
mov    (%r14),%edi
lea    0x1005(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0x1040(%rip),%rsi
jmp    11fd <err_recvfrom+0xcd>
mov    (%r14),%edi
lea    0xf68(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xfa3(%rip),%rsi
jmp    11fd <err_recvfrom+0xcd>
mov    (%r14),%edi
lea    0xe61(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xe99(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xed4(%rip),%rsi
mov    (%r14),%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0x10e0(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %ebx,%edi
call   1050 <strerror@plt>
lea    0x10db(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"error: recvfrom(2) syscall failed\0A\00"
@.str.1 = [73 x i8] c" The socket is marked non-blocking and the receive operation\0A\00"
@.str.2 = [73 x i8] c" would block, or a receive timeout had been set and the timeout\0A\00"
@.str.3 = [42 x i8] c" expired before data was received.\0A\00"
@.str.4 = [49 x i8] c" The argument s is an invalid descriptor.\0A\00"
@.str.5 = [73 x i8] c" A remote host refused to allow the network connection (typically\0A\00"
@.str.6 = [58 x i8] c" because it is not running the requested service).\0A\00"
@.str.7 = [73 x i8] c" The receive was interrupted by delivery of a signal before any\0A\00"
@.str.8 = [29 x i8] c" data were available.\0A\00"
@.str.9 = [33 x i8] c" Invalid argument passed.\0A\00"
@.str.10 = [73 x i8] c" The socket is associated with a connection-oriented protocol and\0A\00"
@.str.11 = [63 x i8] c" has not been connected (see connect(2) and accept(2)).\0A\00"
@.str.12 = [51 x i8] c" The argument s does not refer to a socket.\0A\00"
@.str.13 = [21 x i8] c" errno is: %d\0A\00"
@.str.14 = [11 x i8] c" %s\0A\00"
define void @err_recvfrom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
switch i32 %5, label %37 [
i32 134, label %6
i32 133, label %13
i32 132, label %16
i32 131, label %21
i32 130, label %26
i32 129, label %29
i32 128, label %34
]
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %37
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
br label %37
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0))
br label %37
21: ; preds = %1
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
br label %37
26: ; preds = %1
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0))
br label %37
29: ; preds = %1
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.10, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.11, i64 0, i64 0))
br label %37
34: ; preds = %1
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0))
br label %37
37: ; preds = %1, %34, %29, %26, %21, %16, %13, %6
%38 = load i32, i32* @stderr
%39 = load i32, i32* %2
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %39)
%41 = load i32, i32* @stderr
%42 = load i32, i32* %2
%43 = call i8* @strerror(i32 %42)
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @stderr
%46 = call i32 @fflush(i32 %45)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"error: recvfrom(2) syscall failed\0A\00"
@.str.1 = [73 x i8] c" The socket is marked non-blocking and the receive operation\0A\00"
@.str.2 = [73 x i8] c" would block, or a receive timeout had been set and the timeout\0A\00"
@.str.3 = [42 x i8] c" expired before data was received.\0A\00"
@.str.4 = [49 x i8] c" The argument s is an invalid descriptor.\0A\00"
@.str.5 = [73 x i8] c" A remote host refused to allow the network connection (typically\0A\00"
@.str.6 = [58 x i8] c" because it is not running the requested service).\0A\00"
@.str.7 = [73 x i8] c" The receive was interrupted by delivery of a signal before any\0A\00"
@.str.8 = [29 x i8] c" data were available.\0A\00"
@.str.9 = [33 x i8] c" Invalid argument passed.\0A\00"
@.str.10 = [73 x i8] c" The socket is associated with a connection-oriented protocol and\0A\00"
@.str.11 = [63 x i8] c" has not been connected (see connect(2) and accept(2)).\0A\00"
@.str.12 = [51 x i8] c" The argument s does not refer to a socket.\0A\00"
@.str.13 = [21 x i8] c" errno is: %d\0A\00"
@.str.14 = [11 x i8] c" %s\0A\00"
define void @err_recvfrom(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %24 [
i32 134, label %4
i32 133, label %20
i32 132, label %9
i32 131, label %12
i32 130, label %15
i32 129, label %16
i32 128, label %19
]
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
br label %20
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.5, i64 0, i64 0))
br label %20
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0))
br label %20
15: ; preds = %1
br label %20
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.10, i64 0, i64 0))
br label %20
19: ; preds = %1
br label %20
20: ; preds = %1, %4, %9, %12, %15, %16, %19
%21 = phi i8* [ getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0), %19 ], [ getelementptr inbounds ([63 x i8], [63 x i8]* @.str.11, i64 0, i64 0), %16 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), %15 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), %12 ], [ getelementptr inbounds ([58 x i8], [58 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), %1 ]
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* %21)
br label %24
24: ; preds = %20, %1
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0), i32 %0)
%27 = load i32, i32* @stderr
%28 = tail call i8* @strerror(i32 %0)
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* %28)
%30 = load i32, i32* @stderr
%31 = tail call i32 @fflush(i32 %30)
ret void
}