#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*/ pow(int, int);
int quick_base(int depth) {
  switch (depth) {
  case 0:
    return 0;
  case 1:
    return 1;
  case 2:
    return 9;
  case 3:
    return 73;
  case 4:
    return 585;
  case 5:
    return 4681;
  case 6:
    return 37449;
  case 7:
    return 299593;
  case 8:
    return 2396745;
  case 9:
    return 19173961;
  case 10:
    return 153391689;
  default:
    return (pow(8, depth) - 1) / (8 - 1);
  }
}


x86 assembly (clang, -O0):
<quick_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xa,%rax
ja     11c4 <quick_base+0xb4>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x1,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x9,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x49,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x1249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x9249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x49249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x249249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x1249249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
movl   $0x9249249,-0x4(%rbp)
jmp    11df <quick_base+0xcf>
mov    -0x8(%rbp),%esi
mov    $0x8,%edi
call   1030 <pow@plt>
sub    $0x1,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_base>:
push   %rax
mov    %edi,%esi
cmp    $0xb,%edi
jae    1127 <quick_base+0x17>
movslq %esi,%rax
lea    0xede(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
mov    $0x8,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
add    $0xffffffff,%ecx
movslq %ecx,%rcx
imul   $0xffffffff92492493,%rcx,%rcx
shr    $0x20,%rcx
add    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x2,%eax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @quick_base(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %16 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
i32 9, label %14
i32 10, label %15
]
5: ; preds = %1
store i32 0, i32* %2
br label %21
6: ; preds = %1
store i32 1, i32* %2
br label %21
7: ; preds = %1
store i32 9, i32* %2
br label %21
8: ; preds = %1
store i32 73, i32* %2
br label %21
9: ; preds = %1
store i32 585, i32* %2
br label %21
10: ; preds = %1
store i32 4681, i32* %2
br label %21
11: ; preds = %1
store i32 37449, i32* %2
br label %21
12: ; preds = %1
store i32 299593, i32* %2
br label %21
13: ; preds = %1
store i32 2396745, i32* %2
br label %21
14: ; preds = %1
store i32 19173961, i32* %2
br label %21
15: ; preds = %1
store i32 153391689, i32* %2
br label %21
16: ; preds = %1
%17 = load i32, i32* %3
%18 = call i32 @pow(i32 8, i32 %17)
%19 = sub nsw i32 %18, 1
%20 = sdiv i32 %19, 7
store i32 %20, i32* %2
br label %21
21: ; preds = %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@switch.table.quick_base = [11 x i32] [i32 0, i32 1, i32 9, i32 73, i32 585, i32 4681, i32 37449, i32 299593, i32 2396745, i32 19173961, i32 153391689]
define i32 @quick_base(i32 %0) {
%2 = icmp ult i32 %0, 11
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @pow(i32 8, i32 %0)
%5 = add nsw i32 %4, -1
%6 = sdiv i32 %5, 7
br label %11
7: ; preds = %1
%8 = sext i32 %0 to i64
%9 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.quick_base, i64 0, i64 %8
%10 = load i32, i32* %9
br label %11
11: ; preds = %7, %3
%12 = phi i32 [ %6, %3 ], [ %10, %7 ]
ret i32 %12
}