#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
void ActionStr(int act, char *S) {
  switch (act) {
  case 1:
    strcpy(S, "DELAY");
    break;
  case 2:
    strcpy(S, "START");
    break;
  case 3:
    strcpy(S, "KEEP");
    break;
  case 5:
    strcpy(S, "ABORT");
    break;
  case 4:
    strcpy(S, "ABAND");
    break;
  default:
    sprintf(S, "%d", act);
    break;
  }
}


x86 assembly (clang, -O0):
<ActionStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     11c1 <ActionStr+0xa1>
mov    -0x18(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d4 <ActionStr+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d4 <ActionStr+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d4 <ActionStr+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d4 <ActionStr+0xb4>
mov    -0x10(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11d4 <ActionStr+0xb4>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe62(%rip),%rsi
call   1040 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ActionStr>:
mov    %rsi,%rax
mov    %edi,%edx
lea    -0x1(%rdx),%ecx
cmp    $0x4,%ecx
ja     114c <ActionStr+0x2c>
lea    0xecc(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xed0(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <strcpy@plt>
lea    0xede(%rip),%rsi
mov    %rax,%rdi
jmp    1040 <sprintf@plt>
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <strcpy@plt>
lea    0xeaf(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <strcpy@plt>
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <strcpy@plt>
lea    0xe96(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"DELAY\00"
@.str.1 = [6 x i8] c"START\00"
@.str.2 = [5 x i8] c"KEEP\00"
@.str.3 = [6 x i8] c"ABORT\00"
@.str.4 = [6 x i8] c"ABAND\00"
@.str.5 = [3 x i8] c"%d\00"
define void @ActionStr(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %21 [
i32 1, label %6
i32 2, label %9
i32 3, label %12
i32 5, label %15
i32 4, label %18
]
6: ; preds = %2
%7 = load i8*, i8** %4
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %25
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %25
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %25
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %25
18: ; preds = %2
%19 = load i8*, i8** %4
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %25
21: ; preds = %2
%22 = load i8*, i8** %4
%23 = load i32, i32* %3
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21, %18, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"DELAY\00"
@.str.1 = [6 x i8] c"START\00"
@.str.2 = [5 x i8] c"KEEP\00"
@.str.3 = [6 x i8] c"ABORT\00"
@.str.4 = [6 x i8] c"ABAND\00"
@.str.5 = [3 x i8] c"%d\00"
define void @ActionStr(i32 %0, i8* %1) {
switch i32 %0, label %13 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 5, label %9
i32 4, label %11
]
3: ; preds = %2
%4 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %15
5: ; preds = %2
%6 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %15
7: ; preds = %2
%8 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
9: ; preds = %2
%10 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %15
11: ; preds = %2
%12 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %15
13: ; preds = %2
%14 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %0)
br label %15
15: ; preds = %13, %11, %9, %7, %5, %3
ret void
}