#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], i;
  for (i = 0; i < 10; i++) {
    scanf("%d", &X[i]);
  }
  for (i = 0; i < 10; i++) {
    if (X[i] <= 0) {
      X[i] = 1;
    }
  }
  for (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    1169 <main+0x49>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11a8 <main+0x88>
movslq -0x34(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
jg     1195 <main+0x75>
movslq -0x34(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
jmp    119a <main+0x7a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1170 <main+0x50>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11de <main+0xbe>
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11af <main+0x8f>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%edx
test   %edx,%edx
jle    12cc <main+0x1ac>
cmpl   $0x0,0x4(%rsp)
jle    12e3 <main+0x1c3>
cmpl   $0x0,0x8(%rsp)
jle    12f6 <main+0x1d6>
cmpl   $0x0,0xc(%rsp)
jle    1309 <main+0x1e9>
cmpl   $0x0,0x10(%rsp)
jle    131c <main+0x1fc>
cmpl   $0x0,0x14(%rsp)
jle    132f <main+0x20f>
cmpl   $0x0,0x18(%rsp)
jle    1342 <main+0x222>
cmpl   $0x0,0x1c(%rsp)
jle    1355 <main+0x235>
cmpl   $0x0,0x20(%rsp)
jle    1368 <main+0x248>
cmpl   $0x0,0x24(%rsp)
jle    137b <main+0x25b>
lea    0xde2(%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
movl   $0x1,(%rsp)
mov    $0x1,%edx
cmpl   $0x0,0x4(%rsp)
jg     11c2 <main+0xa2>
movl   $0x1,0x4(%rsp)
cmpl   $0x0,0x8(%rsp)
jg     11cd <main+0xad>
movl   $0x1,0x8(%rsp)
cmpl   $0x0,0xc(%rsp)
jg     11d8 <main+0xb8>
movl   $0x1,0xc(%rsp)
cmpl   $0x0,0x10(%rsp)
jg     11e3 <main+0xc3>
movl   $0x1,0x10(%rsp)
cmpl   $0x0,0x14(%rsp)
jg     11ee <main+0xce>
movl   $0x1,0x14(%rsp)
cmpl   $0x0,0x18(%rsp)
jg     11f9 <main+0xd9>
movl   $0x1,0x18(%rsp)
cmpl   $0x0,0x1c(%rsp)
jg     1204 <main+0xe4>
movl   $0x1,0x1c(%rsp)
cmpl   $0x0,0x20(%rsp)
jg     120f <main+0xef>
movl   $0x1,0x20(%rsp)
cmpl   $0x0,0x24(%rsp)
jg     121a <main+0xfa>
movl   $0x1,0x24(%rsp)
jmp    121a <main+0xfa>

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
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %9
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
store i32 0, i32* %3
br label %16
16: ; preds = %30, %15
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp sle i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %19
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %27
store i32 1, i32* %28
br label %29
29: ; preds = %25, %19
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %16
33: ; preds = %16
store i32 0, i32* %3
br label %34
34: ; preds = %44, %33
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* %3
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %38, i32 %42)
br label %44
44: ; preds = %37
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %34
47: ; preds = %34
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 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %21)
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %0
store i32 1, i32* %3
br label %26
26: ; preds = %0, %25
%27 = phi i32 [ %23, %0 ], [ 1, %25 ]
%28 = load i32, i32* %5
%29 = icmp slt i32 %28, 1
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 1, i32* %5
br label %31
31: ; preds = %30, %26
%32 = load i32, i32* %7
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 1, i32* %7
br label %35
35: ; preds = %34, %31
%36 = load i32, i32* %9
%37 = icmp slt i32 %36, 1
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 1, i32* %9
br label %39
39: ; preds = %38, %35
%40 = load i32, i32* %11
%41 = icmp slt i32 %40, 1
br i1 %41, label %42, label %43
42: ; preds = %39
store i32 1, i32* %11
br label %43
43: ; preds = %42, %39
%44 = load i32, i32* %13
%45 = icmp slt i32 %44, 1
br i1 %45, label %46, label %47
46: ; preds = %43
store i32 1, i32* %13
br label %47
47: ; preds = %46, %43
%48 = load i32, i32* %15
%49 = icmp slt i32 %48, 1
br i1 %49, label %50, label %51
50: ; preds = %47
store i32 1, i32* %15
br label %51
51: ; preds = %50, %47
%52 = load i32, i32* %17
%53 = icmp slt i32 %52, 1
br i1 %53, label %54, label %55
54: ; preds = %51
store i32 1, i32* %17
br label %55
55: ; preds = %54, %51
%56 = load i32, i32* %19
%57 = icmp slt i32 %56, 1
br i1 %57, label %58, label %59
58: ; preds = %55
store i32 1, i32* %19
br label %59
59: ; preds = %58, %55
%60 = load i32, i32* %21
%61 = icmp slt i32 %60, 1
br i1 %61, label %62, label %63
62: ; preds = %59
store i32 1, i32* %21
br label %63
63: ; preds = %62, %59
%64 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %27)
%65 = load i32, i32* %5
%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* %7
%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* %9
%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* %11
%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* %13
%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* %15
%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* %17
%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* %19
%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* %21
%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
}