#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 atoi(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  int i;
  int x;
  if (argc > 2 || argc < 2) {
    printf("%s", "error\n");
    return (0);
  }
  x = atoi(argv[1]);
  if (x == 1) {
    printf("%s", "no\n");
    return (0);
  }
  if (x == 2) {
    printf("%s", "yes\n");
    return (0);
  }
  i = 2;
  while (i < x) {
    if (x % i == 0) {
      printf("%s", "no\n");
      return (0);
    }
    i++;
  }
  printf("%s", "yes\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     114a <main+0x2a>
cmpl   $0x2,-0x8(%rbp)
jge    1169 <main+0x49>
lea    0xeaf(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    11a2 <main+0x82>
lea    0xe76(%rip),%rdi
lea    0xe79(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
cmpl   $0x2,-0x18(%rbp)
jne    11cb <main+0xab>
lea    0xe4d(%rip),%rdi
lea    0xe54(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    121b <main+0xfb>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    120d <main+0xed>
lea    0xe0b(%rip),%rdi
lea    0xe0e(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0x115>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d2 <main+0xb2>
lea    0xdde(%rip),%rdi
lea    0xde5(%rip),%rsi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114b <main+0x2b>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
lea    0xed4(%rip),%rsi
cmp    $0x1,%eax
je     1152 <main+0x32>
mov    %eax,%ecx
cmp    $0x2,%eax
jne    1162 <main+0x42>
lea    0xec5(%rip),%rsi
jmp    1152 <main+0x32>
lea    0xeb1(%rip),%rsi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea5(%rip),%r8
jle    1180 <main+0x60>
mov    $0x2,%edi
mov    %ecx,%eax
cltd
idiv   %edi
test   %edx,%edx
je     1152 <main+0x32>
add    $0x1,%edi
cmp    %edi,%ecx
jne    1170 <main+0x50>
mov    %r8,%rsi
jmp    1152 <main+0x32>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"error\0A\00"
@.str.2 = [4 x i8] c"no\0A\00"
@.str.3 = [5 x i8] c"yes\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 2
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10, %2
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %46
15: ; preds = %10
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %7
%20 = load i32, i32* %7
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %46
24: ; preds = %15
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %46
29: ; preds = %24
store i32 2, i32* %6
br label %30
30: ; preds = %41, %29
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %44
34: ; preds = %30
%35 = load i32, i32* %7
%36 = load i32, i32* %6
%37 = srem i32 %35, %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %46
41: ; preds = %34
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %30
44: ; preds = %30
%45 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %3
br label %46
46: ; preds = %44, %39, %27, %22, %13
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [7 x i8] c"error\0A\00"
@.str.2 = [4 x i8] c"no\0A\00"
@.str.3 = [5 x i8] c"yes\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
switch i32 %7, label %8 [
i32 1, label %18
i32 2, label %10
]
8: ; preds = %4
%9 = icmp sgt i32 %7, 2
br i1 %9, label %13, label %18
10: ; preds = %4
br label %18
11: ; preds = %13
%12 = icmp eq i32 %17, %7
br i1 %12, label %18, label %13
13: ; preds = %8, %11
%14 = phi i32 [ %17, %11 ], [ 2, %8 ]
%15 = srem i32 %7, %14
%16 = icmp eq i32 %15, 0
%17 = add nuw nsw i32 %14, 1
br i1 %16, label %18, label %11
18: ; preds = %11, %13, %8, %4, %2, %10
%19 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %13 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %11 ]
%20 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
ret i32 0
}