#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int PHI(int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int main(int argc, char **argv) {
  int num;
  printf("Zadejte n:\n");
  if (scanf("%d", &num) == 1)
    if (num > 0) {
      printf("phi(%d) = %d\n", num, PHI(num));
      return (EXIT_SUCCESS);
    }
  printf("Nespravny vstup.\n");
  return (EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    11ae <main+0x7e>
cmpl   $0x0,-0x14(%rbp)
jle    11a9 <main+0x79>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <PHI@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11c8 <main+0x98>
jmp    11ae <main+0x7e>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1191 <main+0x51>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
jle    1191 <main+0x51>
mov    %ebx,%edi
call   1050 <PHI@plt>
lea    0xe86(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e49(%rip),%rax
jmp    11a4 <main+0x64>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"phi(%d) = %d\0A\00"
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@str = [11 x i8] c"Zadejte n:\00"
@str.4 = [17 x i8] c"Nespravny vstup.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = icmp eq i32 %6, 1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @PHI(i32 %8)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %12)
br label %16
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = phi i32* [ @EXIT_SUCCESS, %11 ], [ @EXIT_FAILURE, %14 ]
%18 = load i32, i32* %17
ret i32 %18
}