#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[10];
  for (int i = 0; i < 10; i++) {
    scanf("%d", &X[i]);
    if (X[i] <= 0)
      X[i] = 1;
  }
  for (int i = 0; i < 10; i++)
    printf("X[%d] = %d\n", i, X[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    1189 <main+0x69>
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)
jmp    117b <main+0x5b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11bf <main+0x9f>
mov    -0x38(%rbp),%esi
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1190 <main+0x70>
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    0xd98(%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 = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"X[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %10
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = icmp sle i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %8
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %20
store i32 1, i32* %21
br label %22
22: ; preds = %18, %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
store i32 0, i32* %4
br label %27
27: ; preds = %37, %26
%28 = load i32, i32* %4
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %40
30: ; preds = %27
%31 = load i32, i32* %4
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %35)
br label %37
37: ; preds = %30
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %27
40: ; preds = %27
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"X[%d] = %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 = %0, %7
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 2
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 3
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 4
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 5
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 6
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 7
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 8
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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 [10 x i32], [10 x i32]* %1, i64 0, i64 9
%58 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 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
}