#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, ...);
main() {
  int t = 0;
  int k = 0;
  int a = 0;
  int N = 0;
  int b = 0;
  int c = 0;
  printf("Please enter a number between 1 and 100:");
  N = getchar() - '0';
  while (N != EOF - '0' && N != '\n' - '0') {
    if (N >= 0 && N <= 9) {
      if (t >= 1)
        c = b * 10 + N;
      b = N;
      t = t++;
      if (t == 1)
        c = b;
    }
    N = getchar() - '0';
  }
  if (c < 1 || c > 100) {
    printf("Invalid Input");
    return (0);
  }
  for (t = 1; t < c; t++) {
    a = c % t;
    if (a == 0) {
      printf("%d ", t);
      k++;
    }
  }
  printf("%d\n", t);
  if (c == t && k == 1)
    printf("\nprime\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
sub    $0x30,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x1d(%rbp)
je     119a <main+0x7a>
cmpl   $0xffffffda,-0x14(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x8a>
jmp    120d <main+0xed>
cmpl   $0x0,-0x14(%rbp)
jl     11fb <main+0xdb>
cmpl   $0x9,-0x14(%rbp)
jg     11fb <main+0xdb>
cmpl   $0x1,-0x8(%rbp)
jl     11d2 <main+0xb2>
imul   $0xa,-0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11f6 <main+0xd6>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11fb <main+0xdb>
mov    $0x0,%al
call   1040 <getchar@plt>
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x54>
cmpl   $0x1,-0x1c(%rbp)
jl     1221 <main+0x101>
cmpl   $0x64,-0x1c(%rbp)
jle    123b <main+0x11b>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12cb <main+0x1ab>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    128f <main+0x16f>
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    127c <main+0x15c>
mov    -0x8(%rbp),%esi
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1281 <main+0x161>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1242 <main+0x122>
mov    -0x8(%rbp),%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    12c4 <main+0x1a4>
cmpl   $0x1,-0xc(%rbp)
jne    12c4 <main+0x1a4>
lea    0xd82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     1160 <main+0x40>
mov    0x2ea6(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    (%rbx),%eax
je     1160 <main+0x40>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
jne    1150 <main+0x30>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Please enter a number between 1 and 100:\00"
@EOF = global i32 0
@.str.1 = [14 x i8] c"Invalid Input\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [8 x i8] c"\0Aprime\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @getchar()
%10 = sub nsw i32 %9, 48
store i32 %10, i32* %5
br label %11
11: ; preds = %44, %0
%12 = load i32, i32* %5
%13 = load i32, i32* @EOF
%14 = sub nsw i32 %13, 48
%15 = icmp ne i32 %12, %14
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, -38
br label %19
19: ; preds = %16, %11
%20 = phi i1 [ false, %11 ], [ %18, %16 ]
br i1 %20, label %21, label %47
21: ; preds = %19
%22 = load i32, i32* %5
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %44
24: ; preds = %21
%25 = load i32, i32* %5
%26 = icmp sle i32 %25, 9
br i1 %26, label %27, label %44
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 1
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* %6
%32 = mul nsw i32 %31, 10
%33 = load i32, i32* %5
%34 = add nsw i32 %32, %33
store i32 %34, i32* %7
br label %35
35: ; preds = %30, %27
%36 = load i32, i32* %5
store i32 %36, i32* %6
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
store i32 %37, i32* %2
%39 = load i32, i32* %2
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i32, i32* %6
store i32 %42, i32* %7
br label %43
43: ; preds = %41, %35
br label %44
44: ; preds = %43, %24, %21
%45 = call i32 (...) @getchar()
%46 = sub nsw i32 %45, 48
store i32 %46, i32* %5
br label %11
47: ; preds = %19
%48 = load i32, i32* %7
%49 = icmp slt i32 %48, 1
br i1 %49, label %53, label %50
50: ; preds = %47
%51 = load i32, i32* %7
%52 = icmp sgt i32 %51, 100
br i1 %52, label %53, label %55
53: ; preds = %50, %47
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %87
55: ; preds = %50
store i32 1, i32* %2
br label %56
56: ; preds = %72, %55
%57 = load i32, i32* %2
%58 = load i32, i32* %7
%59 = icmp slt i32 %57, %58
br i1 %59, label %60, label %75
60: ; preds = %56
%61 = load i32, i32* %7
%62 = load i32, i32* %2
%63 = srem i32 %61, %62
store i32 %63, i32* %4
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %60
%67 = load i32, i32* %2
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %67)
%69 = load i32, i32* %3
%70 = add nsw i32 %69, 1
store i32 %70, i32* %3
br label %71
71: ; preds = %66, %60
br label %72
72: ; preds = %71
%73 = load i32, i32* %2
%74 = add nsw i32 %73, 1
store i32 %74, i32* %2
br label %56
75: ; preds = %56
%76 = load i32, i32* %2
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %7
%79 = load i32, i32* %2
%80 = icmp eq i32 %78, %79
br i1 %80, label %81, label %86
81: ; preds = %75
%82 = load i32, i32* %3
%83 = icmp eq i32 %82, 1
br i1 %83, label %84, label %86
84: ; preds = %81
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %86
86: ; preds = %84, %81, %75
store i32 0, i32* %1
br label %87
87: ; preds = %86, %53
%88 = load i32, i32* %1
ret i32 %88
}

LLVM IR (-O2):
@.str = [41 x i8] c"Please enter a number between 1 and 100:\00"
@EOF = global i32 0
@.str.1 = [14 x i8] c"Invalid Input\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = icmp ne i32 %2, %3
%5 = icmp ne i32 %2, 10
%6 = and i1 %5, %4
br i1 %6, label %7, label %13
7: ; preds = %0, %7
%8 = tail call i32 (...) @getchar()
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
%11 = icmp ne i32 %8, 10
%12 = and i1 %11, %10
br i1 %12, label %7, label %13
13: ; preds = %7, %0
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}