#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 incr();
scalar_t__ isprime(int);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int numbers[] = {2, 3, 4, 5, 6, 7, 13, 17, 19};
  int i;
  for (i = 0; i < 9; i++) {
    printf("%i %s prime\n", numbers[i],
           (isprime(numbers[i])) ? "is" : "is not");
  }
  for (i = 0; i < 9; i++) {
    printf("Now the state is %i.\n", incr());
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x9,-0x44(%rbp)
jge    11cc <main+0x8c>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x48(%rbp)
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1040 <isprime@plt>
mov    -0x48(%rbp),%esi
mov    %rax,%rcx
lea    0xe93(%rip),%rdx
lea    0xe89(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1172 <main+0x32>
movl   $0x0,-0x44(%rbp)
cmpl   $0x9,-0x44(%rbp)
jge    1202 <main+0xc2>
mov    $0x0,%al
call   1060 <incr@plt>
mov    %eax,%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11d3 <main+0x93>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2,%edi
call   1040 <isprime@plt>
test   %rax,%rax
lea    0xec7(%rip),%r15
lea    0xebd(%rip),%rbx
mov    %rbx,%rdx
cmove  %r15,%rdx
lea    0xea2(%rip),%r14
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x7,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xd,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x11,%edi
call   1040 <isprime@plt>
test   %rax,%rax
mov    %rbx,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    $0x11,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x13,%edi
call   1040 <isprime@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %r14,%rdi
mov    $0x13,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
lea    0xd84(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <incr@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.numbers = [9 x i32] [i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 13, i32 17, i32 19]
@.str = [13 x i8] c"%i %s prime\0A\00"
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [7 x i8] c"is not\00"
@.str.3 = [22 x i8] c"Now the state is %i.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [9 x i32]* %6 to i8*
store i32 0, i32* %7
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i64 @isprime(i32 %20)
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %24)
br label %26
26: ; preds = %12
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %9
29: ; preds = %9
store i32 0, i32* %7
br label %30
30: ; preds = %36, %29
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 9
br i1 %32, label %33, label %39
33: ; preds = %30
%34 = call i32 (...) @incr()
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %30
39: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"%i %s prime\0A\00"
@.str.1 = [3 x i8] c"is\00"
@.str.2 = [7 x i8] c"is not\00"
@.str.3 = [22 x i8] c"Now the state is %i.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @isprime(i32 2)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 2, i8* %5)
%7 = tail call i64 @isprime(i32 3)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 3, i8* %9)
%11 = tail call i64 @isprime(i32 4)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 4, i8* %13)
%15 = tail call i64 @isprime(i32 5)
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 5, i8* %17)
%19 = tail call i64 @isprime(i32 6)
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 6, i8* %21)
%23 = tail call i64 @isprime(i32 7)
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 7, i8* %25)
%27 = tail call i64 @isprime(i32 13)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%30 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 13, i8* %29)
%31 = tail call i64 @isprime(i32 17)
%32 = icmp eq i64 %31, 0
%33 = select i1 %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%34 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 17, i8* %33)
%35 = tail call i64 @isprime(i32 19)
%36 = icmp eq i64 %35, 0
%37 = select i1 %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%38 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 19, i8* %37)
%39 = tail call i32 (...) @incr()
%40 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = tail call i32 (...) @incr()
%42 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = tail call i32 (...) @incr()
%44 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %43)
%45 = tail call i32 (...) @incr()
%46 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %45)
%47 = tail call i32 (...) @incr()
%48 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = tail call i32 (...) @incr()
%50 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %49)
%51 = tail call i32 (...) @incr()
%52 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %51)
%53 = tail call i32 (...) @incr()
%54 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = tail call i32 (...) @incr()
%56 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %55)
ret i32 0
}