#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 */
long abs(long);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, long *);
float sqrt(long);
int main() {
  long int n, count;
  scanf("%ld", &n);
  n = abs(n);
  if (n == 0 || n == 1) {
    printf("sim");
  }
  count = 2;
  while ((float)count <= sqrt(n)) {
    if ((n % count) == 0) {
      printf("nao");
      return 0;
    }
    count++;
  }
  printf("sim");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <abs@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1182 <main+0x42>
cmpq   $0x1,-0x10(%rbp)
jne    118e <main+0x4e>
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
movq   $0x2,-0x18(%rbp)
cvtsi2ssq -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <sqrt@plt>
movss  -0x1c(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jb     11f5 <main+0xb5>
mov    -0x10(%rbp),%rax
cqto
idivq  -0x18(%rbp)
cmp    $0x0,%rdx
jne    11e4 <main+0xa4>
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1208 <main+0xc8>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1196 <main+0x56>
lea    0xe08(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%rax
mov    %rax,%rdi
neg    %rdi
cmovs  %rax,%rdi
mov    %rdi,(%rsp)
jae    1162 <main+0x32>
cmp    $0x1,%rdi
jne    1172 <main+0x42>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    (%rsp),%rdi
call   1050 <sqrt@plt>
lea    0xe8a(%rip),%r14
ucomiss 0xe7b(%rip),%xmm0
jb     11ee <main+0xbe>
mov    $0x2,%ebx
lea    0xe79(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rsp),%rdi
mov    %rdi,%rax
or     %rbx,%rax
shr    $0x20,%rax
je     11c0 <main+0x90>
mov    %rdi,%rax
cqto
idiv   %rbx
test   %rdx,%rdx
jne    11cb <main+0x9b>
jmp    11eb <main+0xbb>
nop
mov    %edi,%eax
xor    %edx,%edx
div    %ebx
test   %rdx,%rdx
je     11eb <main+0xbb>
add    $0x1,%rbx
xorps  %xmm0,%xmm0
cvtsi2ss %rbx,%xmm0
movss  %xmm0,0xc(%rsp)
call   1050 <sqrt@plt>
ucomiss 0xc(%rsp),%xmm0
jae    11a0 <main+0x70>
jmp    11ee <main+0xbe>
mov    %r15,%r14
mov    %r14,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [4 x i8] c"sim\00"
@.str.2 = [4 x i8] c"nao\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = call i64 @llvm.abs.i64(i64 %4, i1 true)
store i64 %5, i64* %1
%6 = icmp eq i64 %4, 0
%7 = icmp eq i64 %5, 1
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = load i64, i64* %1
br label %12
12: ; preds = %0, %9
%13 = phi i64 [ %5, %0 ], [ %11, %9 ]
%14 = call float @sqrt(i64 %13)
%15 = fcmp ult float %14, 2.000000e+00
br i1 %15, label %26, label %20
16: ; preds = %20
%17 = sitofp i64 %25 to float
%18 = call float @sqrt(i64 %22)
%19 = fcmp ult float %18, %17
br i1 %19, label %26, label %20
20: ; preds = %12, %16
%21 = phi i64 [ %25, %16 ], [ 2, %12 ]
%22 = load i64, i64* %1
%23 = srem i64 %22, %21
%24 = icmp eq i64 %23, 0
%25 = add nuw nsw i64 %21, 1
br i1 %24, label %26, label %16
26: ; preds = %16, %20, %12
%27 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %20 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %16 ]
%28 = call i32 @printf(i8* dereferenceable(1) %27)
ret i32 0
}