#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 uint64_t;
struct random_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ is_probably_prime(int, struct random_data *);
bool is_prime(uint64_t n, struct random_data *r_data) {
  if (n < 2 || n % 2 == 0) {
    return false;
  } else if (n < 4) {
    return true;
  }
  for (int i = 0; i < 10; i++) {
    if (!is_probably_prime(n, r_data))
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     113d <is_prime+0x2d>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1149 <is_prime+0x39>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <is_prime+0xa0>
cmpl   $0x4,-0x8(%rbp)
jge    115f <is_prime+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <is_prime+0xa0>
jmp    1164 <is_prime+0x54>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11a9 <is_prime+0x99>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <is_probably_prime@plt>
cmp    $0x0,%eax
jne    1196 <is_prime+0x86>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <is_prime+0xa0>
jmp    119b <is_prime+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116b <is_prime+0x5b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11d5 <is_prime+0xc5>
mov    %edi,%ebp
mov    %edi,%eax
and    $0x1,%eax
je     11d5 <is_prime+0xc5>
mov    $0x1,%eax
cmp    $0x4,%ebp
jb     11d7 <is_prime+0xc7>
mov    %rsi,%rbx
mov    %ebp,%edi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
test   %eax,%eax
je     11d5 <is_prime+0xc5>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
mov    %eax,%ecx
mov    $0x0,%eax
test   %ecx,%ecx
je     11d7 <is_prime+0xc7>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <is_probably_prime@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
jmp    11d7 <is_prime+0xc7>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.random_data = type { i32 }
define i32 @is_prime(i32 %0, %struct.random_data* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.random_data*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.random_data* %1, %struct.random_data** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9, %2
store i32 0, i32* %3
br label %34
14: ; preds = %9
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %3
br label %34
18: ; preds = %14
br label %19
19: ; preds = %18
store i32 0, i32* %6
br label %20
20: ; preds = %30, %19
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load %struct.random_data*, %struct.random_data** %5
%26 = call i32 @is_probably_prime(i32 %24, %struct.random_data* %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %23
store i32 0, i32* %3
br label %34
29: ; preds = %23
br label %30
30: ; preds = %29
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %20
33: ; preds = %20
store i32 1, i32* %3
br label %34
34: ; preds = %33, %28, %17, %13
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.random_data = type { i32 }
define i32 @is_prime(i32 %0, %struct.random_data* %1) {
%3 = icmp slt i32 %0, 2
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %40, label %7
7: ; preds = %2
%8 = icmp ult i32 %0, 4
br i1 %8, label %40, label %9
9: ; preds = %7
%10 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %40, label %12
12: ; preds = %9
%13 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%14 = icmp eq i32 %13, 0
br i1 %14, label %40, label %15
15: ; preds = %12
%16 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%17 = icmp eq i32 %16, 0
br i1 %17, label %40, label %18
18: ; preds = %15
%19 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%20 = icmp eq i32 %19, 0
br i1 %20, label %40, label %21
21: ; preds = %18
%22 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%23 = icmp eq i32 %22, 0
br i1 %23, label %40, label %24
24: ; preds = %21
%25 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%26 = icmp eq i32 %25, 0
br i1 %26, label %40, label %27
27: ; preds = %24
%28 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%29 = icmp eq i32 %28, 0
br i1 %29, label %40, label %30
30: ; preds = %27
%31 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %30
%34 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%35 = icmp eq i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = tail call i32 @is_probably_prime(i32 %0, %struct.random_data* %1)
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i32
br label %40
40: ; preds = %36, %9, %12, %15, %18, %21, %24, %27, %30, %33, %7, %2
%41 = phi i32 [ 0, %2 ], [ 1, %7 ], [ 0, %9 ], [ 0, %12 ], [ 0, %15 ], [ 0, %18 ], [ 0, %21 ], [ 0, %24 ], [ 0, %27 ], [ 0, %30 ], [ 0, %33 ], [ %39, %36 ]
ret i32 %41
}