#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
scalar_t__ sqrt(int);
int main(int argc, const char *argv[]) {
  int m, n, i;
  scanf("%d", &m);
  n = (int)sqrt(m) + 1;
  for (i = 2; i <= n; i++) {
    if (m % i) {
      continue;
    } else {
      printf("0");
      return 0;
    }
  }
  printf("1");
  return 0;
}


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
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1050 <sqrt@plt>
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11b2 <main+0x82>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
cmp    $0x0,%edx
je     118c <main+0x5c>
jmp    11a4 <main+0x74>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c5 <main+0x95>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <main+0x3b>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
call   1050 <sqrt@plt>
mov    %rax,%rcx
mov    $0x31,%edi
test   %ecx,%ecx
jle    1193 <main+0x63>
mov    0x4(%rsp),%r8d
neg    %ecx
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r8d,%eax
cltd
idiv   %esi
test   %edx,%edx
je     118e <main+0x5e>
lea    (%rcx,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x2,%eax
jne    1170 <main+0x40>
jmp    1193 <main+0x63>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %6
%11 = call i64 @sqrt(i32 %10)
%12 = trunc i64 %11 to i32
%13 = add nsw i32 %12, 1
store i32 %13, i32* %7
store i32 2, i32* %8
br label %14
14: ; preds = %26, %2
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32, i32* %6
%20 = load i32, i32* %8
%21 = srem i32 %19, %20
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %18
br label %26
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %31
26: ; preds = %23
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %14
29: ; preds = %14
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %29, %24
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i64 @sqrt(i32 %6)
%8 = trunc i64 %7 to i32
%9 = icmp slt i32 %8, 1
br i1 %9, label %20, label %10
10: ; preds = %2
%11 = load i32, i32* %3
%12 = add i32 %8, 1
br label %16
13: ; preds = %16
%14 = add nuw i32 %17, 1
%15 = icmp eq i32 %17, %12
br i1 %15, label %20, label %16
16: ; preds = %10, %13
%17 = phi i32 [ 2, %10 ], [ %14, %13 ]
%18 = srem i32 %11, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %13
20: ; preds = %13, %16, %2
%21 = phi i32 [ 49, %2 ], [ 48, %16 ], [ 49, %13 ]
%22 = call i32 @putchar(i32 %21)
ret i32 0
}