#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 */
int /*<<< orphan*/ printf(char *);
void process_ssl_alert(char *sslalert, char *c1, char *c2, char *c3,
                       int verbose) {
  if (verbose > 0) {
    switch (sslalert[06]) {
    case 0:
      printf("CloseNotify\n");
      break;
    case 10:
      printf("UnexpectedMessage\n");
      break;
    case 20:
      printf("BadRecordMAC\n");
      break;
    case 21:
      printf("DecryptionFailed\n");
      break;
    case 22:
      printf("RecordOverflow\n");
      break;
    case 30:
      printf("DecompressionFailure\n");
      break;
    case 40:
      printf("HandshakeFailure\n");
      break;
    case 41:
      printf("NoCertificate\n");
      break;
    case 42:
      printf("BadCertificate\n");
      break;
    case 43:
      printf("UnsupportedCertificate\n");
      break;
    case 44:
      printf("CertificateRevoked\n");
      break;
    case 45:
      printf("CertificateExpired\n");
      break;
    case 46:
      printf("CertificateUnknown\n");
      break;
    case 47:
      printf("IllegalParameter\n");
      break;
    case 48:
      printf("UnknownCA\n");
      break;
    case 49:
      printf("AccessDenied\n");
      break;
    case 50:
      printf("DecodeError\n");
      break;
    case 51:
      printf("DecryptError\n");
      break;
    case 60:
      printf("ExportRestriction\n");
      break;
    case 70:
      printf("ProtocolVersion\n");
      break;
    case 71:
      printf("InsufficientSecurity\n");
      break;
    default:
      printf("UNKNOWN SSL ERROR\n");
      break;
    }
  }
}


x86 assembly (clang, -O0):
<process_ssl_alert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    12d7 <process_ssl_alert+0x1c7>
mov    -0x8(%rbp),%rax
movsbl 0x6(%rax),%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x47,%eax
ja     12c6 <process_ssl_alert+0x1b6>
mov    -0x30(%rbp),%rax
lea    0xea8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xfb8(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb4(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb6(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb3(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb4(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb3(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb8(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb9(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb7(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb6(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfbd(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfc0(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfc3(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfc6(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfc7(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfc1(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfbe(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfba(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb7(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb9(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfb9(%rip),%rdi
call   1030 <printf@plt>
jmp    12d2 <process_ssl_alert+0x1c2>
lea    0xfbe(%rip),%rdi
call   1030 <printf@plt>
jmp    12d7 <process_ssl_alert+0x1c7>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_ssl_alert>:
test   %r8d,%r8d
jle    1141 <process_ssl_alert+0x31>
movsbl 0x6(%rdi),%eax
cmp    $0x47,%eax
ja     1142 <process_ssl_alert+0x32>
lea    0x1145(%rip),%rdi
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x111c(%rip),%rdi
jmp    1030 <puts@plt>
ret
lea    0x112d(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x10f6(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x10d9(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x10be(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x109d(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1080(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1066(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x104b(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1028(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1009(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfea(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfcb(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xfae(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf98(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf7f(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf67(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf4e(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf30(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xf14(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xef3(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"CloseNotify\0A\00"
@.str.1 = [19 x i8] c"UnexpectedMessage\0A\00"
@.str.2 = [14 x i8] c"BadRecordMAC\0A\00"
@.str.3 = [18 x i8] c"DecryptionFailed\0A\00"
@.str.4 = [16 x i8] c"RecordOverflow\0A\00"
@.str.5 = [22 x i8] c"DecompressionFailure\0A\00"
@.str.6 = [18 x i8] c"HandshakeFailure\0A\00"
@.str.7 = [15 x i8] c"NoCertificate\0A\00"
@.str.8 = [16 x i8] c"BadCertificate\0A\00"
@.str.9 = [24 x i8] c"UnsupportedCertificate\0A\00"
@.str.10 = [20 x i8] c"CertificateRevoked\0A\00"
@.str.11 = [20 x i8] c"CertificateExpired\0A\00"
@.str.12 = [20 x i8] c"CertificateUnknown\0A\00"
@.str.13 = [18 x i8] c"IllegalParameter\0A\00"
@.str.14 = [11 x i8] c"UnknownCA\0A\00"
@.str.15 = [14 x i8] c"AccessDenied\0A\00"
@.str.16 = [13 x i8] c"DecodeError\0A\00"
@.str.17 = [14 x i8] c"DecryptError\0A\00"
@.str.18 = [19 x i8] c"ExportRestriction\0A\00"
@.str.19 = [17 x i8] c"ProtocolVersion\0A\00"
@.str.20 = [22 x i8] c"InsufficientSecurity\0A\00"
@.str.21 = [19 x i8] c"UNKNOWN SSL ERROR\0A\00"
define void @process_ssl_alert(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %63
13: ; preds = %5
%14 = load i8*, i8** %6
%15 = getelementptr inbounds i8, i8* %14, i64 6
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %60 [
i32 0, label %18
i32 10, label %20
i32 20, label %22
i32 21, label %24
i32 22, label %26
i32 30, label %28
i32 40, label %30
i32 41, label %32
i32 42, label %34
i32 43, label %36
i32 44, label %38
i32 45, label %40
i32 46, label %42
i32 47, label %44
i32 48, label %46
i32 49, label %48
i32 50, label %50
i32 51, label %52
i32 60, label %54
i32 70, label %56
i32 71, label %58
]
18: ; preds = %13
%19 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %62
20: ; preds = %13
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %62
22: ; preds = %13
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %62
24: ; preds = %13
%25 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %62
26: ; preds = %13
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %62
28: ; preds = %13
%29 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %62
30: ; preds = %13
%31 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
br label %62
32: ; preds = %13
%33 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %62
34: ; preds = %13
%35 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %62
36: ; preds = %13
%37 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
br label %62
38: ; preds = %13
%39 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %62
40: ; preds = %13
%41 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
br label %62
42: ; preds = %13
%43 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %62
44: ; preds = %13
%45 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.13, i64 0, i64 0))
br label %62
46: ; preds = %13
%47 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
br label %62
48: ; preds = %13
%49 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0))
br label %62
50: ; preds = %13
%51 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0))
br label %62
52: ; preds = %13
%53 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
br label %62
54: ; preds = %13
%55 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %62
56: ; preds = %13
%57 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.19, i64 0, i64 0))
br label %62
58: ; preds = %13
%59 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.20, i64 0, i64 0))
br label %62
60: ; preds = %13
%61 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
br label %62
62: ; preds = %60, %58, %56, %54, %52, %50, %48, %46, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18
br label %63
63: ; preds = %62, %5
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"InsufficientSecurity\00"
@str.22 = [16 x i8] c"ProtocolVersion\00"
@str.23 = [18 x i8] c"ExportRestriction\00"
@str.24 = [13 x i8] c"DecryptError\00"
@str.25 = [12 x i8] c"DecodeError\00"
@str.26 = [13 x i8] c"AccessDenied\00"
@str.27 = [10 x i8] c"UnknownCA\00"
@str.28 = [17 x i8] c"IllegalParameter\00"
@str.29 = [19 x i8] c"CertificateUnknown\00"
@str.30 = [19 x i8] c"CertificateExpired\00"
@str.31 = [19 x i8] c"CertificateRevoked\00"
@str.32 = [23 x i8] c"UnsupportedCertificate\00"
@str.33 = [15 x i8] c"BadCertificate\00"
@str.34 = [14 x i8] c"NoCertificate\00"
@str.35 = [17 x i8] c"HandshakeFailure\00"
@str.36 = [21 x i8] c"DecompressionFailure\00"
@str.37 = [15 x i8] c"RecordOverflow\00"
@str.38 = [17 x i8] c"DecryptionFailed\00"
@str.39 = [13 x i8] c"BadRecordMAC\00"
@str.40 = [18 x i8] c"UnexpectedMessage\00"
@str.41 = [12 x i8] c"CloseNotify\00"
@str.42 = [18 x i8] c"UNKNOWN SSL ERROR\00"
define void @process_ssl_alert(i8* nocapture %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i32 %4) {
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %35
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %0, i64 6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %31 [
i32 0, label %32
i32 10, label %11
i32 20, label %12
i32 21, label %13
i32 22, label %14
i32 30, label %15
i32 40, label %16
i32 41, label %17
i32 42, label %18
i32 43, label %19
i32 44, label %20
i32 45, label %21
i32 46, label %22
i32 47, label %23
i32 48, label %24
i32 49, label %25
i32 50, label %26
i32 51, label %27
i32 60, label %28
i32 70, label %29
i32 71, label %30
]
11: ; preds = %7
br label %32
12: ; preds = %7
br label %32
13: ; preds = %7
br label %32
14: ; preds = %7
br label %32
15: ; preds = %7
br label %32
16: ; preds = %7
br label %32
17: ; preds = %7
br label %32
18: ; preds = %7
br label %32
19: ; preds = %7
br label %32
20: ; preds = %7
br label %32
21: ; preds = %7
br label %32
22: ; preds = %7
br label %32
23: ; preds = %7
br label %32
24: ; preds = %7
br label %32
25: ; preds = %7
br label %32
26: ; preds = %7
br label %32
27: ; preds = %7
br label %32
28: ; preds = %7
br label %32
29: ; preds = %7
br label %32
30: ; preds = %7
br label %32
31: ; preds = %7
br label %32
32: ; preds = %7, %31, %30, %29, %28, %27, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11
%33 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.40, i64 0, i64 0), %11 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.39, i64 0, i64 0), %12 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.38, i64 0, i64 0), %13 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.37, i64 0, i64 0), %14 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.36, i64 0, i64 0), %15 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.35, i64 0, i64 0), %16 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str.34, i64 0, i64 0), %17 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @str.33, i64 0, i64 0), %18 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.32, i64 0, i64 0), %19 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.31, i64 0, i64 0), %20 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.30, i64 0, i64 0), %21 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.29, i64 0, i64 0), %22 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.28, i64 0, i64 0), %23 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.27, i64 0, i64 0), %24 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.26, i64 0, i64 0), %25 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.25, i64 0, i64 0), %26 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str.24, i64 0, i64 0), %27 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.23, i64 0, i64 0), %28 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.22, i64 0, i64 0), %29 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %30 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.42, i64 0, i64 0), %31 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.41, i64 0, i64 0), %7 ]
%34 = tail call i32 @puts(i8* dereferenceable(1) %33)
br label %35
35: ; preds = %32, %5
ret void
}