#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, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int X[11], i = 0;
  while (i < 10) {
    scanf(" %d", &X[i]);
    if (X[i] <= 0)
      X[i] = 1;
    i++;
  }
  i = 0;
  while (i < 10) {
    printf("X[%d] = %d\n", i, X[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1184 <main+0x64>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
jg     1176 <main+0x56>
movslq -0x34(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11ba <main+0x9a>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    118b <main+0x6b>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jg     1141 <main+0x21>
movl   $0x1,(%rsp)
lea    0x4(%rsp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jg     1161 <main+0x41>
movl   $0x1,0x4(%rsp)
lea    0x8(%rsp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jg     1181 <main+0x61>
movl   $0x1,0x8(%rsp)
lea    0xc(%rsp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jg     11a1 <main+0x81>
movl   $0x1,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xe53(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jg     11c1 <main+0xa1>
movl   $0x1,0x10(%rsp)
lea    0x14(%rsp),%rsi
lea    0xe33(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jg     11e1 <main+0xc1>
movl   $0x1,0x14(%rsp)
lea    0x18(%rsp),%rsi
lea    0xe13(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x18(%rsp)
jg     1201 <main+0xe1>
movl   $0x1,0x18(%rsp)
lea    0x1c(%rsp),%rsi
lea    0xdf3(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x1c(%rsp)
jg     1221 <main+0x101>
movl   $0x1,0x1c(%rsp)
lea    0x20(%rsp),%rsi
lea    0xdd3(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x20(%rsp)
jg     1241 <main+0x121>
movl   $0x1,0x20(%rsp)
lea    0x24(%rsp),%rsi
lea    0xdb3(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x0,0x24(%rsp)
jg     1261 <main+0x141>
movl   $0x1,0x24(%rsp)
mov    (%rsp),%edx
lea    0xd99(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    0x4(%rsp),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%edx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    0x14(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    0x18(%rsp),%edx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    0x1c(%rsp),%edx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    0x20(%rsp),%edx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    0x24(%rsp),%edx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [12 x i8] c"X[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %3
br label %8
8: ; preds = %7, %0
%9 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = load i32, i32* %9
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 1, i32* %9
br label %14
14: ; preds = %13, %8
%15 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 2
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = load i32, i32* %15
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %14
store i32 1, i32* %15
br label %20
20: ; preds = %19, %14
%21 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %21
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %20
store i32 1, i32* %21
br label %26
26: ; preds = %25, %20
%27 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 4
%28 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %27)
%29 = load i32, i32* %27
%30 = icmp slt i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 1, i32* %27
br label %32
32: ; preds = %31, %26
%33 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 5
%34 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %33)
%35 = load i32, i32* %33
%36 = icmp slt i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %32
store i32 1, i32* %33
br label %38
38: ; preds = %37, %32
%39 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 6
%40 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %39)
%41 = load i32, i32* %39
%42 = icmp slt i32 %41, 1
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 1, i32* %39
br label %44
44: ; preds = %43, %38
%45 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 7
%46 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %45)
%47 = load i32, i32* %45
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %50
49: ; preds = %44
store i32 1, i32* %45
br label %50
50: ; preds = %49, %44
%51 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 8
%52 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %51)
%53 = load i32, i32* %51
%54 = icmp slt i32 %53, 1
br i1 %54, label %55, label %56
55: ; preds = %50
store i32 1, i32* %51
br label %56
56: ; preds = %55, %50
%57 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 9
%58 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %57)
%59 = load i32, i32* %57
%60 = icmp slt i32 %59, 1
br i1 %60, label %61, label %62
61: ; preds = %56
store i32 1, i32* %57
br label %62
62: ; preds = %61, %56
%63 = load i32, i32* %3
%64 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %63)
%65 = load i32, i32* %9
%66 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %65)
%67 = load i32, i32* %15
%68 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %67)
%69 = load i32, i32* %21
%70 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %69)
%71 = load i32, i32* %27
%72 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %71)
%73 = load i32, i32* %33
%74 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %73)
%75 = load i32, i32* %39
%76 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %75)
%77 = load i32, i32* %45
%78 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %77)
%79 = load i32, i32* %51
%80 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %79)
%81 = load i32, i32* %57
%82 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %81)
ret i32 0
}