#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 *);
void checkPrime() {
  int input, i;
  printf("Enter Number\n\n>>");
  scanf("%d", &input);
  for (i = 2; i < input; i++) {
    if (input % i == 0 && i != input) {
      printf("not a prime number");
    }
  }
  printf("a prime number");
}


x86 assembly (clang, -O0):
<checkPrime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1192 <checkPrime+0x72>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    117f <checkPrime+0x5f>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     117f <checkPrime+0x5f>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    1184 <checkPrime+0x64>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <checkPrime+0x2b>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkPrime>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0x3,%ecx
jl     117e <checkPrime+0x5e>
mov    $0x2,%ebp
lea    0xebf(%rip),%rbx
jmp    1167 <checkPrime+0x47>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ecx,%ebp
jge    117e <checkPrime+0x5e>
mov    %ecx,%eax
cltd
idiv   %ebp
test   %edx,%edx
jne    1160 <checkPrime+0x40>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
jmp    1160 <checkPrime+0x40>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Enter Number\0A\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"not a prime number\00"
@.str.3 = [15 x i8] c"a prime number\00"
define void @checkPrime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 2
br i1 %6, label %7, label %19
7: ; preds = %0, %15
%8 = phi i32 [ %16, %15 ], [ %5, %0 ]
%9 = phi i32 [ %17, %15 ], [ 2, %0 ]
%10 = srem i32 %8, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %1
br label %15
15: ; preds = %7, %12
%16 = phi i32 [ %8, %7 ], [ %14, %12 ]
%17 = add nuw nsw i32 %9, 1
%18 = icmp slt i32 %17, %16
br i1 %18, label %7, label %19
19: ; preds = %15, %0
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
ret void
}