#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 exception_message(int operation) {
  switch (operation) {
  case 1:
    printf("operation not supported");
    break;
  case 2:
    printf("invalid command argument count");
    break;
  case 3:
    printf("invalid command arguments");
    break;
  case 4:
    printf("invalid input");
    break;
  case 5:
    printf("invalid arithmetic operation");
    break;
  case 42:
    printf("the answer to life, the universe and everything else\n");
    break;
  }
}


x86 assembly (clang, -O0):
<exception_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x29,%eax
ja     11a5 <exception_message+0x95>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf5d(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <exception_message+0x95>
lea    0xf64(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <exception_message+0x95>
lea    0xf72(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <exception_message+0x95>
lea    0xf7b(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <exception_message+0x95>
lea    0xf78(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <exception_message+0x95>
lea    0xf84(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exception_message>:
add    $0xffffffff,%edi
cmp    $0x29,%edi
ja     1174 <exception_message+0x54>
lea    0xed1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf69(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xf75(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xf88(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xf96(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xf98(%rip),%rdi
jmp    1040 <printf@plt>
ret
lea    0xfa8(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"operation not supported\00"
@.str.1 = [31 x i8] c"invalid command argument count\00"
@.str.2 = [26 x i8] c"invalid command arguments\00"
@.str.3 = [14 x i8] c"invalid input\00"
@.str.4 = [29 x i8] c"invalid arithmetic operation\00"
@.str.5 = [54 x i8] c"the answer to life, the universe and everything else\0A\00"
define void @exception_message(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 42, label %14
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %16
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %16
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %16
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %16
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %16
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
br label %16
16: ; preds = %1, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"operation not supported\00"
@.str.1 = [31 x i8] c"invalid command argument count\00"
@.str.2 = [26 x i8] c"invalid command arguments\00"
@.str.3 = [14 x i8] c"invalid input\00"
@.str.4 = [29 x i8] c"invalid arithmetic operation\00"
@str = [53 x i8] c"the answer to life, the universe and everything else\00"
define void @exception_message(i32 %0) {
switch i32 %0, label %14 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %10
i32 42, label %12
]
2: ; preds = %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %14
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %14
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %14
8: ; preds = %1
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %14
12: ; preds = %1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %1, %12, %10, %8, %6, %4, %2
ret void
}