#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 create_vfs(char *, int);
int /*<<< orphan*/ printf(char *, ...);
void createvfs(char *P1, int P2) {
  int i = create_vfs(P1, P2);
  switch (i) {
  case 0:
    printf("createvfs_SUCCESS\n");
    break;
  case 1:
    printf("createvfs_FAILURE %s\n", "DATA_FILE_ALREADY_EXISTS");
    break;
  case 2:
    printf("createvfs_FAILURE %s\n", "CANNOT_CREATE_DATAFILE");
    break;
  case 3:
    printf("createvfs_FAILURE %s\n", "INVALID_CHARACTER_IN_NAME");
    break;
  case 4:
    printf("createvfs_FAILURE %s\n", "INVALID_SIZE");
    break;
  case 5:
    printf("createvfs_FAILURE %s\n", "VFS_LABEL_TOO_LARGE");
    break;
  default:
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<createvfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <create_vfs@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     11f8 <createvfs+0xd8>
mov    -0x18(%rbp),%rax
lea    0xea6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xeae(%rip),%rdi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xe94(%rip),%rdi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xe7a(%rip),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xe60(%rip),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xe46(%rip),%rdi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1206 <createvfs+0xe6>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createvfs>:
push   %rax
call   1030 <create_vfs@plt>
cmp    $0x5,%eax
ja     116a <createvfs+0x2a>
mov    %eax,%eax
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf35(%rip),%rdi
pop    %rax
jmp    1050 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1040 <putchar@plt>
lea    0xe9c(%rip),%rdi
lea    0xeab(%rip),%rsi
jmp    11c3 <createvfs+0x83>
lea    0xe8c(%rip),%rdi
lea    0xeb4(%rip),%rsi
jmp    11c3 <createvfs+0x83>
lea    0xe7c(%rip),%rdi
lea    0xebb(%rip),%rsi
jmp    11c3 <createvfs+0x83>
lea    0xe6c(%rip),%rdi
lea    0xec5(%rip),%rsi
jmp    11c3 <createvfs+0x83>
lea    0xe5c(%rip),%rdi
lea    0xec2(%rip),%rsi
xor    %eax,%eax
pop    %rcx
jmp    1060 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"createvfs_SUCCESS\0A\00"
@.str.1 = [22 x i8] c"createvfs_FAILURE %s\0A\00"
@.str.2 = [25 x i8] c"DATA_FILE_ALREADY_EXISTS\00"
@.str.3 = [23 x i8] c"CANNOT_CREATE_DATAFILE\00"
@.str.4 = [26 x i8] c"INVALID_CHARACTER_IN_NAME\00"
@.str.5 = [13 x i8] c"INVALID_SIZE\00"
@.str.6 = [20 x i8] c"VFS_LABEL_TOO_LARGE\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @createvfs(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @create_vfs(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
switch i32 %9, label %22 [
i32 0, label %10
i32 1, label %12
i32 2, label %14
i32 3, label %16
i32 4, label %18
i32 5, label %20
]
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %24
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %24
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %24
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %24
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %24
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %24
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %24
24: ; preds = %22, %20, %18, %16, %14, %12, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c"createvfs_FAILURE %s\0A\00"
@.str.2 = [25 x i8] c"DATA_FILE_ALREADY_EXISTS\00"
@.str.3 = [23 x i8] c"CANNOT_CREATE_DATAFILE\00"
@.str.4 = [26 x i8] c"INVALID_CHARACTER_IN_NAME\00"
@.str.5 = [13 x i8] c"INVALID_SIZE\00"
@.str.6 = [20 x i8] c"VFS_LABEL_TOO_LARGE\00"
@str = [18 x i8] c"createvfs_SUCCESS\00"
define void @createvfs(i8* %0, i32 %1) {
%3 = tail call i32 @create_vfs(i8* %0, i32 %1)
switch i32 %3, label %16 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
]
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %18
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %18
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %18
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %18
12: ; preds = %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %18
14: ; preds = %2
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %18
16: ; preds = %2
%17 = tail call i32 @putchar(i32 10)
br label %18
18: ; preds = %16, %14, %12, %10, %8, %6, %4
ret void
}