#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "");
  int x[5];
  int *y;
  int i;
  for (i = 0; i < 5; i++) {
    printf("x[%d]: ", i);
    y = &x[i];
    scanf("%d", y);
    *y *= 2;
  }
  printf("##########\n");
  for (i = 0; i < 5; i++) {
    printf("x[%d]: %d\n", i, x[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1040 <setlocale@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    11b2 <main+0x82>
mov    -0x2c(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x2c(%rbp),%rcx
lea    -0x20(%rbp),%rax
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe74(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115b <main+0x2b>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x5,-0x2c(%rbp)
jge    11f8 <main+0xc8>
mov    -0x2c(%rbp),%esi
movslq -0x2c(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c7 <main+0x97>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1050 <setlocale@plt>
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe92(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
shll   (%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
shll   0x4(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
shll   0x8(%rsp)
mov    %r14,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
shll   0xc(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
shll   0x10(%rsp)
lea    0xe0b(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%edx
lea    0xdf1(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"x[%d]: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"##########\0A\00"
@.str.4 = [11 x i8] c"x[%d]: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @LC_ALL
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %7
7: ; preds = %21, %0
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %14
store i32* %15, i32** %3
%16 = load i32*, i32** %3
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = mul nsw i32 %19, 2
store i32 %20, i32* %18
br label %21
21: ; preds = %10
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %7
24: ; preds = %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %26
26: ; preds = %36, %24
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 5
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %4
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %30, i32 %34)
br label %36
36: ; preds = %29
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %26
39: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@.str.1 = [8 x i8] c"x[%d]: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [11 x i8] c"x[%d]: %d\0A\00"
@str = [11 x i8] c"##########\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = load i32, i32* @LC_ALL
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [5 x i32]* %1 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 0)
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = shl nsw i32 %8, 1
store i32 %9, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %11
%14 = shl nsw i32 %13, 1
store i32 %14, i32* %11
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2)
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = shl nsw i32 %18, 1
store i32 %19, i32* %16
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 3)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %21
%24 = shl nsw i32 %23, 1
store i32 %24, i32* %21
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 4)
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %26)
%28 = load i32, i32* %26
%29 = shl nsw i32 %28, 1
store i32 %29, i32* %26
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 %31)
%33 = load i32, i32* %11
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 %33)
%35 = load i32, i32* %16
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 %35)
%37 = load i32, i32* %21
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 3, i32 %37)
%39 = load i32, i32* %26
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 4, i32 %39)
ret i32 0
}