#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 floor(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(long);
int estPremier(long n) {
  int boolean;
  int i;
  for (i = 2; i <= floor(sqrt(n)); ++i) {
    if (n % i == 0) {
      boolean = 0;
      return boolean;
    }
  }
  boolean = 1;
  return boolean;
}


x86 assembly (clang, -O0):
<estPremier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sqrt@plt>
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     1192 <estPremier+0x72>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    117f <estPremier+0x5f>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    119f <estPremier+0x7f>
jmp    1184 <estPremier+0x64>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1133 <estPremier+0x13>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estPremier>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <sqrt@plt>
mov    %eax,%edi
call   1040 <floor@plt>
mov    $0x1,%r14d
cmp    $0x2,%eax
jl     1196 <estPremier+0x76>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
mov    %rbx,%rax
or     %rbp,%rax
shr    $0x20,%rax
je     1170 <estPremier+0x50>
mov    %rbx,%rax
cqto
idiv   %rbp
test   %rdx,%rdx
jne    117b <estPremier+0x5b>
jmp    1193 <estPremier+0x73>
nop
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %rdx,%rdx
je     1193 <estPremier+0x73>
mov    %rbx,%rdi
call   1030 <sqrt@plt>
mov    %eax,%edi
call   1040 <floor@plt>
cltq
cmp    %rax,%rbp
jl     1150 <estPremier+0x30>
jmp    1196 <estPremier+0x76>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @estPremier(i64 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 2, i32* %5
br label %6
6: ; preds = %21, %1
%7 = load i32, i32* %5
%8 = load i64, i64* %3
%9 = call i32 @sqrt(i64 %8)
%10 = call i32 @floor(i32 %9)
%11 = icmp sle i32 %7, %10
br i1 %11, label %12, label %24
12: ; preds = %6
%13 = load i64, i64* %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = srem i64 %13, %15
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
store i32 0, i32* %4
%19 = load i32, i32* %4
store i32 %19, i32* %2
br label %26
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %6
24: ; preds = %6
store i32 1, i32* %4
%25 = load i32, i32* %4
store i32 %25, i32* %2
br label %26
26: ; preds = %24, %18
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @estPremier(i64 %0) {
%2 = tail call i32 @sqrt(i64 %0)
%3 = tail call i32 @floor(i32 %2)
%4 = icmp slt i32 %3, 2
br i1 %4, label %15, label %11
5: ; preds = %11
%6 = add nuw nsw i64 %12, 1
%7 = tail call i32 @sqrt(i64 %0)
%8 = tail call i32 @floor(i32 %7)
%9 = sext i32 %8 to i64
%10 = icmp slt i64 %12, %9
br i1 %10, label %11, label %15
11: ; preds = %1, %5
%12 = phi i64 [ %6, %5 ], [ 2, %1 ]
%13 = srem i64 %0, %12
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %11, %5, %1
%16 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %11 ]
ret i32 %16
}