#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int sqrt(int);
int main(int argc, char **argv) {
  int n;
  int cont;
  int aux = 0;
  scanf("%d", &n);
  if (n < 0)
    n *= -1;
  if ((n == 0) || (n == 1))
    aux++;
  if (n <= 2147483647) {
    for (cont = 2; cont <= sqrt(n); cont++) {
      if ((n % cont) == 0)
        aux++;
    }
  }
  if (aux > 0)
    printf("nao");
  else
    printf("sim");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
jge    116e <main+0x3e>
imul   $0xffffffff,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1182 <main+0x52>
cmpl   $0x1,-0x14(%rbp)
jne    118b <main+0x5b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x7fffffff,-0x14(%rbp)
jg     11eb <main+0xbb>
movl   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jg     11e6 <main+0xb6>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    $0x0,%edx
jne    11d3 <main+0xa3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    119f <main+0x6f>
jmp    11eb <main+0xbb>
cmpl   $0x0,-0x1c(%rbp)
jle    1206 <main+0xd6>
lea    0xe07(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xe2>
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
jns    1152 <main+0x22>
neg    %edi
mov    %edi,0x4(%rsp)
xor    %ebx,%ebx
cmp    $0x2,%edi
setb   %bl
call   1050 <sqrt@plt>
cmp    $0x2,%eax
jl     118b <main+0x5b>
mov    $0x1,%ebp
nopl   0x0(%rax)
add    $0x1,%ebp
mov    0x4(%rsp),%edi
mov    %edi,%eax
cltd
idiv   %ebp
cmp    $0x1,%edx
adc    $0x0,%ebx
call   1050 <sqrt@plt>
cmp    %eax,%ebp
jl     1170 <main+0x40>
test   %ebx,%ebx
lea    0xe73(%rip),%rax
lea    0xe68(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"nao\00"
@.str.2 = [4 x i8] c"sim\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %6
%14 = mul nsw i32 %13, -1
store i32 %14, i32* %6
br label %15
15: ; preds = %12, %2
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %18, %15
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %24
24: ; preds = %21, %18
%25 = load i32, i32* %6
%26 = icmp sle i32 %25, 2147483647
br i1 %26, label %27, label %46
27: ; preds = %24
store i32 2, i32* %7
br label %28
28: ; preds = %42, %27
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = call i32 @sqrt(i32 %30)
%32 = icmp sle i32 %29, %31
br i1 %32, label %33, label %45
33: ; preds = %28
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = srem i32 %34, %35
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %41
41: ; preds = %38, %33
br label %42
42: ; preds = %41
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %28
45: ; preds = %28
br label %46
46: ; preds = %45, %24
%47 = load i32, i32* %8
%48 = icmp sgt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %53
51: ; preds = %46
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
ret i32 0
}

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