#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 ceil(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int);
int primeCheckS(int numCheck) {
  int isPrime = 0;
  for (int i = 1; i <= ceil(sqrt(numCheck)); i++) {
    if (numCheck % i == 0) {
      if (i == 1 || i == numCheck) {
        isPrime = 1;
      } else {
        isPrime = 0;
      }
    }
  }
  return (isPrime);
}


x86 assembly (clang, -O0):
<primeCheckS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     11ac <primeCheckS+0x8c>
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1199 <primeCheckS+0x79>
cmpl   $0x1,-0xc(%rbp)
je     1181 <primeCheckS+0x61>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    118d <primeCheckS+0x6d>
movl   $0x1,-0x8(%rbp)
jmp    1194 <primeCheckS+0x74>
movl   $0x0,-0x8(%rbp)
jmp    1199 <primeCheckS+0x79>
jmp    119e <primeCheckS+0x7e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <primeCheckS+0x19>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primeCheckS>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
xor    %r14d,%r14d
test   %eax,%eax
jle    1186 <primeCheckS+0x66>
mov    $0x1,%ebp
jmp    1168 <primeCheckS+0x48>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%rbp),%ebx
mov    %r15d,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
cmp    %eax,%ebp
mov    %ebx,%ebp
jge    1186 <primeCheckS+0x66>
mov    %r15d,%eax
cltd
idiv   %ebp
cmp    $0x1,%ebp
sete   %al
cmp    %ebp,%r15d
sete   %cl
test   %edx,%edx
jne    1150 <primeCheckS+0x30>
or     %cl,%al
movzbl %al,%r14d
jmp    1150 <primeCheckS+0x30>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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