#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 main() {
  int n1;
  int n2;
  int num;
  int k;
  int i;
  int v[1000];
  do {
    printf("inserire un valore positivo dispari e minore di 1000 \n");
    scanf("%d", &n2);
  } while (n2 % 2 == 0 || n2 > 1000 || n2 < 0);
  do {
    printf("inserire un valore positivo minore di quello precedente \n");
    scanf("%d", &n1);
  } while (n1 < 0 || n1 > n2);
  do {
    printf("inserire un valore compreso tra i primi due \n");
    scanf("%d", &k);
  } while (k < n1 || k > n2);
  printf("inserire il valore da moltiplicare agli elementi \n");
  scanf("%d", &num);
  for (i = 0; i < k; i++) {
    printf("inserire un valore \n");
    scanf("%d", &v[i]);
    v[i] = v[i] * num;
  }
  for (i = 0; i < k; i++) {
    printf("| %d", v[i]);
  }
}


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    0xfa2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0xfc1(%rbp)
je     118e <main+0x6e>
mov    $0x1,%al
cmpl   $0x3e8,-0xc(%rbp)
mov    %al,-0xfc1(%rbp)
jg     118e <main+0x6e>
cmpl   $0x0,-0xc(%rbp)
setl   %al
mov    %al,-0xfc1(%rbp)
mov    -0xfc1(%rbp),%al
test   $0x1,%al
jne    1132 <main+0x12>
jmp    11a1 <main+0x81>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf33(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xfc2(%rbp)
jl     11e0 <main+0xc0>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
mov    %al,-0xfc2(%rbp)
mov    -0xfc2(%rbp),%al
test   $0x1,%al
jne    11a1 <main+0x81>
jmp    11f3 <main+0xd3>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%ecx
mov    $0x1,%al
cmp    -0x8(%rbp),%ecx
mov    %al,-0xfc3(%rbp)
jl     1234 <main+0x114>
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
mov    %al,-0xfc3(%rbp)
mov    -0xfc3(%rbp),%al
test   $0x1,%al
jne    11f3 <main+0xd3>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12c7 <main+0x1a7>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x18(%rbp),%rax
lea    -0xfc0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe4f(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x18(%rbp),%rax
mov    -0xfc0(%rbp,%rax,4),%ecx
imul   -0x10(%rbp),%ecx
movslq -0x18(%rbp),%rax
mov    %ecx,-0xfc0(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1267 <main+0x147>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1301 <main+0x1e1>
movslq -0x18(%rbp),%rax
mov    -0xfc0(%rbp,%rax,4),%esi
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12ce <main+0x1ae>
mov    -0x4(%rbp),%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfb8,%rsp
lea    0xec0(%rip),%r14
lea    0xeb6(%rip),%r15
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    %ecx,%eax
and    $0x80000001,%eax
cmp    $0x3e8,%ecx
jg     1160 <main+0x30>
cmp    $0x1,%eax
jne    1160 <main+0x30>
lea    0xea9(%rip),%r14
lea    0xe69(%rip),%r15
lea    0x8(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
js     11a0 <main+0x70>
cmp    0x4(%rsp),%eax
jg     11a0 <main+0x70>
lea    0xeac(%rip),%r14
lea    0xe33(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    0x8(%rsp),%eax
jl     11e0 <main+0xb0>
cmp    0x4(%rsp),%eax
jg     11e0 <main+0xb0>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
lea    0xded(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    129b <main+0x16b>
lea    0x10(%rsp),%rbx
xor    %r12d,%r12d
lea    0xe9f(%rip),%r14
lea    0xdc7(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
imul   (%rbx),%eax
mov    %eax,(%rbx)
add    $0x1,%r12
movslq (%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     1240 <main+0x110>
test   %eax,%eax
jle    129b <main+0x16b>
lea    0xd88(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq (%rsp),%rax
cmp    %rax,%rbx
jl     1280 <main+0x150>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [55 x i8] c"inserire un valore positivo dispari e minore di 1000 \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"inserire un valore positivo minore di quello precedente \0A\00"
@.str.3 = [46 x i8] c"inserire un valore compreso tra i primi due \0A\00"
@.str.4 = [51 x i8] c"inserire il valore da moltiplicare agli elementi \0A\00"
@.str.5 = [21 x i8] c"inserire un valore \0A\00"
@.str.6 = [5 x i8] c"| %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [1000 x i32]
store i32 0, i32* %1
br label %8
8: ; preds = %21, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 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* %3)
br label %11
11: ; preds = %8
%12 = load i32, i32* %3
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 1000
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 0
br label %21
21: ; preds = %18, %15, %11
%22 = phi i1 [ true, %15 ], [ true, %11 ], [ %20, %18 ]
br i1 %22, label %8, label %23
23: ; preds = %21
br label %24
24: ; preds = %34, %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp slt i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = icmp sgt i32 %31, %32
br label %34
34: ; preds = %30, %27
%35 = phi i1 [ true, %27 ], [ %33, %30 ]
br i1 %35, label %24, label %36
36: ; preds = %34
br label %37
37: ; preds = %48, %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
br label %40
40: ; preds = %37
%41 = load i32, i32* %5
%42 = load i32, i32* %2
%43 = icmp slt i32 %41, %42
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = load i32, i32* %5
%46 = load i32, i32* %3
%47 = icmp sgt i32 %45, %46
br label %48
48: ; preds = %44, %40
%49 = phi i1 [ true, %40 ], [ %47, %44 ]
br i1 %49, label %37, label %50
50: ; preds = %48
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
store i32 0, i32* %6
br label %53
53: ; preds = %72, %50
%54 = load i32, i32* %6
%55 = load i32, i32* %5
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %75
57: ; preds = %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %60
%62 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %61)
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = load i32, i32* %4
%68 = mul nsw i32 %66, %67
%69 = load i32, i32* %6
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %70
store i32 %68, i32* %71
br label %72
72: ; preds = %57
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %53
75: ; preds = %53
store i32 0, i32* %6
br label %76
76: ; preds = %86, %75
%77 = load i32, i32* %6
%78 = load i32, i32* %5
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %89
80: ; preds = %76
%81 = load i32, i32* %6
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [1000 x i32], [1000 x i32]* %7, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %84)
br label %86
86: ; preds = %80
%87 = load i32, i32* %6
%88 = add nsw i32 %87, 1
store i32 %88, i32* %6
br label %76
89: ; preds = %76
%90 = load i32, i32* %1
ret i32 %90
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.6 = [5 x i8] c"| %d\00"
@str = [54 x i8] c"inserire un valore positivo dispari e minore di 1000 \00"
@str.7 = [57 x i8] c"inserire un valore positivo minore di quello precedente \00"
@str.8 = [45 x i8] c"inserire un valore compreso tra i primi due \00"
@str.9 = [50 x i8] c"inserire il valore da moltiplicare agli elementi \00"
@str.10 = [20 x i8] c"inserire un valore \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1000 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 [1000 x i32]* %5 to i8*
br label %11
11: ; preds = %11, %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 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* %2)
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 1000
%16 = and i32 %14, -2147483647
%17 = icmp ne i32 %16, 1
%18 = or i1 %15, %17
br i1 %18, label %11, label %19
19: ; preds = %11, %19
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.7, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%22 = load i32, i32* %1
%23 = icmp slt i32 %22, 0
%24 = load i32, i32* %2
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.8, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%30 = load i32, i32* %4
%31 = load i32, i32* %1
%32 = icmp slt i32 %30, %31
%33 = load i32, i32* %2
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.9, i64 0, i64 0))
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%39 = load i32, i32* %4
%40 = icmp sgt i32 %39, 0
br i1 %40, label %43, label %64
41: ; preds = %43
%42 = icmp sgt i32 %52, 0
br i1 %42, label %55, label %64
43: ; preds = %36, %43
%44 = phi i64 [ %51, %43 ], [ 0, %36 ]
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
%46 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %44
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = load i32, i32* %46
%49 = load i32, i32* %3
%50 = mul nsw i32 %49, %48
store i32 %50, i32* %46
%51 = add nuw nsw i64 %44, 1
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %51, %53
br i1 %54, label %43, label %41
55: ; preds = %41, %55
%56 = phi i64 [ %60, %55 ], [ 0, %41 ]
%57 = getelementptr inbounds [1000 x i32], [1000 x i32]* %5, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 %58)
%60 = add nuw nsw i64 %56, 1
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = icmp slt i64 %60, %62
br i1 %63, label %55, label %64
64: ; preds = %55, %36, %41
ret i32 0
}