#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 *ucarch(unsigned long cidr) {
  switch (((cidr >> 20) & 0xFF)) {
  case 0x60:
    return "AT91SAM7A";
    break;
  case 0x70:
    return "AT91SAM7S";
    break;
  case 0x71:
    return "AT91SAM7XC";
    break;
  case 0x72:
    return "AT91SAM7SE";
    break;
  case 0x73:
    return "AT91SAM7L";
    break;
  case 0x75:
    return "AT91SAM7X";
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<ucarch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x14,%eax
movzbl %al,%eax
add    $0xffffffffffffffa0,%rax
mov    %rax,-0x18(%rbp)
sub    $0x15,%rax
ja     1197 <ucarch+0x97>
mov    -0x18(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf1a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
lea    0xf14(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
lea    0xf0e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
lea    0xf09(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
lea    0xf04(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119f <ucarch+0x9f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ucarch>:
shr    $0x14,%rdi
add    $0xa0,%dil
cmp    $0x15,%dil
ja     1131 <ucarch+0x31>
lea    0xf43(%rip),%rax
movzbl %dil,%ecx
lea    0xee0(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf32(%rip),%rax
ret
xor    %eax,%eax
ret
lea    0xf31(%rip),%rax
ret
lea    0xf34(%rip),%rax
ret
lea    0xf37(%rip),%rax
ret
lea    0xf39(%rip),%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"AT91SAM7A\00"
@.str.1 = [10 x i8] c"AT91SAM7S\00"
@.str.2 = [11 x i8] c"AT91SAM7XC\00"
@.str.3 = [11 x i8] c"AT91SAM7SE\00"
@.str.4 = [10 x i8] c"AT91SAM7L\00"
@.str.5 = [10 x i8] c"AT91SAM7X\00"
define i8* @ucarch(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = lshr i64 %4, 20
%6 = and i64 %5, 255
switch i64 %6, label %13 [
i64 96, label %7
i64 112, label %8
i64 113, label %9
i64 114, label %10
i64 115, label %11
i64 117, label %12
]
7: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %14
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %14
9: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %14
10: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %14
11: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %14
12: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %14
13: ; preds = %1
store i8* null, i8** %2
br label %14
14: ; preds = %13, %12, %11, %10, %9, %8, %7
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
@.str = [10 x i8] c"AT91SAM7A\00"
@.str.1 = [10 x i8] c"AT91SAM7S\00"
@.str.2 = [11 x i8] c"AT91SAM7XC\00"
@.str.3 = [11 x i8] c"AT91SAM7SE\00"
@.str.4 = [10 x i8] c"AT91SAM7L\00"
@.str.5 = [10 x i8] c"AT91SAM7X\00"
define i8* @ucarch(i64 %0) {
%2 = lshr i64 %0, 20
%3 = trunc i64 %2 to i8
switch i8 %3, label %9 [
i8 96, label %10
i8 112, label %4
i8 113, label %5
i8 114, label %6
i8 115, label %7
i8 117, label %8
]
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4
%11 = phi i8* [ null, %9 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}