#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 getchar();
int is_prime(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int temp, isPrime, index;
  char num[150];
  for (index = 0; index < 150; index++) {
    temp = getchar();
    if (temp == '\n')
      break;
    num[index] = temp;
  }
  isPrime = is_prime(num);
  printf("%d \n\n", isPrime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x96,-0x10(%rbp)
jge    118d <main+0x5d>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    116f <main+0x3f>
jmp    118d <main+0x5d>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xb0(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1149 <main+0x19>
lea    -0xb0(%rbp),%rdi
call   1050 <is_prime@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     115c <main+0x2c>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x96,%rbx
jne    1140 <main+0x10>
mov    %rsp,%rdi
call   1050 <is_prime@plt>
lea    0xe95(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [150 x i8]
store i32 0, i32* %1
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 150
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = call i32 (...) @getchar()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %9
br label %23
14: ; preds = %9
%15 = load i32, i32* %2
%16 = trunc i32 %15 to i8
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [150 x i8], [150 x i8]* %5, i64 0, i64 %18
store i8 %16, i8* %19
br label %20
20: ; preds = %14
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %13, %6
%24 = getelementptr inbounds [150 x i8], [150 x i8]* %5, i64 0, i64 0
%25 = call i32 @is_prime(i8* %24)
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d \0A\0A\00"
define i32 @main() {
%1 = alloca [150 x i8]
%2 = getelementptr inbounds [150 x i8], [150 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %7
%4 = phi i64 [ 0, %0 ], [ %10, %7 ]
%5 = tail call i32 (...) @getchar()
%6 = icmp eq i32 %5, 10
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = trunc i32 %5 to i8
%9 = getelementptr inbounds [150 x i8], [150 x i8]* %1, i64 0, i64 %4
store i8 %8, i8* %9
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 150
br i1 %11, label %12, label %3
12: ; preds = %3, %7
%13 = call i32 @is_prime(i8* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}