main() {
  int N2;
  int N1;
  int K;
  int Num;
  int vett[999];
  int I;
  do {
    printf("Inserisci il valore di N2");
    scanf("%d", &N2);
  } while (N2 > 1000 || N2 % 2 == 0);
  do {
    printf("Inserisci il valore di N1");
    scanf("%d", &N1);
  } while (N1 < 0 || N1 > N2);
  do {
    printf("Inserisci il valore di K"), scanf("%d", &K);
  } while (K < N1 || K > N2);
  printf("Inserire lo scalare");
  scanf("%d", &Num);
  for (I = 0; I < K; I++) {
    printf("Inserire il vettore ");
    scanf("%d", &vett[I]);
  }
  for (I = 0; I < K; I++) {
    vett[I] = vett[I] * Num;
    printf("%d", vett[I]);
  }
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x3e8,-0x8(%rbp)
mov    %al,-0xfb5(%rbp)
jg     118e <main+0x5e>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0xfb5(%rbp)
mov    -0xfb5(%rbp),%al
test   $0x1,%al
jne    1142 <main+0x12>
jmp    11a1 <main+0x71>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xfb6(%rbp)
jl     11e2 <main+0xb2>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0xfb6(%rbp)
mov    -0xfb6(%rbp),%al
test   $0x1,%al
jne    11a1 <main+0x71>
jmp    11f5 <main+0xc5>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe10(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    -0xc(%rbp),%ecx
mov    %al,-0xfb7(%rbp)
jl     1238 <main+0x108>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0xfb7(%rbp)
mov    -0xfb7(%rbp),%al
test   $0x1,%al
jne    11f5 <main+0xc5>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdbf(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12c4 <main+0x194>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0xfb4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    1270 <main+0x140>
movl   $0x0,-0xfb4(%rbp)
mov    -0xfb4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    132d <main+0x1fd>
movslq -0xfb4(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%ecx
imul   -0x14(%rbp),%ecx
movslq -0xfb4(%rbp),%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
movslq -0xfb4(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xfb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfb4(%rbp)
jmp    12ce <main+0x19e>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0xfc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfb8,%rsp
lea    0xebb(%rip),%r14
lea    0xece(%rip),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    %ecx,%eax
and    $0x1,%eax
cmp    $0x3e8,%ecx
jg     1160 <main+0x30>
test   %eax,%eax
je     1160 <main+0x30>
lea    0xe8a(%rip),%r14
lea    0xe80(%rip),%r15
lea    0x8(%rsp),%rbx
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
js     11a0 <main+0x70>
cmp    0x4(%rsp),%eax
jg     11a0 <main+0x70>
lea    0xe6b(%rip),%r14
lea    0xe47(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    0x8(%rsp),%eax
jl     11e0 <main+0xb0>
cmp    0x4(%rsp),%eax
jg     11e0 <main+0xb0>
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdff(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    12b4 <main+0x184>
lea    0x10(%rsp),%r12
lea    0xe27(%rip),%r14
lea    0xdd6(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     1250 <main+0x120>
test   %eax,%eax
jle    12b4 <main+0x184>
lea    0xd97(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xc(%rsp),%esi
imul   0x10(%rsp,%rbx,4),%esi
mov    %esi,0x10(%rsp,%rbx,4)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
cmp    %rax,%rbx
jl     1290 <main+0x160>
lea    0xdbe(%rip),%rdi
xor    %eax,%eax
call   1030 <system@plt>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Inserisci il valore di N2\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"Inserisci il valore di N1\00"
@.str.3 = [25 x i8] c"Inserisci il valore di K\00"
@.str.4 = [20 x i8] c"Inserire lo scalare\00"
@.str.5 = [21 x i8] c"Inserire il vettore \00"
@.str.6 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [999 x i32]
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %18, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 1000
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = srem i32 %15, 2
%17 = icmp eq i32 %16, 0
br label %18
18: ; preds = %14, %11
%19 = phi i1 [ true, %11 ], [ %17, %14 ]
br i1 %19, label %8, label %20
20: ; preds = %18
br label %21
21: ; preds = %31, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %24
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = icmp sgt i32 %28, %29
br label %31
31: ; preds = %27, %24
%32 = phi i1 [ true, %24 ], [ %30, %27 ]
br i1 %32, label %21, label %33
33: ; preds = %31
br label %34
34: ; preds = %45, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %37
37: ; preds = %34
%38 = load i32, i32* %4
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i32, i32* %4
%43 = load i32, i32* %2
%44 = icmp sgt i32 %42, %43
br label %45
45: ; preds = %41, %37
%46 = phi i1 [ true, %37 ], [ %44, %41 ]
br i1 %46, label %34, label %47
47: ; preds = %45
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
store i32 0, i32* %7
br label %50
50: ; preds = %60, %47
%51 = load i32, i32* %7
%52 = load i32, i32* %4
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %63
54: ; preds = %50
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %57
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %50
63: ; preds = %50
store i32 0, i32* %7
br label %64
64: ; preds = %83, %63
%65 = load i32, i32* %7
%66 = load i32, i32* %4
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %86
68: ; preds = %64
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = load i32, i32* %5
%74 = mul nsw i32 %72, %73
%75 = load i32, i32* %7
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %76
store i32 %74, i32* %77
%78 = load i32, i32* %7
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [999 x i32], [999 x i32]* %6, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %81)
br label %83
83: ; preds = %68
%84 = load i32, i32* %7
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
br label %64
86: ; preds = %64
%87 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%88 = load i32, i32* %1
ret i32 %88
}

LLVM IR (-O2):
@.str = [26 x i8] c"Inserisci il valore di N2\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"Inserisci il valore di N1\00"
@.str.3 = [25 x i8] c"Inserisci il valore di K\00"
@.str.4 = [20 x i8] c"Inserire lo scalare\00"
@.str.5 = [21 x i8] c"Inserire il vettore \00"
@.str.6 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [999 x i32]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast [999 x i32]* %5 to i8*
br label %11
11: ; preds = %11, %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 1000
%16 = and i32 %14, 1
%17 = icmp eq i32 %16, 0
%18 = or i1 %15, %17
br i1 %18, label %11, label %19
19: ; preds = %11, %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 0
%24 = load i32, i32* %1
%25 = icmp sgt i32 %22, %24
%26 = select i1 %23, i1 true, i1 %25
br i1 %26, label %19, label %27
27: ; preds = %19, %27
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%30 = load i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp slt i32 %30, %31
%33 = load i32, i32* %1
%34 = icmp sgt i32 %30, %33
%35 = select i1 %32, i1 true, i1 %34
br i1 %35, label %27, label %36
36: ; preds = %27
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%39 = load i32, i32* %3
%40 = icmp sgt i32 %39, 0
br i1 %40, label %43, label %63
41: ; preds = %43
%42 = icmp sgt i32 %49, 0
br i1 %42, label %52, label %63
43: ; preds = %36, %43
%44 = phi i64 [ %48, %43 ], [ 0, %36 ]
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%46 = getelementptr inbounds [999 x i32], [999 x i32]* %5, i64 0, i64 %44
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = add nuw nsw i64 %44, 1
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = icmp slt i64 %48, %50
br i1 %51, label %43, label %41
52: ; preds = %41, %52
%53 = phi i64 [ %59, %52 ], [ 0, %41 ]
%54 = getelementptr inbounds [999 x i32], [999 x i32]* %5, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = load i32, i32* %4
%57 = mul nsw i32 %56, %55
store i32 %57, i32* %54
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %57)
%59 = add nuw nsw i64 %53, 1
%60 = load i32, i32* %3
%61 = sext i32 %60 to i64
%62 = icmp slt i64 %59, %61
br i1 %62, label %52, label %63
63: ; preds = %52, %36, %41
%64 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}