#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*/ log_print(char *, char);
int /*<<< orphan*/ reinit();
int /*<<< orphan*/ ui_config(char *);
int /*<<< orphan*/ ui_connect(char *);
int /*<<< orphan*/ ui_debug(char *);
int /*<<< orphan*/ ui_delete(char *);
int /*<<< orphan*/ ui_packetlog(char *);
int /*<<< orphan*/ ui_report(char *);
int /*<<< orphan*/ ui_report_sa(char *);
int /*<<< orphan*/ ui_setmode(char *);
int /*<<< orphan*/ ui_shutdown_daemon(char *);
int /*<<< orphan*/ ui_teardown(char *);
int /*<<< orphan*/ ui_teardown_all(char *);
void ui_handle_command(char *line) {
  switch (line[0]) {
  case 'c':
    ui_connect(line);
    break;
  case 'C':
    ui_config(line);
    break;
  case 'd':
    ui_delete(line);
    break;
  case 'D':
    ui_debug(line);
    break;
  case 'M':
    ui_setmode(line);
    break;
  case 'p':
    ui_packetlog(line);
    break;
  case 'Q':
    ui_shutdown_daemon(line);
    break;
  case 'R':
    reinit();
    break;
  case 'S':
    ui_report_sa(line);
    break;
  case 'r':
    ui_report(line);
    break;
  case 't':
    ui_teardown(line);
    break;
  case 'T':
    ui_teardown_all(line);
    break;
  default:
    log_print("ui_handle_messages: unrecognized command: '%c'", line[0]);
  }
}


x86 assembly (clang, -O0):
<ui_handle_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x31,%eax
ja     12af <ui_handle_command+0xdf>
mov    -0x10(%rbp),%rax
lea    0xe00(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
call   10c0 <ui_connect@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   10b0 <ui_config@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1070 <ui_delete@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   10e0 <ui_debug@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1060 <ui_setmode@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1090 <ui_packetlog@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1030 <ui_shutdown_daemon@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    $0x0,%al
call   10a0 <reinit@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1040 <ui_report_sa@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   1050 <ui_report@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   10d0 <ui_teardown@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rdi
call   10f0 <ui_teardown_all@plt>
jmp    12c2 <ui_handle_command+0xf2>
mov    -0x8(%rbp),%rax
lea    0xe0e(%rip),%rdi
movsbl (%rax),%esi
call   1080 <log_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_handle_command>:
movsbl (%rdi),%eax
lea    -0x43(%rax),%ecx
cmp    $0x31,%ecx
ja     11f5 <ui_handle_command+0x25>
lea    0xe1e(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
jmp    10b0 <ui_config@plt>
jmp    10e0 <ui_debug@plt>
movsbl %al,%esi
lea    0xec9(%rip),%rdi
jmp    1080 <log_print@plt>
jmp    1060 <ui_setmode@plt>
jmp    1030 <ui_shutdown_daemon@plt>
xor    %eax,%eax
jmp    10a0 <reinit@plt>
jmp    1040 <ui_report_sa@plt>
jmp    10f0 <ui_teardown_all@plt>
jmp    10c0 <ui_connect@plt>
jmp    1070 <ui_delete@plt>
jmp    1090 <ui_packetlog@plt>
jmp    1050 <ui_report@plt>
jmp    10d0 <ui_teardown@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"ui_handle_messages: unrecognized command: '%c'\00"
define void @ui_handle_command(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %42 [
i32 99, label %7
i32 67, label %10
i32 100, label %13
i32 68, label %16
i32 77, label %19
i32 112, label %22
i32 81, label %25
i32 82, label %28
i32 83, label %30
i32 114, label %33
i32 116, label %36
i32 84, label %39
]
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @ui_connect(i8* %8)
br label %47
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @ui_config(i8* %11)
br label %47
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = call i32 @ui_delete(i8* %14)
br label %47
16: ; preds = %1
%17 = load i8*, i8** %2
%18 = call i32 @ui_debug(i8* %17)
br label %47
19: ; preds = %1
%20 = load i8*, i8** %2
%21 = call i32 @ui_setmode(i8* %20)
br label %47
22: ; preds = %1
%23 = load i8*, i8** %2
%24 = call i32 @ui_packetlog(i8* %23)
br label %47
25: ; preds = %1
%26 = load i8*, i8** %2
%27 = call i32 @ui_shutdown_daemon(i8* %26)
br label %47
28: ; preds = %1
%29 = call i32 (...) @reinit()
br label %47
30: ; preds = %1
%31 = load i8*, i8** %2
%32 = call i32 @ui_report_sa(i8* %31)
br label %47
33: ; preds = %1
%34 = load i8*, i8** %2
%35 = call i32 @ui_report(i8* %34)
br label %47
36: ; preds = %1
%37 = load i8*, i8** %2
%38 = call i32 @ui_teardown(i8* %37)
br label %47
39: ; preds = %1
%40 = load i8*, i8** %2
%41 = call i32 @ui_teardown_all(i8* %40)
br label %47
42: ; preds = %1
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = call i32 @log_print(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %45)
br label %47
47: ; preds = %42, %39, %36, %33, %30, %28, %25, %22, %19, %16, %13, %10, %7
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"ui_handle_messages: unrecognized command: '%c'\00"
define void @ui_handle_command(i8* %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %28 [
i32 99, label %4
i32 67, label %6
i32 100, label %8
i32 68, label %10
i32 77, label %12
i32 112, label %14
i32 81, label %16
i32 82, label %18
i32 83, label %20
i32 114, label %22
i32 116, label %24
i32 84, label %26
]
4: ; preds = %1
%5 = tail call i32 @ui_connect(i8* %0)
br label %30
6: ; preds = %1
%7 = tail call i32 @ui_config(i8* %0)
br label %30
8: ; preds = %1
%9 = tail call i32 @ui_delete(i8* %0)
br label %30
10: ; preds = %1
%11 = tail call i32 @ui_debug(i8* %0)
br label %30
12: ; preds = %1
%13 = tail call i32 @ui_setmode(i8* %0)
br label %30
14: ; preds = %1
%15 = tail call i32 @ui_packetlog(i8* %0)
br label %30
16: ; preds = %1
%17 = tail call i32 @ui_shutdown_daemon(i8* %0)
br label %30
18: ; preds = %1
%19 = tail call i32 (...) @reinit()
br label %30
20: ; preds = %1
%21 = tail call i32 @ui_report_sa(i8* %0)
br label %30
22: ; preds = %1
%23 = tail call i32 @ui_report(i8* %0)
br label %30
24: ; preds = %1
%25 = tail call i32 @ui_teardown(i8* %0)
br label %30
26: ; preds = %1
%27 = tail call i32 @ui_teardown_all(i8* %0)
br label %30
28: ; preds = %1
%29 = tail call i32 @log_print(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext %2)
br label %30
30: ; preds = %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}