#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int option_operation_mode_serializer(void *data, FILE *out) {
  switch (*((int *)data)) {
  case 0:
    fprintf(out, "%s", "tag");
    break;
  case 1:
    fprintf(out, "%s", "test");
    break;
  case 2:
    fprintf(out, "%s", "train");
    break;
  case 7:
    fprintf(out, "%s", "dump");
    break;
  case 8:
    fprintf(out, "%s", "debug");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<option_operation_mode_serializer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x18(%rbp)
sub    $0x8,%rax
ja     11cf <option_operation_mode_serializer+0xbf>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xed1(%rip),%rsi
lea    0xecd(%rip),%rdx
call   1030 <fprintf@plt>
jmp    11cf <option_operation_mode_serializer+0xbf>
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
lea    0xeb5(%rip),%rdx
call   1030 <fprintf@plt>
jmp    11cf <option_operation_mode_serializer+0xbf>
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    0xe9e(%rip),%rdx
call   1030 <fprintf@plt>
jmp    11cf <option_operation_mode_serializer+0xbf>
mov    -0x10(%rbp),%rdi
lea    0xe7d(%rip),%rsi
lea    0xe88(%rip),%rdx
call   1030 <fprintf@plt>
jmp    11cf <option_operation_mode_serializer+0xbf>
mov    -0x10(%rbp),%rdi
lea    0xe61(%rip),%rsi
lea    0xe71(%rip),%rdx
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<option_operation_mode_serializer>:
push   %rax
mov    (%rdi),%eax
cmp    $0x8,%rax
ja     1175 <option_operation_mode_serializer+0x65>
mov    %rsi,%rcx
lea    0xedd(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
lea    0xef1(%rip),%rdi
mov    $0x3,%esi
jmp    116b <option_operation_mode_serializer+0x5b>
lea    0xee7(%rip),%rdi
mov    $0x4,%esi
jmp    116b <option_operation_mode_serializer+0x5b>
lea    0xede(%rip),%rdi
jmp    1166 <option_operation_mode_serializer+0x56>
lea    0xedb(%rip),%rdi
mov    $0x4,%esi
jmp    116b <option_operation_mode_serializer+0x5b>
lea    0xed2(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"tag\00"
@.str.2 = [5 x i8] c"test\00"
@.str.3 = [6 x i8] c"train\00"
@.str.4 = [5 x i8] c"dump\00"
@.str.5 = [6 x i8] c"debug\00"
define i32 @option_operation_mode_serializer(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
switch i32 %7, label %23 [
i32 0, label %8
i32 1, label %11
i32 2, label %14
i32 7, label %17
i32 8, label %20
]
8: ; preds = %2
%9 = load i32*, i32** %4
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %23
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %23
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %23
17: ; preds = %2
%18 = load i32*, i32** %4
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %23
20: ; preds = %2
%21 = load i32*, i32** %4
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %23
23: ; preds = %2, %20, %17, %14, %11, %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"tag\00"
@.str.2 = [5 x i8] c"test\00"
@.str.3 = [6 x i8] c"train\00"
@.str.4 = [5 x i8] c"dump\00"
@.str.5 = [6 x i8] c"debug\00"
define i32 @option_operation_mode_serializer(i8* nocapture %0, i32* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
i32 7, label %11
i32 8, label %13
]
5: ; preds = %2
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 3, i64 1, i32* %1)
br label %15
7: ; preds = %2
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 1, i32* %1)
br label %15
9: ; preds = %2
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 5, i64 1, i32* %1)
br label %15
11: ; preds = %2
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 4, i64 1, i32* %1)
br label %15
13: ; preds = %2
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 5, i64 1, i32* %1)
br label %15
15: ; preds = %2, %13, %11, %9, %7, %5
ret i32 0
}