#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 */
int /*<<< orphan*/ printf(char *);
int teens(int stevilo) {
  switch (stevilo) {
  case 10:
    return 3;
    break;
  case 11:
    return 6;
    break;
  case 12:
    return 6;
    break;
  case 13:
    return 8;
    break;
  case 14:
    return 8;
    break;
  case 15:
    return 7;
    break;
  case 16:
    return 7;
    break;
  case 17:
    return 9;
    break;
  case 18:
    return 8;
    break;
  case 19:
    return 8;
    break;
  }
  printf("ERROR\n");
  return 0;
}


x86 assembly (clang, -O0):
<teens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     11bc <teens+0xac>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x3,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x6,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x6,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x8,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x8,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x7,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x7,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x9,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x8,-0x4(%rbp)
jmp    11cf <teens+0xbf>
movl   $0x8,-0x4(%rbp)
jmp    11cf <teens+0xbf>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teens>:
push   %rax
add    $0xfffffff6,%edi
cmp    $0xa,%edi
jae    1128 <teens+0x18>
movslq %edi,%rax
lea    0xee5(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"ERROR\0A\00"
define i32 @teens(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %15 [
i32 10, label %5
i32 11, label %6
i32 12, label %7
i32 13, label %8
i32 14, label %9
i32 15, label %10
i32 16, label %11
i32 17, label %12
i32 18, label %13
i32 19, label %14
]
5: ; preds = %1
store i32 3, i32* %2
br label %17
6: ; preds = %1
store i32 6, i32* %2
br label %17
7: ; preds = %1
store i32 6, i32* %2
br label %17
8: ; preds = %1
store i32 8, i32* %2
br label %17
9: ; preds = %1
store i32 8, i32* %2
br label %17
10: ; preds = %1
store i32 7, i32* %2
br label %17
11: ; preds = %1
store i32 7, i32* %2
br label %17
12: ; preds = %1
store i32 9, i32* %2
br label %17
13: ; preds = %1
store i32 8, i32* %2
br label %17
14: ; preds = %1
store i32 8, i32* %2
br label %17
15: ; preds = %1
%16 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %17
17: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@str = [6 x i8] c"ERROR\00"
@switch.table.teens = [10 x i32] [i32 3, i32 6, i32 6, i32 8, i32 8, i32 7, i32 7, i32 9, i32 8, i32 8]
define i32 @teens(i32 %0) {
%2 = add i32 %0, -10
%3 = icmp ult i32 %2, 10
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [10 x i32], [10 x i32]* @switch.table.teens, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %9, %6 ]
ret i32 %11
}