#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 ECANCELED 129
#define ETIMEDOUT 128
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char *strerror(int);
void err_dsh_send(int err) {
  fprintf(stderr, "error: dsh_send() function call failed\n");
  switch (err) {
  case ECANCELED:
    fprintf(stderr, "       Send operation was cancelled.\n");
    break;
  case ETIMEDOUT:
    fprintf(stderr, "       Send operation timed out waiting for reply.\n");
    break;
  }
  fprintf(stderr, "       errno is: %d\n", err);
  ;
  fprintf(stderr, "       %s\n", strerror(err));
  ;
  fflush(stderr);
}


x86 assembly (clang, -O0):
<err_dsh_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x80,%eax
je     1197 <err_dsh_send+0x67>
jmp    1168 <err_dsh_send+0x38>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
jne    11ae <err_dsh_send+0x7e>
jmp    117b <err_dsh_send+0x4b>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ae <err_dsh_send+0x7e>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strerror@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_dsh_send>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ea3(%rip),%r14
mov    (%r14),%edi
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x81,%ebx
je     1167 <err_dsh_send+0x37>
cmp    $0x80,%ebx
jne    1178 <err_dsh_send+0x48>
lea    0xee9(%rip),%rsi
jmp    116e <err_dsh_send+0x3e>
lea    0xeba(%rip),%rsi
mov    (%r14),%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xf00(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%ebp
mov    %ebx,%edi
call   1050 <strerror@plt>
lea    0xefb(%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 = [40 x i8] c"error: dsh_send() function call failed\0A\00"
@.str.1 = [38 x i8] c" Send operation was cancelled.\0A\00"
@.str.2 = [52 x i8] c" Send operation timed out waiting for reply.\0A\00"
@.str.3 = [21 x i8] c" errno is: %d\0A\00"
@.str.4 = [11 x i8] c" %s\0A\00"
define void @err_dsh_send(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 ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
switch i32 %5, label %12 [
i32 129, label %6
i32 128, label %9
]
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %1, %9, %6
%13 = load i32, i32* @stderr
%14 = load i32, i32* %2
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stderr
%17 = load i32, i32* %2
%18 = call i8* @strerror(i32 %17)
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @stderr
%21 = call i32 @fflush(i32 %20)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"error: dsh_send() function call failed\0A\00"
@.str.1 = [38 x i8] c" Send operation was cancelled.\0A\00"
@.str.2 = [52 x i8] c" Send operation timed out waiting for reply.\0A\00"
@.str.3 = [21 x i8] c" errno is: %d\0A\00"
@.str.4 = [11 x i8] c" %s\0A\00"
define void @err_dsh_send(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %9 [
i32 129, label %5
i32 128, label %4
]
4: ; preds = %1
br label %5
5: ; preds = %1, %4
%6 = phi i8* [ getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), %1 ]
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* %6)
br label %9
9: ; preds = %5, %1
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %0)
%12 = load i32, i32* @stderr
%13 = tail call i8* @strerror(i32 %0)
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @stderr
%16 = tail call i32 @fflush(i32 %15)
ret void
}