#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 *);
main() {
  int vettore[1000];
  int K;
  int n1;
  int n2;
  int NUM;
  int x;
  do {
    printf("\n inseire n2 minore di 1000  ");
    scanf("%d", &n2);
    printf("\n inserire n1 minore di n2  ");
    scanf("%d", &n1);
  } while ((n2 > 1000) || (n1 > n2));
  do {
    printf("\n inserire il vettore dell'array  ");
    scanf("%d", &K);
  } while ((K < n1) || (K > n2));
  x = 0;
  while (x < K) {
    printf("\n inserire un numero  ");
    scanf("%d", &vettore[x]);
    x++;
  }
  printf("\n inserire un numero intero  ");
  scanf("%d", &NUM);
  x = 0;
  while (x < K) {
    vettore[x] = vettore[x] * NUM;
    printf("%d  ", vettore[x]);
    x++;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0xfbc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0xfb8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x3e8,-0xfbc(%rbp)
mov    %al,-0xfc5(%rbp)
jg     11a1 <main+0x81>
mov    -0xfb8(%rbp),%eax
cmp    -0xfbc(%rbp),%eax
setg   %al
mov    %al,-0xfc5(%rbp)
mov    -0xfc5(%rbp),%al
test   $0x1,%al
jne    1132 <main+0x12>
jmp    11b4 <main+0x94>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
lea    -0xfb4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xfb4(%rbp),%ecx
mov    $0x1,%al
cmp    -0xfb8(%rbp),%ecx
mov    %al,-0xfc6(%rbp)
jl     1204 <main+0xe4>
mov    -0xfb4(%rbp),%eax
cmp    -0xfbc(%rbp),%eax
setg   %al
mov    %al,-0xfc6(%rbp)
mov    -0xfc6(%rbp),%al
test   $0x1,%al
jne    11b4 <main+0x94>
movl   $0x0,-0xfc4(%rbp)
mov    -0xfc4(%rbp),%eax
cmp    -0xfb4(%rbp),%eax
jge    1271 <main+0x151>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xfc4(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdc6(%rip),%rdi
call   1040 <scanf@plt>
mov    -0xfc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc4(%rbp)
jmp    121c <main+0xfc>
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd98(%rip),%rdi
lea    -0xfc0(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xfc4(%rbp)
mov    -0xfc4(%rbp),%eax
cmp    -0xfb4(%rbp),%eax
jge    1301 <main+0x1e1>
movslq -0xfc4(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%ecx
imul   -0xfc0(%rbp),%ecx
movslq -0xfc4(%rbp),%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
movslq -0xfc4(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%esi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xfc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xfc4(%rbp)
jmp    129c <main+0x17c>
mov    -0x4(%rbp),%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfb0,%rsp
lea    0xec9(%rip),%r14
lea    0xee0(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xed7(%rip),%r12
lea    0x8(%rsp),%r13
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3e8,%eax
jg     1150 <main+0x30>
cmp    %eax,0x8(%rsp)
jg     1150 <main+0x30>
lea    0xeac(%rip),%r14
lea    0xe85(%rip),%r15
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
cmp    0x8(%rsp),%eax
jl     11a0 <main+0x80>
cmp    0x4(%rsp),%eax
jg     11a0 <main+0x80>
test   %eax,%eax
jle    1206 <main+0xe6>
lea    0x10(%rsp),%r12
lea    0xe8d(%rip),%r14
lea    0xe43(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
add    $0x4,%r12
cmp    %rax,%rbx
jl     11e0 <main+0xc0>
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe03(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1264 <main+0x144>
lea    0xe64(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0xc(%rsp),%esi
imul   0x10(%rsp,%rbx,4),%esi
mov    %esi,0x10(%rsp,%rbx,4)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
cmp    %rax,%rbx
jl     1240 <main+0x120>
xor    %eax,%eax
add    $0xfb0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0A inseire n2 minore di 1000 \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"\0A inserire n1 minore di n2 \00"
@.str.3 = [35 x i8] c"\0A inserire il vettore dell'array \00"
@.str.4 = [23 x i8] c"\0A inserire un numero \00"
@.str.5 = [30 x i8] c"\0A inserire un numero intero \00"
@.str.6 = [5 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %20, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
br label %13
13: ; preds = %8
%14 = load i32, i32* %5
%15 = icmp sgt i32 %14, 1000
br i1 %15, label %20, label %16
16: ; preds = %13
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = icmp sgt i32 %17, %18
br label %20
20: ; preds = %16, %13
%21 = phi i1 [ true, %13 ], [ %19, %16 ]
br i1 %21, label %8, label %22
22: ; preds = %20
br label %23
23: ; preds = %34, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i32, i32* %3
%32 = load i32, i32* %5
%33 = icmp sgt i32 %31, %32
br label %34
34: ; preds = %30, %26
%35 = phi i1 [ true, %26 ], [ %33, %30 ]
br i1 %35, label %23, label %36
36: ; preds = %34
store i32 0, i32* %7
br label %37
37: ; preds = %41, %36
%38 = load i32, i32* %7
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %49
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %44
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %45)
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %37
49: ; preds = %37
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%51 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
store i32 0, i32* %7
br label %52
52: ; preds = %56, %49
%53 = load i32, i32* %7
%54 = load i32, i32* %3
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %73
56: ; preds = %52
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = load i32, i32* %6
%62 = mul nsw i32 %60, %61
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %64
store i32 %62, i32* %65
%66 = load i32, i32* %7
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %7
%72 = add nsw i32 %71, 1
store i32 %72, i32* %7
br label %52
73: ; preds = %52
%74 = load i32, i32* %1
ret i32 %74
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0A inseire n2 minore di 1000 \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"\0A inserire n1 minore di n2 \00"
@.str.3 = [35 x i8] c"\0A inserire il vettore dell'array \00"
@.str.4 = [23 x i8] c"\0A inserire un numero \00"
@.str.5 = [30 x i8] c"\0A inserire un numero intero \00"
@.str.6 = [5 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [1000 x i32]* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
br label %11
11: ; preds = %11, %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 1000
%18 = load i32, i32* %3
%19 = icmp sgt i32 %18, %16
%20 = select i1 %17, i1 true, i1 %19
br i1 %20, label %11, label %21
21: ; preds = %11, %21
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = icmp slt i32 %24, %25
%27 = load i32, i32* %4
%28 = icmp sgt i32 %24, %27
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %21, label %30
30: ; preds = %21
%31 = icmp sgt i32 %24, 0
br i1 %31, label %32, label %41
32: ; preds = %30, %32
%33 = phi i64 [ %37, %32 ], [ 0, %30 ]
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%35 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %33
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %35)
%37 = add nuw nsw i64 %33, 1
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %32, label %41
41: ; preds = %32, %30
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%44 = load i32, i32* %2
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %57
46: ; preds = %41, %46
%47 = phi i64 [ %53, %46 ], [ 0, %41 ]
%48 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %5
%51 = mul nsw i32 %50, %49
store i32 %51, i32* %48
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %51)
%53 = add nuw nsw i64 %47, 1
%54 = load i32, i32* %2
%55 = sext i32 %54 to i64
%56 = icmp slt i64 %53, %55
br i1 %56, label %46, label %57
57: ; preds = %46, %41
ret i32 0
}