#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 */
scalar_t__ ceil(int);
int log10(int);
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
int main() {
  int n;
  while (scanf("%d", &n) == 1)
    printf(
        "%d\n",
        n < 2
            ? 1
            : (int)ceil(
                  log10(
                      2 *
                      3.141592653589793238462643383279502884197169399375105820974944592307816406286 *
                      n) /
                      2 +
                  n * (log10(
                          n /
                          2.718281828459045235360287471352662497757247093699959574966967627724076630353))));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ed <main+0xad>
cmpl   $0x2,-0x8(%rbp)
jge    117f <main+0x3f>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d9 <main+0x99>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe7c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log10@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log10@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
add    %eax,%edi
call   1030 <ceil@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1040 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11f4 <main+0xb4>
lea    0xea6(%rip),%r14
lea    0xe9c(%rip),%r15
lea    0xc(%rsp),%r12
jmp    1198 <main+0x58>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11f4 <main+0xb4>
mov    0xc(%rsp),%eax
mov    $0x1,%esi
cmp    $0x2,%eax
jl     1180 <main+0x40>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe4b(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log10@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
mov    0xc(%rsp),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
sar    %ebx
divsd  0xe2e(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <log10@plt>
imul   %eax,%ebp
add    %ebx,%ebp
mov    %ebp,%edi
call   1030 <ceil@plt>
mov    %rax,%rsi
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %27, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %30
6: ; preds = %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %6
br label %27
10: ; preds = %6
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = fmul double 0x401921FB54442D18, %12
%14 = fptosi double %13 to i32
%15 = call i32 @log10(i32 %14)
%16 = sdiv i32 %15, 2
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 0x4005BF0A8B145769
%21 = fptosi double %20 to i32
%22 = call i32 @log10(i32 %21)
%23 = mul nsw i32 %17, %22
%24 = add nsw i32 %16, %23
%25 = call i64 @ceil(i32 %24)
%26 = trunc i64 %25 to i32
br label %27
27: ; preds = %10, %9
%28 = phi i32 [ 1, %9 ], [ %26, %10 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %3
30: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %28
5: ; preds = %0, %23
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 2
br i1 %7, label %23, label %8
8: ; preds = %5
%9 = sitofp i32 %6 to double
%10 = fmul double %9, 0x401921FB54442D18
%11 = fptosi double %10 to i32
%12 = call i32 @log10(i32 %11)
%13 = sdiv i32 %12, 2
%14 = load i32, i32* %1
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 0x4005BF0A8B145769
%17 = fptosi double %16 to i32
%18 = call i32 @log10(i32 %17)
%19 = mul nsw i32 %18, %14
%20 = add nsw i32 %19, %13
%21 = call i64 @ceil(i32 %20)
%22 = trunc i64 %21 to i32
br label %23
23: ; preds = %5, %8
%24 = phi i32 [ %22, %8 ], [ 1, %5 ]
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%27 = icmp eq i32 %26, 1
br i1 %27, label %5, label %28
28: ; preds = %23, %0
ret i32 0
}