#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 */
struct udpsrvsession_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ERR_get_error();
char *ERR_reason_error_string(int /*<<< orphan*/);
#define SSL_ERROR_NONE 135
#define SSL_ERROR_SSL 134
#define SSL_ERROR_SYSCALL 133
#define SSL_ERROR_WANT_ACCEPT 132
#define SSL_ERROR_WANT_CONNECT 131
#define SSL_ERROR_WANT_READ 130
#define SSL_ERROR_WANT_WRITE 129
#define SSL_ERROR_ZERO_RETURN 128
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ udpsrvdtls_destroy(struct udpsrvsession_s *);
void udpsrvdtls_sessionerr(const unsigned long err,
                           struct udpsrvsession_s *session) {
  switch (err) {
  case SSL_ERROR_NONE:
    break;
  case SSL_ERROR_SSL: {
    fprintf(stderr, "SSL_ERROR_SSL: %s\n",
            ERR_reason_error_string(ERR_get_error()));
    fflush(stderr);
  }; break;
  case SSL_ERROR_WANT_READ: {
    fprintf(stderr, "SSL_ERROR_WANT_READ\n");
    fflush(stderr);
  }; break;
  case SSL_ERROR_WANT_WRITE: {
    fprintf(stderr, "SSL_ERROR_WANT_WRITE\n");
    fflush(stderr);
  }; break;
  case SSL_ERROR_SYSCALL: {
    fprintf(stderr, "SSL_ERROR_SYSCALL\n");
    fflush(stderr);
  }; break;
  case SSL_ERROR_ZERO_RETURN: {
    fprintf(stderr, "SSL_ERROR_ZERO_RETURN\n");
    fflush(stderr);
  };
    udpsrvdtls_destroy(session);
    break;
  case SSL_ERROR_WANT_CONNECT: {
    fprintf(stderr, "SSL_ERROR_WANT_CONNECT\n");
    fflush(stderr);
  }; break;
  case SSL_ERROR_WANT_ACCEPT: {
    fprintf(stderr, "SSL_ERROR_WANT_ACCEPT\n");
    fflush(stderr);
  }; break;
  default: {
    fprintf(stderr, "SSL_ERROR_UNKNOWN\n");
    fflush(stderr);
  }; break;
  }
}


x86 assembly (clang, -O0):
<udpsrvdtls_sessionerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffff80,%rax
mov    %rax,-0x18(%rbp)
sub    $0x7,%rax
ja     12d5 <udpsrvdtls_sessionerr+0x185>
mov    -0x18(%rbp),%rax
lea    0xe7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1070 <ERR_get_error@plt>
mov    %eax,%edi
call   1040 <ERR_reason_error_string@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x10(%rbp),%rdi
call   1030 <udpsrvdtls_destroy@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xdf7(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
lea    0xde5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
jmp    12fa <udpsrvdtls_sessionerr+0x1aa>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
lea    0xdd2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2ced(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udpsrvdtls_sessionerr>:
push   %r14
push   %rbx
push   %rax
add    $0xffffffffffffff80,%rdi
cmp    $0x7,%rdi
ja     11a0 <udpsrvdtls_sessionerr+0x50>
lea    0xe9b(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    %rsi,%rbx
mov    0x2e68(%rip),%r14
mov    (%r14),%edi
lea    0xeef(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <udpsrvdtls_destroy@plt>
mov    0x2e39(%rip),%rbx
mov    (%rbx),%edi
lea    0xf07(%rip),%rsi
jmp    120a <udpsrvdtls_sessionerr+0xba>
mov    0x2e27(%rip),%rbx
mov    (%rbx),%edi
lea    0xe86(%rip),%rsi
jmp    120a <udpsrvdtls_sessionerr+0xba>
mov    0x2e15(%rip),%rbx
mov    (%rbx),%edi
lea    0xe5f(%rip),%rsi
jmp    120a <udpsrvdtls_sessionerr+0xba>
mov    0x2e03(%rip),%rbx
mov    (%rbx),%edi
lea    0xea2(%rip),%rsi
jmp    120a <udpsrvdtls_sessionerr+0xba>
mov    0x2df1(%rip),%rbx
mov    (%rbx),%edi
lea    0xea8(%rip),%rsi
jmp    120a <udpsrvdtls_sessionerr+0xba>
mov    0x2ddf(%rip),%rbx
mov    (%rbx),%edi
lea    0xe54(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%rbx),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fflush@plt>
mov    0x2dba(%rip),%r14
mov    (%r14),%ebx
xor    %eax,%eax
call   1070 <ERR_get_error@plt>
mov    %eax,%edi
call   1040 <ERR_reason_error_string@plt>
lea    0xde2(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    (%r14),%edi
jmp    1213 <udpsrvdtls_sessionerr+0xc3>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.udpsrvsession_s = type { i32 }
@stderr = global i32 0
@.str = [19 x i8] c"SSL_ERROR_SSL: %s\0A\00"
@.str.1 = [21 x i8] c"SSL_ERROR_WANT_READ\0A\00"
@.str.2 = [22 x i8] c"SSL_ERROR_WANT_WRITE\0A\00"
@.str.3 = [19 x i8] c"SSL_ERROR_SYSCALL\0A\00"
@.str.4 = [23 x i8] c"SSL_ERROR_ZERO_RETURN\0A\00"
@.str.5 = [24 x i8] c"SSL_ERROR_WANT_CONNECT\0A\00"
@.str.6 = [23 x i8] c"SSL_ERROR_WANT_ACCEPT\0A\00"
@.str.7 = [19 x i8] c"SSL_ERROR_UNKNOWN\0A\00"
define void @udpsrvdtls_sessionerr(i64 %0, %struct.udpsrvsession_s* %1) {
%3 = alloca i64
%4 = alloca %struct.udpsrvsession_s*
store i64 %0, i64* %3
store %struct.udpsrvsession_s* %1, %struct.udpsrvsession_s** %4
%5 = load i64, i64* %3
switch i64 %5, label %46 [
i64 135, label %6
i64 134, label %7
i64 130, label %14
i64 129, label %19
i64 133, label %24
i64 128, label %29
i64 131, label %36
i64 132, label %41
]
6: ; preds = %2
br label %51
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i32 (...) @ERR_get_error()
%10 = call i8* @ERR_reason_error_string(i32 %9)
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 @fflush(i32 %12)
br label %51
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 @fflush(i32 %17)
br label %51
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 @fflush(i32 %22)
br label %51
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = call i32 @fflush(i32 %27)
br label %51
29: ; preds = %2
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%32 = load i32, i32* @stderr
%33 = call i32 @fflush(i32 %32)
%34 = load %struct.udpsrvsession_s*, %struct.udpsrvsession_s** %4
%35 = call i32 @udpsrvdtls_destroy(%struct.udpsrvsession_s* %34)
br label %51
36: ; preds = %2
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = call i32 @fflush(i32 %39)
br label %51
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = call i32 @fflush(i32 %44)
br label %51
46: ; preds = %2
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%49 = load i32, i32* @stderr
%50 = call i32 @fflush(i32 %49)
br label %51
51: ; preds = %46, %41, %36, %29, %24, %19, %14, %7, %6
ret void
}

LLVM IR (-O2):
%struct.udpsrvsession_s = type { i32 }
@stderr = global i32 0
@.str = [19 x i8] c"SSL_ERROR_SSL: %s\0A\00"
@.str.1 = [21 x i8] c"SSL_ERROR_WANT_READ\0A\00"
@.str.2 = [22 x i8] c"SSL_ERROR_WANT_WRITE\0A\00"
@.str.3 = [19 x i8] c"SSL_ERROR_SYSCALL\0A\00"
@.str.4 = [23 x i8] c"SSL_ERROR_ZERO_RETURN\0A\00"
@.str.5 = [24 x i8] c"SSL_ERROR_WANT_CONNECT\0A\00"
@.str.6 = [23 x i8] c"SSL_ERROR_WANT_ACCEPT\0A\00"
@.str.7 = [19 x i8] c"SSL_ERROR_UNKNOWN\0A\00"
define void @udpsrvdtls_sessionerr(i64 %0, %struct.udpsrvsession_s* %1) {
switch i64 %0, label %41 [
i64 135, label %46
i64 134, label %3
i64 130, label %10
i64 129, label %15
i64 133, label %20
i64 128, label %25
i64 131, label %31
i64 132, label %36
]
3: ; preds = %2
%4 = load i32, i32* @stderr
%5 = tail call i32 (...) @ERR_get_error()
%6 = tail call i8* @ERR_reason_error_string(i32 %5)
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fflush(i32 %8)
br label %46
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = tail call i32 @fflush(i32 %13)
br label %46
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 @fflush(i32 %18)
br label %46
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = tail call i32 @fflush(i32 %23)
br label %46
25: ; preds = %2
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = tail call i32 @fflush(i32 %28)
%30 = tail call i32 @udpsrvdtls_destroy(%struct.udpsrvsession_s* %1)
br label %46
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = tail call i32 @fflush(i32 %34)
br label %46
36: ; preds = %2
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = tail call i32 @fflush(i32 %39)
br label %46
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = tail call i32 @fflush(i32 %44)
br label %46
46: ; preds = %41, %36, %31, %25, %20, %15, %10, %3, %2
ret void
}