#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 */
scalar_t__ ECONNRESET;
scalar_t__ EHOSTUNREACH;
scalar_t__ ENETUNREACH;
scalar_t__ ETIMEDOUT;
scalar_t__ EWOULDBLOCK;
scalar_t__ errno;
int /*<<< orphan*/ traceprint(char *, ...);
void tcp_get_err_output(int rtn_num) {
  if (errno == ECONNRESET) {
    traceprint("Socket: Rg server is closed before client send request!\n");
  } else if ((errno == ETIMEDOUT) || (errno == EHOSTUNREACH) ||
             (errno == ENETUNREACH)) {
    traceprint("Socket: Rg server is breakdown before client send request!\n");
  } else if (errno == EWOULDBLOCK) {
    traceprint("Socket: Rg server is breakdown after client send request, "
               "before client receive response!\n");
  } else {
    traceprint("Socket: Client receive response error for unknown reason!\n");
  }
  switch (rtn_num) {
  case (-4):
    traceprint("Socket: Socket has disconnected! (ErrNum = %d)!\n", rtn_num);
    break;
  case (-2):
    traceprint("Socket: Socket has quit! (ErrNum = %d)!\n", rtn_num);
    break;
  case (-1):
    traceprint("Socket: System i/o error! (ErrNum = %d)!\n", rtn_num);
    break;
  default:
    traceprint("Socket: Client receive response error for UNKNOWN reason "
               "(ErrNum = %d)!\n",
               rtn_num);
    break;
  }
}


x86 assembly (clang, -O0):
<tcp_get_err_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%rax
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%rax
jne    1148 <tcp_get_err_output+0x38>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    11ee <tcp_get_err_output+0xde>
mov    0x2e79(%rip),%rax
mov    (%rax),%rax
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
je     1196 <tcp_get_err_output+0x86>
mov    0x2e5f(%rip),%rax
mov    (%rax),%rax
mov    0x2e6d(%rip),%rcx
cmp    (%rcx),%rax
je     1196 <tcp_get_err_output+0x86>
mov    0x2e45(%rip),%rax
mov    (%rax),%rax
mov    0x2e5b(%rip),%rcx
cmp    (%rcx),%rax
jne    11a9 <tcp_get_err_output+0x99>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    11e9 <tcp_get_err_output+0xd9>
mov    0x2e18(%rip),%rax
mov    (%rax),%rax
mov    0x2e06(%rip),%rcx
cmp    (%rcx),%rax
jne    11d6 <tcp_get_err_output+0xc6>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    11e4 <tcp_get_err_output+0xd4>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    11e9 <tcp_get_err_output+0xd9>
jmp    11ee <tcp_get_err_output+0xde>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xfffffffc,%eax
je     1224 <tcp_get_err_output+0x114>
jmp    1202 <tcp_get_err_output+0xf2>
mov    -0x8(%rbp),%eax
sub    $0xfffffffe,%eax
je     123a <tcp_get_err_output+0x12a>
jmp    1213 <tcp_get_err_output+0x103>
mov    -0x8(%rbp),%eax
sub    $0xffffffff,%eax
je     1250 <tcp_get_err_output+0x140>
jmp    1266 <tcp_get_err_output+0x156>
mov    -0x4(%rbp),%esi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    1277 <tcp_get_err_output+0x167>
mov    -0x4(%rbp),%esi
lea    0xef8(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    1277 <tcp_get_err_output+0x167>
mov    -0x4(%rbp),%esi
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
jmp    1277 <tcp_get_err_output+0x167>
mov    -0x4(%rbp),%esi
lea    0xf1f(%rip),%rdi
mov    $0x0,%al
call   1030 <traceprint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_get_err_output>:
push   %rbx
mov    %edi,%ebx
mov    0x2eae(%rip),%rax
mov    (%rax),%rax
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%rax
jne    1132 <tcp_get_err_output+0x22>
lea    0xed0(%rip),%rdi
jmp    1179 <tcp_get_err_output+0x69>
mov    0x2e7f(%rip),%rcx
lea    0xef9(%rip),%rdi
cmp    (%rcx),%rax
je     1179 <tcp_get_err_output+0x69>
mov    0x2e94(%rip),%rcx
cmp    (%rcx),%rax
je     1179 <tcp_get_err_output+0x69>
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
je     1179 <tcp_get_err_output+0x69>
mov    0x2e5c(%rip),%rcx
cmp    (%rcx),%rax
lea    0xf07(%rip),%rax
lea    0xf5b(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1030 <traceprint@plt>
cmp    $0xffffffff,%ebx
je     119d <tcp_get_err_output+0x8d>
cmp    $0xfffffffe,%ebx
je     11ab <tcp_get_err_output+0x9b>
cmp    $0xfffffffc,%ebx
jne    11b9 <tcp_get_err_output+0xa9>
lea    0xf75(%rip),%rdi
mov    $0xfffffffc,%esi
jmp    11c2 <tcp_get_err_output+0xb2>
lea    0xfc1(%rip),%rdi
mov    $0xffffffff,%esi
jmp    11c2 <tcp_get_err_output+0xb2>
lea    0xf8a(%rip),%rdi
mov    $0xfffffffe,%esi
jmp    11c2 <tcp_get_err_output+0xb2>
lea    0xfcf(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <traceprint@plt>

LLVM IR (-O0):
@errno = global i64 0
@ECONNRESET = global i64 0
@.str = [57 x i8] c"Socket: Rg server is closed before client send request!\0A\00"
@ETIMEDOUT = global i64 0
@EHOSTUNREACH = global i64 0
@ENETUNREACH = global i64 0
@.str.1 = [60 x i8] c"Socket: Rg server is breakdown before client send request!\0A\00"
@EWOULDBLOCK = global i64 0
@.str.2 = [91 x i8] c"Socket: Rg server is breakdown after client send request, before client receive response!\0A\00"
@.str.3 = [59 x i8] c"Socket: Client receive response error for unknown reason!\0A\00"
@.str.4 = [49 x i8] c"Socket: Socket has disconnected! (ErrNum = %d)!\0A\00"
@.str.5 = [41 x i8] c"Socket: Socket has quit! (ErrNum = %d)!\0A\00"
@.str.6 = [42 x i8] c"Socket: System i/o error! (ErrNum = %d)!\0A\00"
@.str.7 = [73 x i8] c"Socket: Client receive response error for UNKNOWN reason (ErrNum = %d)!\0A\00"
define void @tcp_get_err_output(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i64, i64* @errno
%4 = load i64, i64* @ECONNRESET
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
br label %32
8: ; preds = %1
%9 = load i64, i64* @errno
%10 = load i64, i64* @ETIMEDOUT
%11 = icmp eq i64 %9, %10
br i1 %11, label %20, label %12
12: ; preds = %8
%13 = load i64, i64* @errno
%14 = load i64, i64* @EHOSTUNREACH
%15 = icmp eq i64 %13, %14
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i64, i64* @errno
%18 = load i64, i64* @ENETUNREACH
%19 = icmp eq i64 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %16, %12, %8
%21 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
br label %31
22: ; preds = %16
%23 = load i64, i64* @errno
%24 = load i64, i64* @EWOULDBLOCK
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.2, i64 0, i64 0))
br label %30
28: ; preds = %22
%29 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %20
br label %32
32: ; preds = %31, %6
%33 = load i32, i32* %2
switch i32 %33, label %43 [
i32 -4, label %34
i32 -2, label %37
i32 -1, label %40
]
34: ; preds = %32
%35 = load i32, i32* %2
%36 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 %35)
br label %46
37: ; preds = %32
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %38)
br label %46
40: ; preds = %32
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %41)
br label %46
43: ; preds = %32
%44 = load i32, i32* %2
%45 = call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %43, %40, %37, %34
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@ECONNRESET = global i64 0
@.str = [57 x i8] c"Socket: Rg server is closed before client send request!\0A\00"
@ETIMEDOUT = global i64 0
@EHOSTUNREACH = global i64 0
@ENETUNREACH = global i64 0
@.str.1 = [60 x i8] c"Socket: Rg server is breakdown before client send request!\0A\00"
@EWOULDBLOCK = global i64 0
@.str.2 = [91 x i8] c"Socket: Rg server is breakdown after client send request, before client receive response!\0A\00"
@.str.3 = [59 x i8] c"Socket: Client receive response error for unknown reason!\0A\00"
@.str.4 = [49 x i8] c"Socket: Socket has disconnected! (ErrNum = %d)!\0A\00"
@.str.5 = [41 x i8] c"Socket: Socket has quit! (ErrNum = %d)!\0A\00"
@.str.6 = [42 x i8] c"Socket: System i/o error! (ErrNum = %d)!\0A\00"
@.str.7 = [73 x i8] c"Socket: Client receive response error for UNKNOWN reason (ErrNum = %d)!\0A\00"
define void @tcp_get_err_output(i32 %0) {
%2 = load i64, i64* @errno
%3 = load i64, i64* @ECONNRESET
%4 = icmp eq i64 %2, %3
br i1 %4, label %18, label %5
5: ; preds = %1
%6 = load i64, i64* @ETIMEDOUT
%7 = icmp eq i64 %2, %6
%8 = load i64, i64* @EHOSTUNREACH
%9 = icmp eq i64 %2, %8
%10 = select i1 %7, i1 true, i1 %9
%11 = load i64, i64* @ENETUNREACH
%12 = icmp eq i64 %2, %11
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %18, label %14
14: ; preds = %5
%15 = load i64, i64* @EWOULDBLOCK
%16 = icmp eq i64 %2, %15
%17 = select i1 %16, i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0)
br label %18
18: ; preds = %14, %5, %1
%19 = phi i8* [ getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0), %5 ], [ %17, %14 ]
%20 = tail call i32 (i8*, ...) @traceprint(i8* %19)
switch i32 %0, label %27 [
i32 -4, label %21
i32 -2, label %23
i32 -1, label %25
]
21: ; preds = %18
%22 = tail call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i32 -4)
br label %29
23: ; preds = %18
%24 = tail call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 -2)
br label %29
25: ; preds = %18
%26 = tail call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 -1)
br label %29
27: ; preds = %18
%28 = tail call i32 (i8*, ...) @traceprint(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0), i32 %0)
br label %29
29: ; preds = %27, %25, %23, %21
ret void
}