#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 */
scalar_t__ Prime(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sqrt(int);
int main() {
  int num;
  scanf("%d", &num);
  if (num == 2)
    printf("It is a prime number");
  else if (num % 2 == 0)
    printf("It is not a prime number");
  else if (Prime(num, sqrt(num)))
    printf("It is a prime number");
  else
    printf("It is not a prime number");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2,-0x8(%rbp)
jne    117a <main+0x3a>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
jmp    11e8 <main+0xa8>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119f <main+0x5f>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
jmp    11e3 <main+0xa3>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <sqrt@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1050 <Prime@plt>
cmp    $0x0,%rax
je     11d2 <main+0x92>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    11de <main+0x9e>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e3 <main+0xa3>
jmp    11e8 <main+0xa8>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0x2,%ebx
jne    1168 <main+0x28>
lea    0xe9d(%rip),%rdi
jmp    119b <main+0x5b>
test   $0x1,%bl
jne    1176 <main+0x36>
lea    0xea4(%rip),%rdi
jmp    119b <main+0x5b>
mov    %ebx,%edi
call   1060 <sqrt@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <Prime@plt>
test   %rax,%rax
lea    0xe88(%rip),%rax
lea    0xe6c(%rip),%rdi
cmove  %rax,%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 = [21 x i8] c"It is a prime number\00"
@.str.2 = [25 x i8] c"It is not a prime number\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %26
8: ; preds = %0
%9 = load i32, i32* %2
%10 = srem i32 %9, 2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %25
14: ; preds = %8
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = call i32 @sqrt(i32 %16)
%18 = call i64 @Prime(i32 %15, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %24
22: ; preds = %14
%23 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %20
br label %25
25: ; preds = %24, %12
br label %26
26: ; preds = %25, %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [21 x i8] c"It is a prime number\00"
@.str.2 = [25 x i8] c"It is not 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 eq i32 %4, 2
br i1 %5, label %14, label %6
6: ; preds = %0
%7 = and i32 %4, 1
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = call i32 @sqrt(i32 %4)
%11 = call i64 @Prime(i32 %4, i32 %10)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0)
br label %14
14: ; preds = %9, %6, %0
%15 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %6 ], [ %13, %9 ]
%16 = call i32 @printf(i8* dereferenceable(1) %15)
ret i32 0
}