#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 */
float floor(float);
float log(int);
int isPrime_al(int n) {
  if (n == 2 || n == 1)
    return 1;
  float exp = log(n) / log(2);
  if (exp - floor(exp) != 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isPrime_al>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     113f <isPrime_al+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    114b <isPrime_al+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    11bd <isPrime_al+0x9d>
mov    -0x8(%rbp),%edi
call   1030 <log@plt>
movss  %xmm0,-0x14(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
subss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11aa <isPrime_al+0x8a>
jp     11aa <isPrime_al+0x8a>
jmp    11b6 <isPrime_al+0x96>
movl   $0x1,-0x4(%rbp)
jmp    11bd <isPrime_al+0x9d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime_al>:
lea    -0x1(%rdi),%ecx
mov    $0x1,%eax
cmp    $0x2,%ecx
jb     1178 <isPrime_al+0x58>
push   %rax
call   1040 <log@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x2,%edi
call   1040 <log@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movaps %xmm1,%xmm0
call   1030 <floorf@plt>
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cmpneqss %xmm1,%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @isPrime_al(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 2
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 1, i32* %2
br label %23
11: ; preds = %7
%12 = load i32, i32* %3
%13 = call float @log(i32 %12)
%14 = call float @log(i32 2)
%15 = fdiv float %13, %14
store float %15, float* %4
%16 = load float, float* %4
%17 = load float, float* %4
%18 = call float @floor(float %17)
%19 = fsub float %16, %18
%20 = fcmp une float %19, 0.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %11
store i32 1, i32* %2
br label %23
22: ; preds = %11
store i32 0, i32* %2
br label %23
23: ; preds = %22, %21, %10
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @isPrime_al(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 2
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call float @log(i32 %0)
%6 = tail call float @log(i32 2)
%7 = fdiv float %5, %6
%8 = tail call float @llvm.floor.f32(float %7)
%9 = fsub float %7, %8
%10 = fcmp une float %9, 0.000000e+00
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ %11, %4 ], [ 1, %1 ]
ret i32 %13
}