#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 */
typedef int int16_t;

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ is_prime(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, char *);
int strlen(char *);
int main() {
  int16_t i, j, s;
  char p[21];
  char l[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  while (scanf("%s", p) != EOF) {
    s = 0;
    for (i = 0; i < strlen(p); i++) {
      for (j = 0; j <= 51; j++) {
        if (p[i] == l[j]) {
          s += j + 1;
          break;
        }
      }
    }
    if (is_prime(s)) {
      printf("It is a prime word.\n");
    } else {
      printf("It is not a prime word.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe93(%rip),%rsi
mov    $0x35,%edx
call   1050 <memcpy@plt>
lea    -0x30(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1070 <scanf@plt>
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%rax
je     1257 <main+0x107>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x74(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
cmp    %ecx,%eax
jge    1223 <main+0xd3>
movl   $0x0,-0xc(%rbp)
cmpl   $0x33,-0xc(%rbp)
jg     1210 <main+0xc0>
movslq -0x8(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11fd <main+0xad>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1210 <main+0xc0>
jmp    1202 <main+0xb2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c8 <main+0x78>
jmp    1215 <main+0xc5>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a5 <main+0x55>
mov    -0x10(%rbp),%edi
call   1060 <is_prime@plt>
cmp    $0x0,%rax
je     1246 <main+0xf6>
lea    0xdfc(%rip),%rdi
call   1040 <printf@plt>
jmp    1252 <main+0x102>
lea    0xe00(%rip),%rdi
call   1040 <printf@plt>
jmp    1177 <main+0x27>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
mov    0x2e84(%rip),%r12
cmp    (%r12),%rax
jne    117b <main+0x3b>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%r15
lea    0xe7b(%rip),%rbx
lea    0xea9(%rip),%r14
jmp    11c6 <main+0x86>
xchg   %ax,%ax
xor    %r13d,%r13d
mov    %r13d,%edi
call   1050 <is_prime@plt>
test   %rax,%rax
lea    0xeab(%rip),%rdi
lea    0xe8c(%rip),%rax
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
cmp    (%r12),%rax
je     116a <main+0x2a>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1190 <main+0x50>
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11fe <main+0xbe>
nopl   0x0(%rax)
add    $0xfffffffffffffffd,%rax
add    %eax,%r13d
add    $0x1,%r13d
add    $0x1,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1193 <main+0x53>
mov    (%rsp,%rbp,1),%cl
mov    $0x3,%eax
cs nopw 0x0(%rax,%rax,1)
cmp    -0x3(%rax,%rbx,1),%cl
je     11e0 <main+0xa0>
cmp    -0x2(%rax,%rbx,1),%cl
je     1240 <main+0x100>
cmp    -0x1(%rax,%rbx,1),%cl
je     1246 <main+0x106>
cmp    (%rax,%rbx,1),%cl
je     11e4 <main+0xa4>
add    $0x4,%rax
cmp    $0x37,%rax
jne    1210 <main+0xd0>
jmp    11eb <main+0xab>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xfffffffffffffffe,%rax
jmp    11e4 <main+0xa4>
add    $0xffffffffffffffff,%rax
jmp    11e4 <main+0xa4>

LLVM IR (-O0):
@__const.main.l = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [21 x i8] c"It is a prime word.\0A\00"
@.str.2 = [25 x i8] c"It is not a prime word.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [21 x i8]
%6 = alloca [53 x i8]
store i32 0, i32* %1
%7 = bitcast [53 x i8]* %6 to i8*
br label %8
8: ; preds = %56, %0
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %57
13: ; preds = %8
store i32 0, i32* %4
store i32 0, i32* %2
br label %14
14: ; preds = %45, %13
%15 = load i32, i32* %2
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %48
19: ; preds = %14
store i32 0, i32* %3
br label %20
20: ; preds = %41, %19
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 51
br i1 %22, label %23, label %44
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [21 x i8], [21 x i8]* %5, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [53 x i8], [53 x i8]* %6, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %28, %33
br i1 %34, label %35, label %40
35: ; preds = %23
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
%38 = load i32, i32* %4
%39 = add nsw i32 %38, %37
store i32 %39, i32* %4
br label %44
40: ; preds = %23
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %20
44: ; preds = %35, %20
br label %45
45: ; preds = %44
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %14
48: ; preds = %14
%49 = load i32, i32* %4
%50 = call i64 @is_prime(i32 %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %56
54: ; preds = %48
%55 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
br label %8
57: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@__const.main.l = [53 x i8] c"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@str = [24 x i8] c"It is not a prime word.\00"
@str.3 = [20 x i8] c"It is a prime word.\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %57, label %6
6: ; preds = %0, %48
%7 = call i32 @strlen(i8* %2)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %48
9: ; preds = %6, %42
%10 = phi i64 [ %44, %42 ], [ 0, %6 ]
%11 = phi i32 [ %43, %42 ], [ 0, %6 ]
%12 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 %10
%13 = load i8, i8* %12
br label %14
14: ; preds = %39, %9
%15 = phi i64 [ 0, %9 ], [ %40, %39 ]
%16 = getelementptr inbounds [53 x i8], [53 x i8]* @__const.main.l, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %13, %17
br i1 %18, label %19, label %24
19: ; preds = %34, %29, %24, %14
%20 = phi i64 [ %15, %14 ], [ %25, %24 ], [ %30, %29 ], [ %35, %34 ]
%21 = trunc i64 %20 to i32
%22 = add nuw nsw i32 %21, 1
%23 = add nsw i32 %22, %11
br label %42
24: ; preds = %14
%25 = or i64 %15, 1
%26 = getelementptr inbounds [53 x i8], [53 x i8]* @__const.main.l, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %13, %27
br i1 %28, label %19, label %29
29: ; preds = %24
%30 = or i64 %15, 2
%31 = getelementptr inbounds [53 x i8], [53 x i8]* @__const.main.l, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %13, %32
br i1 %33, label %19, label %34
34: ; preds = %29
%35 = or i64 %15, 3
%36 = getelementptr inbounds [53 x i8], [53 x i8]* @__const.main.l, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = icmp eq i8 %13, %37
br i1 %38, label %19, label %39
39: ; preds = %34
%40 = add nuw nsw i64 %15, 4
%41 = icmp eq i64 %40, 52
br i1 %41, label %42, label %14
42: ; preds = %39, %19
%43 = phi i32 [ %23, %19 ], [ %11, %39 ]
%44 = add nuw nsw i64 %10, 1
%45 = call i32 @strlen(i8* %2)
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %44, %46
br i1 %47, label %9, label %48
48: ; preds = %42, %6
%49 = phi i32 [ 0, %6 ], [ %43, %42 ]
%50 = call i64 @is_prime(i32 %49)
%51 = icmp eq i64 %50, 0
%52 = select i1 %51, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.3, i64 0, i64 0)
%53 = call i32 @puts(i8* dereferenceable(1) %52)
%54 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%55 = load i64, i64* @EOF
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %6
57: ; preds = %48, %0
ret i32 0
}