#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 */
long long phi(long long);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, long long *);
int main() {
  long long int n, m;
  while (scanf("%lld", &n) && n) {
    m = phi(n);
    if (n == 1)
      printf("0\n");
    else
      printf("%lld\n", m);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
je     116c <main+0x3c>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    117c <main+0x4c>
jmp    11be <main+0x8e>
mov    -0x10(%rbp),%rdi
call   1040 <phi@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    11a7 <main+0x77>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b9 <main+0x89>
mov    -0x18(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
je     11c6 <main+0x86>
mov    (%rsp),%rdi
test   %rdi,%rdi
je     11c6 <main+0x86>
lea    0xe9f(%rip),%r14
lea    0xe8d(%rip),%r15
mov    %rsp,%rbx
lea    0xe88(%rip),%r12
nopl   (%rax)
call   1050 <phi@plt>
cmpq   $0x1,(%rsp)
jne    11a0 <main+0x60>
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    11ad <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
je     11c6 <main+0x86>
mov    (%rsp),%rdi
test   %rdi,%rdi
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
br label %4
4: ; preds = %22, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i64, i64* %2
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %12, label %23
12: ; preds = %10
%13 = load i64, i64* %2
%14 = call i64 @phi(i64 %13)
store i64 %14, i64* %3
%15 = load i64, i64* %2
%16 = icmp eq i64 %15, 1
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %22
19: ; preds = %12
%20 = load i64, i64* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %20)
br label %22
22: ; preds = %19, %17
br label %4
23: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.2 = [6 x i8] c"%lld\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = icmp ne i64 %3, 0
%5 = load i64, i64* %1
%6 = icmp ne i64 %5, 0
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %23
8: ; preds = %0, %17
%9 = phi i64 [ %20, %17 ], [ %5, %0 ]
%10 = call i64 @phi(i64 %9)
%11 = load i64, i64* %1
%12 = icmp eq i64 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %17
15: ; preds = %8
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %10)
br label %17
17: ; preds = %15, %13
%18 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %1)
%19 = icmp ne i64 %18, 0
%20 = load i64, i64* %1
%21 = icmp ne i64 %20, 0
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %8, label %23
23: ; preds = %17, %0
ret i32 0
}