#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 floor(long double);
scalar_t__ log10l(long double);
long double powl(scalar_t__, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
scalar_t__ sqrtl(int);
int main(int argc, char *argv[]) {
  int T;
  int i;
  int j;
  int exponent;
  int digits;
  long double num;
  int final;
  scanf("%d", &T);
  for (i = 0; i < T; i++) {
    scanf("%d", &exponent);
    num = powl(3 + sqrtl(5), exponent);
    digits = (int)log10l(num) + 1;
    for (j = 0; j < digits - 3; j++) {
      num /= 10;
    }
    final = floor(num);
    printf("Case #%d: %03d\n", i + 1, final);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    123f <main+0xdf>
lea    0xe64(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x5,%edi
call   1050 <sqrtl@plt>
mov    %rax,%rdi
add    $0x3,%rdi
mov    -0x20(%rbp),%esi
call   1030 <powl@plt>
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1070 <log10l@plt>
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jge    120c <main+0xac>
fldt   -0x40(%rbp)
flds   0xe07(%rip)
fdivrp %st,%st(1)
fstpt  -0x40(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11df <main+0x7f>
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1080 <floor@plt>
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%esi
add    $0x1,%esi
mov    -0x44(%rbp),%edx
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <main+0x2d>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe92(%rip),%rdi
lea    0x1c(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x1c(%rsp)
jle    1286 <main+0x126>
xor    %ebx,%ebx
lea    0xe74(%rip),%r14
lea    0x20(%rsp),%r15
fldz
fstpt  0x3c(%rsp)
flds   0xe5f(%rip)
fstpt  0x30(%rsp)
lea    0xe5b(%rip),%r12
jmp    11db <main+0x7b>
xchg   %ax,%ax
fldt   0x24(%rsp)
fldz
fxch   %st(1)
fstp   %st(1)
fstpt  (%rsp)
call   1080 <floor@plt>
add    $0x1,%ebx
mov    %r12,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
cmp    0x1c(%rsp),%ebx
jge    1286 <main+0x126>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    $0x5,%edi
call   1050 <sqrtl@plt>
lea    0x3(%rax),%rdi
mov    0x20(%rsp),%esi
call   1030 <powl@plt>
fld    %st(0)
fstpt  0x24(%rsp)
fstpt  (%rsp)
call   1070 <log10l@plt>
cmp    $0x3,%eax
jl     11b0 <main+0x50>
fldt   0x24(%rsp)
lea    -0x2(%rax),%edx
add    $0xfffffffd,%eax
mov    %edx,%ecx
and    $0x3,%ecx
cmp    $0x3,%eax
jae    1230 <main+0xd0>
fldt   0x3c(%rsp)
fldz
jmp    1253 <main+0xf3>
nopl   0x0(%rax)
and    $0xfffffffc,%edx
fldt   0x30(%rsp)
fldz
fxch   %st(2)
fxch   %st(1)
nopl   (%rax)
fstp   %st(2)
fdiv   %st(1),%st
fdiv   %st(1),%st
fdiv   %st(1),%st
fdiv   %st(1),%st
fld    %st(0)
add    $0xfffffffc,%edx
fxch   %st(2)
jne    1240 <main+0xe0>
fstp   %st(0)
test   %ecx,%ecx
je     11b8 <main+0x58>
fstp   %st(0)
fldz
fxch   %st(1)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
fstp   %st(1)
fdivs  0xd88(%rip)
add    $0xffffffff,%ecx
fldz
fxch   %st(1)
jne    1270 <main+0x110>
jmp    11b8 <main+0x58>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Case #%d: %03d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca x86_fp80
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %14
14: ; preds = %46, %2
%15 = load i32, i32* %7
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %49
18: ; preds = %14
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%20 = call i64 @sqrtl(i32 5)
%21 = add nsw i64 3, %20
%22 = load i32, i32* %9
%23 = call x86_fp80 @powl(i64 %21, i32 %22)
store x86_fp80 %23, x86_fp80* %11
%24 = load x86_fp80, x86_fp80* %11
%25 = call i64 @log10l(x86_fp80 %24)
%26 = trunc i64 %25 to i32
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
store i32 0, i32* %8
br label %28
28: ; preds = %36, %18
%29 = load i32, i32* %8
%30 = load i32, i32* %10
%31 = sub nsw i32 %30, 3
%32 = icmp slt i32 %29, %31
br i1 %32, label %33, label %39
33: ; preds = %28
%34 = load x86_fp80, x86_fp80* %11
%35 = fdiv x86_fp80 %34, 0xK4002A000000000000000
store x86_fp80 %35, x86_fp80* %11
br label %36
36: ; preds = %33
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
store i32 %38, i32* %8
br label %28
39: ; preds = %28
%40 = load x86_fp80, x86_fp80* %11
%41 = call i32 @floor(x86_fp80 %40)
store i32 %41, i32* %12
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
%44 = load i32, i32* %12
%45 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %43, i32 %44)
br label %46
46: ; preds = %39
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %14
49: ; preds = %14
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Case #%d: %03d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %53
10: ; preds = %2, %46
%11 = phi i32 [ %49, %46 ], [ 0, %2 ]
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = call i64 @sqrtl(i32 5)
%14 = add nsw i64 %13, 3
%15 = load i32, i32* %4
%16 = call x86_fp80 @powl(i64 %14, i32 %15)
%17 = call i64 @log10l(x86_fp80 %16)
%18 = trunc i64 %17 to i32
%19 = add i32 %18, -2
%20 = icmp sgt i32 %18, 2
br i1 %20, label %21, label %46
21: ; preds = %10
%22 = add i32 %18, -3
%23 = and i32 %19, 3
%24 = icmp ult i32 %22, 3
br i1 %24, label %36, label %25
25: ; preds = %21
%26 = and i32 %19, -4
br label %27
27: ; preds = %27, %25
%28 = phi x86_fp80 [ %16, %25 ], [ %33, %27 ]
%29 = phi i32 [ 0, %25 ], [ %34, %27 ]
%30 = fdiv x86_fp80 %28, 0xK4002A000000000000000
%31 = fdiv x86_fp80 %30, 0xK4002A000000000000000
%32 = fdiv x86_fp80 %31, 0xK4002A000000000000000
%33 = fdiv x86_fp80 %32, 0xK4002A000000000000000
%34 = add i32 %29, 4
%35 = icmp eq i32 %34, %26
br i1 %35, label %36, label %27
36: ; preds = %27, %21
%37 = phi x86_fp80 [ undef, %21 ], [ %33, %27 ]
%38 = phi x86_fp80 [ %16, %21 ], [ %33, %27 ]
%39 = icmp eq i32 %23, 0
br i1 %39, label %46, label %40
40: ; preds = %36, %40
%41 = phi x86_fp80 [ %43, %40 ], [ %38, %36 ]
%42 = phi i32 [ %44, %40 ], [ 0, %36 ]
%43 = fdiv x86_fp80 %41, 0xK4002A000000000000000
%44 = add i32 %42, 1
%45 = icmp eq i32 %44, %23
br i1 %45, label %46, label %40
46: ; preds = %36, %40, %10
%47 = phi x86_fp80 [ %16, %10 ], [ %37, %36 ], [ %43, %40 ]
%48 = call i32 @floor(x86_fp80 %47)
%49 = add nuw nsw i32 %11, 1
%50 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %49, i32 %48)
%51 = load i32, i32* %3
%52 = icmp slt i32 %49, %51
br i1 %52, label %10, label %53
53: ; preds = %46, %2
ret i32 0
}