int returnvalue(char c) {
  switch (c) {
  case '{':
    return 1;
  case '[':
    return 2;
  case '(':
    return 3;
  case '<':
    return 4;
  case '}':
    return 5;
  case ']':
    return 6;
  case ')':
    return 7;
  case '>':
    return 8;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<returnvalue>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x28,%eax
je     11ae <returnvalue+0xae>
jmp    111f <returnvalue+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x29,%eax
je     11de <returnvalue+0xde>
jmp    1130 <returnvalue+0x30>
mov    -0xc(%rbp),%eax
sub    $0x3c,%eax
je     11ba <returnvalue+0xba>
jmp    1141 <returnvalue+0x41>
mov    -0xc(%rbp),%eax
sub    $0x3e,%eax
je     11ea <returnvalue+0xea>
jmp    1152 <returnvalue+0x52>
mov    -0xc(%rbp),%eax
sub    $0x5b,%eax
je     11a2 <returnvalue+0xa2>
jmp    1163 <returnvalue+0x63>
mov    -0xc(%rbp),%eax
sub    $0x5d,%eax
je     11d2 <returnvalue+0xd2>
jmp    1174 <returnvalue+0x74>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     1196 <returnvalue+0x96>
jmp    1185 <returnvalue+0x85>
mov    -0xc(%rbp),%eax
sub    $0x7d,%eax
je     11c6 <returnvalue+0xc6>
jmp    11f6 <returnvalue+0xf6>
movl   $0x1,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x2,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x3,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x4,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x5,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x6,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x7,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x8,-0x4(%rbp)
jmp    11fd <returnvalue+0xfd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnvalue>:
lea    -0x28(%rdi),%eax
cmp    $0x35,%eax
ja     111e <returnvalue+0x1e>
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x3,%eax
ret
cmp    $0x7b,%edi
je     114f <returnvalue+0x4f>
cmp    $0x7d,%edi
jne    112e <returnvalue+0x2e>
mov    $0x5,%eax
ret
xor    %eax,%eax
ret
mov    $0x7,%eax
ret
mov    $0x4,%eax
ret
mov    $0x8,%eax
ret
mov    $0x2,%eax
ret
mov    $0x6,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @returnvalue(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 123, label %6
i32 91, label %7
i32 40, label %8
i32 60, label %9
i32 125, label %10
i32 93, label %11
i32 41, label %12
i32 62, label %13
]
6: ; preds = %1
store i32 1, i32* %2
br label %15
7: ; preds = %1
store i32 2, i32* %2
br label %15
8: ; preds = %1
store i32 3, i32* %2
br label %15
9: ; preds = %1
store i32 4, i32* %2
br label %15
10: ; preds = %1
store i32 5, i32* %2
br label %15
11: ; preds = %1
store i32 6, i32* %2
br label %15
12: ; preds = %1
store i32 7, i32* %2
br label %15
13: ; preds = %1
store i32 8, i32* %2
br label %15
14: ; preds = %1
store i32 0, i32* %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @returnvalue(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %10 [
i32 123, label %11
i32 91, label %3
i32 40, label %4
i32 60, label %5
i32 125, label %6
i32 93, label %7
i32 41, label %8
i32 62, 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 i32 [ 0, %10 ], [ 8, %9 ], [ 7, %8 ], [ 6, %7 ], [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %1 ]
ret i32 %12
}