#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 /*<<< orphan*/ printf(char *);
int is_prime(int number) {
  int i = 2;
  while (number % i != 0) {
    i++;
  }
  if (i == number) {
    printf("1");
  }
  if (i != number) {
    if (number > 0)
      printf("0");
  }
  if (number < 0 || number == 1)
    printf("-1");
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     1140 <is_prime+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <is_prime+0x12>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    1158 <is_prime+0x48>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     117f <is_prime+0x6f>
cmpl   $0x0,-0x4(%rbp)
jle    117a <is_prime+0x6a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    117f <is_prime+0x6f>
cmpl   $0x0,-0x4(%rbp)
jl     1193 <is_prime+0x83>
cmpl   $0x1,-0x4(%rbp)
jne    119f <is_prime+0x8f>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x2,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%eax
cltd
idiv   %ebp
add    $0x1,%ebp
test   %edx,%edx
jne    1130 <is_prime+0x10>
sub    %ebx,%ebp
cmp    $0x1,%ebp
jne    114d <is_prime+0x2d>
mov    $0x31,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    1160 <is_prime+0x40>
cmp    $0x1,%ebp
je     1160 <is_prime+0x40>
mov    $0x30,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
js     1169 <is_prime+0x49>
cmp    $0x1,%ebx
jne    1175 <is_prime+0x55>
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.2 = [3 x i8] c"-1\00"
define i32 @is_prime(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 2, %1 ], [ %6, %2 ]
%4 = srem i32 %0, %3
%5 = icmp eq i32 %4, 0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = icmp eq i32 %3, %0
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @putchar(i32 49)
br label %11
11: ; preds = %9, %7
%12 = icmp ne i32 %3, %0
%13 = icmp sgt i32 %0, 0
%14 = and i1 %13, %12
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @putchar(i32 48)
br label %17
17: ; preds = %15, %11
%18 = icmp slt i32 %0, 0
%19 = icmp eq i32 %0, 1
%20 = or i1 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %17, %21
ret i32 1
}