#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 is_prime(int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int main() {
  int number = 0;
  int counter = 0;
  int error = 0;
  if (scanf("%d", &number) != 1) {
    error = 1;
  }
  is_prime(number);
  counter = is_prime(number);
  if (number / counter == 1 && error == 0) {
    printf("1\n");
  } else {
    if (error == 1) {
      printf("-1\n");
    } else {
      printf("0\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1174 <main+0x44>
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x1,%eax
jne    11b2 <main+0x82>
cmpl   $0x0,-0x10(%rbp)
jne    11b2 <main+0x82>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
jmp    11de <main+0xae>
cmpl   $0x1,-0x10(%rbp)
jne    11cd <main+0x9d>
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
jmp    11d9 <main+0xa9>
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
jmp    11de <main+0xae>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
call   1040 <is_prime@plt>
mov    0xc(%rsp),%edi
call   1040 <is_prime@plt>
mov    %eax,%ecx
mov    0xc(%rsp),%eax
cltd
idiv   %ecx
cmp    $0x1,%ebx
lea    0xe8e(%rip),%rcx
lea    0xe89(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x1,%eax
lea    0xe7c(%rip),%rdi
cmovne %rdx,%rdi
cmp    $0x1,%ebx
cmovne %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [2 x i8] c"0\00"
@str.4 = [3 x i8] c"-1\00"
@str.5 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%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
%5 = load i32, i32* %1
%6 = call i32 @is_prime(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @is_prime(i32 %7)
%9 = load i32, i32* %1
%10 = sdiv i32 %9, %8
%11 = icmp eq i32 %10, 1
%12 = and i1 %4, %11
%13 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.4, i64 0, i64 0)
%14 = select i1 %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0), i8* %13
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 0
}