#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  int n[10];
  srand(time(NULL));
  for (int i = 0; i < 10; i++) {
    n[i] = rand() % 250;
    printf("%d numero: %d\n", i, n[i]);
  }
  printf("\n");
  for (int i = 0; i < 10; i++) {
    int j = 2;
    for (; j < n[i]; j++)
      if (n[i] % j == 0)
        break;
    if (n[i] == j)
      printf("O numero %d e primo\n", n[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ae <main+0x6e>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0xfa,%ecx
cltd
idiv   %ecx
movslq -0x34(%rbp),%rax
mov    %edx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1166 <main+0x26>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    124c <main+0x10c>
movl   $0x2,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    1212 <main+0xd2>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cltd
idivl  -0x3c(%rbp)
cmp    $0x0,%edx
jne    11ff <main+0xbf>
jmp    1212 <main+0xd2>
jmp    1204 <main+0xc4>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11d4 <main+0x94>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x3c(%rbp),%eax
jne    1239 <main+0xf9>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123e <main+0xfe>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11c3 <main+0x83>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%r15
imul   $0x10624dd3,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%r15d
mov    %r15d,(%rsp)
lea    0xe64(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x4(%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x8(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0xc(%rsp)
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x10(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x14(%rsp)
mov    %r14,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x18(%rsp)
mov    %r14,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x1c(%rsp)
mov    %r14,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x20(%rsp)
mov    %r14,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rdx
imul   $0x10624dd3,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x4,%eax
add    %ecx,%eax
imul   $0xfa,%eax,%eax
sub    %eax,%edx
mov    %edx,0x24(%rsp)
mov    %r14,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc37(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2,%ecx
cmp    $0x3,%r15d
jl     1405 <main+0x2b5>
mov    $0x2,%ecx
mov    %r15d,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1405 <main+0x2b5>
add    $0x1,%ecx
cmp    %ecx,%r15d
jne    13f0 <main+0x2a0>
mov    %r15d,%ecx
cmp    %ecx,%r15d
jne    1417 <main+0x2c7>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0xa,%rbx
je     1427 <main+0x2d7>
mov    (%rsp,%rbx,4),%r15d
jmp    13e0 <main+0x290>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%d numero: %d\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [21 x i8] c"O numero %d e primo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @time(i32* null)
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 250
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %3
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %21)
br label %23
23: ; preds = %11
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %8
26: ; preds = %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %4
br label %28
28: ; preds = %66, %26
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 10
br i1 %30, label %31, label %69
31: ; preds = %28
store i32 2, i32* %5
br label %32
32: ; preds = %49, %31
%33 = load i32, i32* %5
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp slt i32 %33, %37
br i1 %38, label %39, label %52
39: ; preds = %32
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %5
%45 = srem i32 %43, %44
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %39
br label %52
48: ; preds = %39
br label %49
49: ; preds = %48
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %32
52: ; preds = %47, %32
%53 = load i32, i32* %4
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = load i32, i32* %5
%58 = icmp eq i32 %56, %57
br i1 %58, label %59, label %65
59: ; preds = %52
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %59, %52
br label %66
66: ; preds = %65
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %28
69: ; preds = %28
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str = [15 x i8] c"%d numero: %d\0A\00"
@.str.2 = [21 x i8] c"O numero %d e primo\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 250
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32 %6, i32* %7
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 0, i32 %6)
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 250
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 %10, i32* %11
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 1, i32 %10)
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 250
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32 %14, i32* %15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 2, i32 %14)
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 250
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
store i32 %18, i32* %19
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 3, i32 %18)
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 250
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 %22, i32* %23
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4, i32 %22)
%25 = tail call i32 (...) @rand()
%26 = srem i32 %25, 250
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 %26, i32* %27
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 5, i32 %26)
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 250
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
store i32 %30, i32* %31
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 6, i32 %30)
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 250
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
store i32 %34, i32* %35
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 7, i32 %34)
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 250
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 %38, i32* %39
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 8, i32 %38)
%41 = tail call i32 (...) @rand()
%42 = srem i32 %41, 250
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 %42, i32* %43
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 9, i32 %42)
%45 = tail call i32 @putchar(i32 10)
br label %46
46: ; preds = %66, %0
%47 = phi i32 [ %6, %0 ], [ %68, %66 ]
%48 = phi i64 [ 0, %0 ], [ %64, %66 ]
%49 = icmp sgt i32 %47, 2
br i1 %49, label %51, label %58
50: ; preds = %63
ret i32 0
51: ; preds = %46, %55
%52 = phi i32 [ %56, %55 ], [ 2, %46 ]
%53 = srem i32 %47, %52
%54 = icmp eq i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %51
%56 = add nuw nsw i32 %52, 1
%57 = icmp eq i32 %56, %47
br i1 %57, label %58, label %51
58: ; preds = %55, %51, %46
%59 = phi i32 [ 2, %46 ], [ %52, %51 ], [ %47, %55 ]
%60 = icmp eq i32 %47, %59
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %63
63: ; preds = %61, %58
%64 = add nuw nsw i64 %48, 1
%65 = icmp eq i64 %64, 10
br i1 %65, label %50, label %66
66: ; preds = %63
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %64
%68 = load i32, i32* %67
br label %46
}