#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 138
#define EBADF 137
#define ECONNRESET 136
#define EFAULT 135
#define EINTR 134
#define EINVAL 133
#define EMSGSIZE 132
#define ENOTCONN 131
#define ENOTSOCK 130
#define EOPNOTSUPP 129
#define EPIPE 128
int /*<<< orphan*/ info_log(char *, ...);
void send_error(int err) {
  switch (err) {
  case EBADF: {
    info_log("send error: EBADF (bad file descriptor)\n");
    return;
  }
  case EAGAIN: {
    info_log("send error: EAGAIN(would have blocked)\n");
    return;
  }
  case ECONNRESET: {
    info_log("send error: ECONNRESET(connection reset by peer)\n");
    return;
  }
  case EFAULT: {
    info_log("send error: EFAULT(invalid userspace address)\n");
    return;
  }
  case EINTR: {
    info_log("send error: EINTR(Interrupted by signal)\n");
    return;
  }
  case EINVAL: {
    info_log("send error: EINVAL(Invalid arguement)\n");
    return;
  }
  case EMSGSIZE: {
    info_log("send error: EMSGSIZE(message size too big)\n");
    return;
  }
  case ENOTSOCK: {
    info_log("send error: ENOTSOCK:(not a socket)\n");
    return;
  }
  case ENOTCONN: {
    info_log("send error: ENOTCONN:(socket not connected\n");
    return;
  }
  case EOPNOTSUPP: {
    info_log("send error: EOPNOTSUPP\n");
    return;
  }
  case EPIPE: {
    info_log("send error: EPIPE\n");
    return;
  }
  default: {
    info_log("Send: (%i)unknown errror\n", err);
    return;
  }
  }
}


x86 assembly (clang, -O0):
<send_error>:
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    $0xa,%eax
ja     1215 <send_error+0x105>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf0c(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf2b(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf47(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf72(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf8b(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xf9d(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xfb6(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
lea    0xfbb(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
jmp    1226 <send_error+0x116>
mov    -0x4(%rbp),%esi
lea    0xfb8(%rip),%rdi
mov    $0x0,%al
call   1030 <info_log@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_error>:
mov    %edi,%esi
lea    -0x80(%rsi),%eax
cmp    $0xa,%eax
ja     1138 <send_error+0x28>
lea    0xedf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x1093(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0x1098(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0x105f(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0x1000(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0x1017(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xfb8(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xf83(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xf4b(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xf0e(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xe6f(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
jmp    1030 <info_log@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"send error: EBADF (bad file descriptor)\0A\00"
@.str.1 = [40 x i8] c"send error: EAGAIN(would have blocked)\0A\00"
@.str.2 = [50 x i8] c"send error: ECONNRESET(connection reset by peer)\0A\00"
@.str.3 = [47 x i8] c"send error: EFAULT(invalid userspace address)\0A\00"
@.str.4 = [42 x i8] c"send error: EINTR(Interrupted by signal)\0A\00"
@.str.5 = [39 x i8] c"send error: EINVAL(Invalid arguement)\0A\00"
@.str.6 = [44 x i8] c"send error: EMSGSIZE(message size too big)\0A\00"
@.str.7 = [37 x i8] c"send error: ENOTSOCK:(not a socket)\0A\00"
@.str.8 = [44 x i8] c"send error: ENOTCONN:(socket not connected\0A\00"
@.str.9 = [24 x i8] c"send error: EOPNOTSUPP\0A\00"
@.str.10 = [19 x i8] c"send error: EPIPE\0A\00"
@.str.11 = [26 x i8] c"Send: (%i)unknown errror\0A\00"
define void @send_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %26 [
i32 137, label %4
i32 138, label %6
i32 136, label %8
i32 135, label %10
i32 134, label %12
i32 133, label %14
i32 132, label %16
i32 130, label %18
i32 131, label %20
i32 129, label %22
i32 128, label %24
]
4: ; preds = %1
%5 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %29
6: ; preds = %1
%7 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %29
8: ; preds = %1
%9 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %29
10: ; preds = %1
%11 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
br label %29
12: ; preds = %1
%13 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %29
14: ; preds = %1
%15 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %29
16: ; preds = %1
%17 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0))
br label %29
18: ; preds = %1
%19 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
br label %29
20: ; preds = %1
%21 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
br label %29
22: ; preds = %1
%23 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %29
24: ; preds = %1
%25 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %29
26: ; preds = %1
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"send error: EBADF (bad file descriptor)\0A\00"
@.str.1 = [40 x i8] c"send error: EAGAIN(would have blocked)\0A\00"
@.str.2 = [50 x i8] c"send error: ECONNRESET(connection reset by peer)\0A\00"
@.str.3 = [47 x i8] c"send error: EFAULT(invalid userspace address)\0A\00"
@.str.4 = [42 x i8] c"send error: EINTR(Interrupted by signal)\0A\00"
@.str.5 = [39 x i8] c"send error: EINVAL(Invalid arguement)\0A\00"
@.str.6 = [44 x i8] c"send error: EMSGSIZE(message size too big)\0A\00"
@.str.7 = [37 x i8] c"send error: ENOTSOCK:(not a socket)\0A\00"
@.str.8 = [44 x i8] c"send error: ENOTCONN:(socket not connected\0A\00"
@.str.9 = [24 x i8] c"send error: EOPNOTSUPP\0A\00"
@.str.10 = [19 x i8] c"send error: EPIPE\0A\00"
@.str.11 = [26 x i8] c"Send: (%i)unknown errror\0A\00"
define void @send_error(i32 %0) {
switch i32 %0, label %24 [
i32 137, label %2
i32 138, label %4
i32 136, label %6
i32 135, label %8
i32 134, label %10
i32 133, label %12
i32 132, label %14
i32 130, label %16
i32 131, label %18
i32 129, label %20
i32 128, label %22
]
2: ; preds = %1
%3 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %26
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %26
6: ; preds = %1
%7 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
br label %26
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
br label %26
10: ; preds = %1
%11 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %26
12: ; preds = %1
%13 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %26
14: ; preds = %1
%15 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0))
br label %26
16: ; preds = %1
%17 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
br label %26
18: ; preds = %1
%19 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
br label %26
20: ; preds = %1
%21 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %26
22: ; preds = %1
%23 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
br label %26
24: ; preds = %1
%25 = tail call i32 (i8*, ...) @info_log(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), i32 %0)
br label %26
26: ; preds = %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}