#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 main() {
  int n, i;
  n = 1299709;
  for (i = 2; i * i < n; i++) {
    if (n % i == 0) {
      printf("%d No primo\n", i);
      return 0;
    }
  }
  printf("Primo\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x13d4fd,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117d <main+0x6d>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    116a <main+0x5a>
mov    -0xc(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1192 <main+0x82>
jmp    116f <main+0x5f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%ecx
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rcx),%esi
mov    $0x13d4fd,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     116a <main+0x4a>
cmp    $0x475,%ecx
je     115a <main+0x3a>
mov    $0x13d4fd,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     1168 <main+0x48>
add    $0x2,%ecx
jmp    1130 <main+0x10>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
jmp    1178 <main+0x58>
mov    %ecx,%esi
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d No primo\0A\00"
@.str.1 = [7 x i8] c"Primo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1299709, i32* %2
store i32 2, i32* %3
br label %4
4: ; preds = %19, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = mul nsw i32 %5, %6
%8 = load i32, i32* %2
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = srem i32 %11, %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 0, i32* %1
br label %24
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %24
24: ; preds = %22, %15
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d No primo\0A\00"
@str = [6 x i8] c"Primo\00"
define i32 @main() {
br label %1
1: ; preds = %14, %0
%2 = phi i32 [ 2, %0 ], [ %15, %14 ]
%3 = urem i32 1299709, %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %11, %1
%6 = phi i32 [ %2, %1 ], [ %9, %11 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %18
8: ; preds = %1
%9 = or i32 %2, 1
%10 = icmp eq i32 %9, 1141
br i1 %10, label %16, label %11
11: ; preds = %8
%12 = urem i32 1299709, %9
%13 = icmp eq i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %11
%15 = add nuw nsw i32 %2, 2
br label %1
16: ; preds = %8
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %18
18: ; preds = %16, %5
ret i32 0
}