#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 /*<<< orphan*/ system(char *);
int main() {
  int v[10] = {5, 9, 16, 10, 4, 3, 7, 11, 1, 0};
  int i;
  int pos;
  int tot = 10;
  printf("Inserisci la posizione: ");
  scanf("%d", &pos);
  for (i = pos; i < tot - 1; i++) {
    v[i] = v[i + 1];
  }
  tot--;
  printf("il valore del vettore shiftato e': ");
  for (i = 0; i < tot; i++) {
    printf("%d", v[i]);
  }
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1050 <memcpy@plt>
movl   $0xa,-0x3c(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11c2 <main+0x82>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118f <main+0x4f>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1210 <main+0xd0>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e0 <main+0xa0>
lea    0xe51(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0xedb(%rip),%rax
mov    %rax,0x40(%rsp)
movaps 0xebf(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0x1c(%rsp),%rsi
call   1050 <scanf@plt>
movslq 0x1c(%rsp),%rax
cmp    $0x8,%rax
jg     128e <main+0x15e>
mov    $0x9,%ecx
sub    %rax,%rcx
cmp    $0x8,%rcx
jb     1240 <main+0x110>
mov    %rcx,%rdx
and    $0xfffffffffffffff8,%rdx
lea    -0x8(%rdx),%rsi
mov    %rsi,%rbp
shr    $0x3,%rbp
add    $0x1,%rbp
test   %rsi,%rsi
je     1373 <main+0x243>
mov    %rbp,%rsi
and    $0xfffffffffffffffe,%rsi
lea    (%rsp,%rax,4),%rbx
add    $0x54,%rbx
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movups -0x30(%rbx,%rdi,4),%xmm0
movups -0x20(%rbx,%rdi,4),%xmm1
movups -0x10(%rbx,%rdi,4),%xmm2
movups (%rbx,%rdi,4),%xmm3
movups %xmm0,-0x34(%rbx,%rdi,4)
movups %xmm1,-0x24(%rbx,%rdi,4)
movups %xmm2,-0x14(%rbx,%rdi,4)
movups %xmm3,-0x4(%rbx,%rdi,4)
add    $0x10,%rdi
add    $0xfffffffffffffffe,%rsi
jne    11e0 <main+0xb0>
test   $0x1,%bpl
je     122e <main+0xfe>
add    %rax,%rdi
movups 0x24(%rsp,%rdi,4),%xmm0
movups 0x34(%rsp,%rdi,4),%xmm1
movups %xmm0,0x20(%rsp,%rdi,4)
movups %xmm1,0x30(%rsp,%rdi,4)
cmp    %rdx,%rcx
je     1255 <main+0x125>
add    %rdx,%rax
cs nopw 0x0(%rax,%rax,1)
mov    0x24(%rsp,%rax,4),%ecx
mov    %ecx,0x20(%rsp,%rax,4)
lea    0x1(%rax),%rcx
mov    %rcx,%rax
cmp    $0x9,%rcx
jne    1240 <main+0x110>
mov    0x20(%rsp),%r12d
mov    0x24(%rsp),%r15d
mov    0x28(%rsp),%r14d
mov    0x2c(%rsp),%ebp
mov    0x30(%rsp),%ebx
mov    0x34(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x38(%rsp),%eax
mov    %eax,0x10(%rsp)
mov    0x3c(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x40(%rsp),%eax
mov    %eax,0x18(%rsp)
jmp    12ca <main+0x19a>
mov    $0x5,%r12d
mov    $0x9,%r15d
mov    $0x10,%r14d
mov    $0xa,%ebp
mov    $0x4,%ebx
movl   $0x3,0xc(%rsp)
movl   $0x7,0x10(%rsp)
movl   $0xb,0x14(%rsp)
movl   $0x1,0x18(%rsp)
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd62(%rip),%r13
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rdi
mov    0x18(%rsp),%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd0b(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
test   $0x1,%bpl
jne    1217 <main+0xe7>
jmp    122e <main+0xfe>

LLVM IR (-O0):
@__const.main.v = [10 x i32] [i32 5, i32 9, i32 16, i32 10, i32 4, i32 3, i32 7, i32 11, i32 1, i32 0]
@.str = [25 x i8] c"Inserisci la posizione: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"il valore del vettore shiftato e': \00"
@.str.3 = [6 x i8] c"PAUSE\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 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %10
10: ; preds = %24, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %27
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %22
store i32 %20, i32* %23
br label %24
24: ; preds = %15
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %10
27: ; preds = %10
%28 = load i32, i32* %5
%29 = add nsw i32 %28, -1
store i32 %29, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %31
31: ; preds = %41, %27
%32 = load i32, i32* %3
%33 = load i32, i32* %5
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %44
35: ; preds = %31
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %35
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %31
44: ; preds = %31
%45 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@__const.main.v = [10 x i32] [i32 5, i32 9, i32 16, i32 10, i32 4, i32 3, i32 7, i32 11, i32 1, i32 0]
@.str = [25 x i8] c"Inserisci la posizione: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [36 x i8] c"il valore del vettore shiftato e': \00"
@.str.3 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %100
9: ; preds = %0
%10 = sext i32 %7 to i64
%11 = sub nsw i64 9, %10
%12 = icmp ult i64 %11, 8
br i1 %12, label %72, label %13
13: ; preds = %9
%14 = and i64 %11, -8
%15 = add nsw i64 %14, %10
%16 = add nsw i64 %14, -8
%17 = lshr exact i64 %16, 3
%18 = add nuw nsw i64 %17, 1
%19 = and i64 %18, 1
%20 = icmp eq i64 %16, 0
br i1 %20, label %54, label %21
21: ; preds = %13
%22 = and i64 %18, 4611686018427387902
br label %23
23: ; preds = %23, %21
%24 = phi i64 [ 0, %21 ], [ %51, %23 ]
%25 = phi i64 [ 0, %21 ], [ %52, %23 ]
%26 = add i64 %24, %10
%27 = add nsw i64 %26, 1
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %27
%29 = bitcast i32* %28 to <4 x i32>*
%30 = load <4 x i32>, <4 x i32>* %29
%31 = getelementptr inbounds i32, i32* %28, i64 4
%32 = bitcast i32* %31 to <4 x i32>*
%33 = load <4 x i32>, <4 x i32>* %32
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %26
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %30, <4 x i32>* %35
%36 = getelementptr inbounds i32, i32* %34, i64 4
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> %33, <4 x i32>* %37
%38 = or i64 %24, 8
%39 = add i64 %38, %10
%40 = add nsw i64 %39, 1
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %40
%42 = bitcast i32* %41 to <4 x i32>*
%43 = load <4 x i32>, <4 x i32>* %42
%44 = getelementptr inbounds i32, i32* %41, i64 4
%45 = bitcast i32* %44 to <4 x i32>*
%46 = load <4 x i32>, <4 x i32>* %45
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %39
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %43, <4 x i32>* %48
%49 = getelementptr inbounds i32, i32* %47, i64 4
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %50
%51 = add nuw i64 %24, 16
%52 = add i64 %25, 2
%53 = icmp eq i64 %52, %22
br i1 %53, label %54, label %23
54: ; preds = %23, %13
%55 = phi i64 [ 0, %13 ], [ %51, %23 ]
%56 = icmp eq i64 %19, 0
br i1 %56, label %70, label %57
57: ; preds = %54
%58 = add i64 %55, %10
%59 = add nsw i64 %58, 1
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %59
%61 = bitcast i32* %60 to <4 x i32>*
%62 = load <4 x i32>, <4 x i32>* %61
%63 = getelementptr inbounds i32, i32* %60, i64 4
%64 = bitcast i32* %63 to <4 x i32>*
%65 = load <4 x i32>, <4 x i32>* %64
%66 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %58
%67 = bitcast i32* %66 to <4 x i32>*
store <4 x i32> %62, <4 x i32>* %67
%68 = getelementptr inbounds i32, i32* %66, i64 4
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> %65, <4 x i32>* %69
br label %70
70: ; preds = %54, %57
%71 = icmp eq i64 %11, %14
br i1 %71, label %81, label %72
72: ; preds = %9, %70
%73 = phi i64 [ %10, %9 ], [ %15, %70 ]
br label %74
74: ; preds = %72, %74
%75 = phi i64 [ %76, %74 ], [ %73, %72 ]
%76 = add nsw i64 %75, 1
%77 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %76
%78 = load i32, i32* %77
%79 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %75
store i32 %78, i32* %79
%80 = icmp eq i64 %76, 9
br i1 %80, label %81, label %74
81: ; preds = %74, %70
%82 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%83 = load i32, i32* %82
%84 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%85 = load i32, i32* %84
%86 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%87 = load i32, i32* %86
%88 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%89 = load i32, i32* %88
%90 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%91 = load i32, i32* %90
%92 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%93 = load i32, i32* %92
%94 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%95 = load i32, i32* %94
%96 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%97 = load i32, i32* %96
%98 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%99 = load i32, i32* %98
br label %100
100: ; preds = %81, %0
%101 = phi i32 [ %99, %81 ], [ 1, %0 ]
%102 = phi i32 [ %97, %81 ], [ 11, %0 ]
%103 = phi i32 [ %95, %81 ], [ 7, %0 ]
%104 = phi i32 [ %93, %81 ], [ 3, %0 ]
%105 = phi i32 [ %91, %81 ], [ 4, %0 ]
%106 = phi i32 [ %89, %81 ], [ 10, %0 ]
%107 = phi i32 [ %87, %81 ], [ 16, %0 ]
%108 = phi i32 [ %85, %81 ], [ 9, %0 ]
%109 = phi i32 [ %83, %81 ], [ 5, %0 ]
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %109)
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %108)
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %107)
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %106)
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %105)
%116 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %104)
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %103)
%118 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %102)
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %101)
%120 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}