#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 uint8_t;

/* Variables and functions */
char *strdup(char *);
char *interface_subtype_name(uint8_t subtype) {
  switch (subtype) {
  case 1:
    return strdup("Unknown");
    break;
  case 2:
    return strdup("ifIndex");
    break;
  case 3:
    return strdup("System Port Number");
    break;
  default:
    return strdup("Invalid Subtype");
  }
}


x86 assembly (clang, -O0):
<interface_subtype_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1151 <interface_subtype_name+0x41>
jmp    112f <interface_subtype_name+0x1f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1166 <interface_subtype_name+0x56>
jmp    1140 <interface_subtype_name+0x30>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     117b <interface_subtype_name+0x6b>
jmp    1190 <interface_subtype_name+0x80>
lea    0xea8(%rip),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11a0 <interface_subtype_name+0x90>
lea    0xe9b(%rip),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11a0 <interface_subtype_name+0x90>
lea    0xe8e(%rip),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    11a0 <interface_subtype_name+0x90>
lea    0xe8c(%rip),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interface_subtype_name>:
cmp    $0x3,%edi
je     112b <interface_subtype_name+0x1b>
cmp    $0x2,%edi
je     1137 <interface_subtype_name+0x27>
cmp    $0x1,%edi
jne    1143 <interface_subtype_name+0x33>
lea    0xeda(%rip),%rdi
jmp    1030 <strdup@plt>
lea    0xede(%rip),%rdi
jmp    1030 <strdup@plt>
lea    0xeca(%rip),%rdi
jmp    1030 <strdup@plt>
lea    0xed9(%rip),%rdi
jmp    1030 <strdup@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [8 x i8] c"ifIndex\00"
@.str.2 = [19 x i8] c"System Port Number\00"
@.str.3 = [16 x i8] c"Invalid Subtype\00"
define i8* @interface_subtype_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
5: ; preds = %1
%6 = call i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %2
br label %13
7: ; preds = %1
%8 = call i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %2
br label %13
9: ; preds = %1
%10 = call i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i8* %10, i8** %2
br label %13
11: ; preds = %1
%12 = call i8* @strdup(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i8* %12, i8** %2
br label %13
13: ; preds = %11, %9, %7, %5
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [8 x i8] c"Unknown\00"
@.str.1 = [8 x i8] c"ifIndex\00"
@.str.2 = [19 x i8] c"System Port Number\00"
@.str.3 = [16 x i8] c"Invalid Subtype\00"
define noalias i8* @interface_subtype_name(i32 %0) {
switch i32 %0, label %8 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
]
2: ; preds = %1
%3 = tail call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %10
4: ; preds = %1
%5 = tail call dereferenceable_or_null(8) i8* @strdup(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = tail call dereferenceable_or_null(19) i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = tail call dereferenceable_or_null(16) i8* @strdup(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %8, %6, %4, %2
%11 = phi i8* [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ]
ret i8* %11
}