#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 */
char *get_modelname(int version) {
  switch (version >> 8) {
  case 0x01:
    return "1g2g";
    break;
  case 0x02:
    return "ip3g";
    break;
  case 0x40:
    return "mini";
    break;
  case 0x50:
    return "ip4g";
    break;
  case 0x60:
    return "ipco";
    break;
  case 0x70:
    return "mn2g";
    break;
  case 0xc0:
    return "nano";
    break;
  case 0xb0:
    return "ipvd";
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_modelname>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1199 <get_modelname+0x99>
jmp    111e <get_modelname+0x1e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11a9 <get_modelname+0xa9>
jmp    112f <get_modelname+0x2f>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     11b9 <get_modelname+0xb9>
jmp    1140 <get_modelname+0x40>
mov    -0x10(%rbp),%eax
sub    $0x50,%eax
je     11c9 <get_modelname+0xc9>
jmp    1151 <get_modelname+0x51>
mov    -0x10(%rbp),%eax
sub    $0x60,%eax
je     11d9 <get_modelname+0xd9>
jmp    1162 <get_modelname+0x62>
mov    -0x10(%rbp),%eax
sub    $0x70,%eax
je     11e9 <get_modelname+0xe9>
jmp    1173 <get_modelname+0x73>
mov    -0x10(%rbp),%eax
sub    $0xb0,%eax
je     1209 <get_modelname+0x109>
jmp    1186 <get_modelname+0x86>
mov    -0x10(%rbp),%eax
sub    $0xc0,%eax
je     11f9 <get_modelname+0xf9>
jmp    1219 <get_modelname+0x119>
lea    0xe60(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe55(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe4a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe3f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe34(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe29(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe1e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
lea    0xe13(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1221 <get_modelname+0x121>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_modelname>:
sar    $0x8,%edi
cmp    $0x5f,%edi
jg     111f <get_modelname+0x1f>
cmp    $0x3f,%edi
jg     1139 <get_modelname+0x39>
cmp    $0x1,%edi
je     1163 <get_modelname+0x63>
cmp    $0x2,%edi
jne    1183 <get_modelname+0x83>
lea    0xee7(%rip),%rax
ret
cmp    $0xaf,%edi
jg     114b <get_modelname+0x4b>
cmp    $0x60,%edi
je     116b <get_modelname+0x6b>
cmp    $0x70,%edi
jne    1183 <get_modelname+0x83>
lea    0xee1(%rip),%rax
ret
cmp    $0x40,%edi
je     1173 <get_modelname+0x73>
cmp    $0x50,%edi
jne    1183 <get_modelname+0x83>
lea    0xec5(%rip),%rax
ret
cmp    $0xb0,%edi
je     117b <get_modelname+0x7b>
cmp    $0xc0,%edi
jne    1183 <get_modelname+0x83>
lea    0xebc(%rip),%rax
ret
lea    0xe96(%rip),%rax
ret
lea    0xea2(%rip),%rax
ret
lea    0xe90(%rip),%rax
ret
lea    0xea1(%rip),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"1g2g\00"
@.str.1 = [5 x i8] c"ip3g\00"
@.str.2 = [5 x i8] c"mini\00"
@.str.3 = [5 x i8] c"ip4g\00"
@.str.4 = [5 x i8] c"ipco\00"
@.str.5 = [5 x i8] c"mn2g\00"
@.str.6 = [5 x i8] c"nano\00"
@.str.7 = [5 x i8] c"ipvd\00"
define i8* @get_modelname(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = ashr i32 %4, 8
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %7
i32 64, label %8
i32 80, label %9
i32 96, label %10
i32 112, label %11
i32 192, label %12
i32 176, label %13
]
6: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %15
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %15
8: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %15
9: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %15
10: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %15
11: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %15
12: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %15
13: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %15
14: ; preds = %1
store i8* null, i8** %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@.str = [5 x i8] c"1g2g\00"
@.str.1 = [5 x i8] c"ip3g\00"
@.str.2 = [5 x i8] c"mini\00"
@.str.3 = [5 x i8] c"ip4g\00"
@.str.4 = [5 x i8] c"ipco\00"
@.str.5 = [5 x i8] c"mn2g\00"
@.str.6 = [5 x i8] c"nano\00"
@.str.7 = [5 x i8] c"ipvd\00"
define i8* @get_modelname(i32 %0) {
%2 = ashr i32 %0, 8
switch i32 %2, label %10 [
i32 1, label %11
i32 2, label %3
i32 64, label %4
i32 80, label %5
i32 96, label %6
i32 112, label %7
i32 192, label %8
i32 176, label %9
]
3: ; preds = %1
br label %11
4: ; preds = %1
br label %11
5: ; preds = %1
br label %11
6: ; preds = %1
br label %11
7: ; preds = %1
br label %11
8: ; preds = %1
br label %11
9: ; preds = %1
br label %11
10: ; preds = %1
br label %11
11: ; preds = %1, %10, %9, %8, %7, %6, %5, %4, %3
%12 = phi i8* [ null, %10 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), %9 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %7 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %12
}