#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 *, unsigned int *);
int main() {
  unsigned int isPrime = 0;
  scanf("%u", &isPrime);
  for (unsigned int i = 2; i < isPrime; i++)
    if ((isPrime % i == 0)) {
      printf("It is a prime number.\n");
      return 0;
    }
  printf("It is not a prime number.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1195 <main+0x75>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    1182 <main+0x62>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <main+0x88>
jmp    1187 <main+0x67>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x2d>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
lea    0xebe(%rip),%rdi
cmp    $0x3,%ecx
jb     1176 <main+0x56>
mov    $0x2,%esi
lea    0xec7(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     1173 <main+0x53>
add    $0x1,%esi
cmp    %esi,%ecx
jne    1160 <main+0x40>
jmp    1176 <main+0x56>
mov    %r8,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [23 x i8] c"It is a prime number.\0A\00"
@.str.2 = [27 x i8] c"It is not a prime number.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%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 = %17, %0
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = urem i32 %10, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %22
16: ; preds = %9
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %22
22: ; preds = %20, %14
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@str = [26 x i8] c"It is not a prime number.\00"
@str.3 = [22 x i8] c"It is a prime number.\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 = load i32, i32* %1
%5 = icmp ugt i32 %4, 2
br i1 %5, label %8, label %13
6: ; preds = %8
%7 = icmp eq i32 %12, %4
br i1 %7, label %13, label %8
8: ; preds = %0, %6
%9 = phi i32 [ %12, %6 ], [ 2, %0 ]
%10 = urem i32 %4, %9
%11 = icmp eq i32 %10, 0
%12 = add nuw i32 %9, 1
br i1 %11, label %13, label %6
13: ; preds = %6, %8, %0
%14 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0), %6 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 0
}