#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 *);
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 2; i <= (n - 1); i++) {
    if (n % i == 0) {
      printf(" Not Prime");
      break;
    }
  }
  if (n == i) {
    printf("Its a prime number");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     118b <main+0x6b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1178 <main+0x58>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    118b <main+0x6b>
jmp    117d <main+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11a3 <main+0x83>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ecx
mov    $0x2,%ebx
cmp    $0x3,%ecx
jl     1172 <main+0x52>
mov    $0x2,%ebx
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %ebx
test   %edx,%edx
je     1162 <main+0x42>
add    $0x1,%ebx
cmp    %ebx,%ecx
jne    1150 <main+0x30>
jmp    1176 <main+0x56>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rsp),%ecx
cmp    %ebx,%ecx
jne    1182 <main+0x62>
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c" Not Prime\00"
@.str.2 = [19 x i8] c"Its a prime number\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 = load i32, i32* %1
%5 = icmp sgt i32 %4, 2
br i1 %5, label %6, label %16
6: ; preds = %0, %13
%7 = phi i32 [ %14, %13 ], [ 2, %0 ]
%8 = srem i32 %4, %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %1
br label %16
13: ; preds = %6
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, %4
br i1 %15, label %20, label %6
16: ; preds = %0, %10
%17 = phi i32 [ %12, %10 ], [ %4, %0 ]
%18 = phi i32 [ %7, %10 ], [ 2, %0 ]
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %13, %16
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
ret i32 0
}