#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;
  printf("n: ");
  scanf("%d", &n);
  if (n <= 100) {
    i = 2;
    while (n % i != 0) {
      i = i + 1;
    }
    if (i == n) {
      printf("true\n");
    } else {
      printf("false\n");
    }
  } else {
    printf("Invalid input! Please enter an integer n <= 100.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jg     11a8 <main+0x88>
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
je     117a <main+0x5a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <main+0x3c>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1197 <main+0x77>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x83>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    11b4 <main+0x94>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
cmp    $0x64,%ecx
jg     1185 <main+0x55>
mov    $0x2,%esi
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %esi
add    $0x1,%esi
test   %edx,%edx
jne    1160 <main+0x30>
sub    %ecx,%esi
cmp    $0x1,%esi
lea    0xec6(%rip),%rax
lea    0xeb9(%rip),%rdi
cmove  %rax,%rdi
jmp    118c <main+0x5c>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"true\0A\00"
@.str.3 = [7 x i8] c"false\0A\00"
@.str.4 = [50 x i8] c"Invalid input! Please enter an integer n <= 100.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 100
br i1 %7, label %8, label %26
8: ; preds = %0
store i32 2, i32* %3
br label %9
9: ; preds = %14, %8
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = srem i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %9
17: ; preds = %9
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %25
23: ; preds = %17
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %28
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"n: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [49 x i8] c"Invalid input! Please enter an integer n <= 100.\00"
@str.5 = [6 x i8] c"false\00"
@str.6 = [5 x i8] c"true\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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 slt i32 %5, 101
br i1 %6, label %7, label %15
7: ; preds = %0, %7
%8 = phi i32 [ %11, %7 ], [ 2, %0 ]
%9 = srem i32 %5, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %7
12: ; preds = %7
%13 = icmp eq i32 %8, %5
%14 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0)
br label %15
15: ; preds = %0, %12
%16 = phi i8* [ %14, %12 ], [ getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0), %0 ]
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}