#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 *);
main() {
  int i, x, X[10];
  for (i = 0; i < 10; i++) {
    scanf("%d", &x);
    if (x > 0)
      X[i] = x;
    else
      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,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1189 <main+0x69>
lea    0xeb9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    116a <main+0x4a>
mov    -0xc(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
jmp    1176 <main+0x56>
movslq -0x8(%rbp),%rax
movl   $0x1,-0x40(%rbp,%rax,4)
jmp    117b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11bf <main+0x9f>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <main+0x70>
xor    %eax,%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    $0x28,%rsp
lea    0xecb(%rip),%rbp
lea    0xc(%rsp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
mov    $0x1,%r15d
cmovle %r15d,%eax
mov    %eax,0x24(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovle %r15d,%eax
mov    %eax,0x20(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovle %r15d,%eax
mov    %eax,0x1c(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovle %r15d,%eax
mov    %eax,0x18(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovle %r15d,%eax
mov    %eax,0x14(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
cmovle %r15d,%eax
mov    %eax,0x10(%rsp)
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r12d
test   %r12d,%r12d
cmovle %r15d,%r12d
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r13d
test   %r13d,%r13d
cmovle %r15d,%r13d
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r14d
test   %r14d,%r14d
cmovle %r15d,%r14d
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
test   %ebx,%ebx
cmovle %r15d,%ebx
lea    0xdcc(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    0x24(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    0x20(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    0x1c(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x3,%esi
mov    0x18(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x4,%esi
mov    0x14(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x5,%esi
mov    0x10(%rsp),%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x6,%esi
mov    %r12d,%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x7,%esi
mov    %r13d,%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x8,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x9,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 i32
%3 = alloca i32
%4 = alloca [10 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %22, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %15
store i32 %13, i32* %16
br label %21
17: ; preds = %8
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %19
store i32 1, i32* %20
br label %21
21: ; preds = %17, %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %5
25: ; preds = %5
store i32 0, i32* %2
br label %26
26: ; preds = %36, %25
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 10
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %2
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %30, i32 %34)
br label %36
36: ; preds = %29
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %26
39: ; preds = %26
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 i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 1
%6 = select i1 %5, i32 %4, i32 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 1
%10 = select i1 %9, i32 %8, i32 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 1
%14 = select i1 %13, i32 %12, i32 1
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 1
%18 = select i1 %17, i32 %16, i32 1
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 1
%22 = select i1 %21, i32 %20, i32 1
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp sgt i32 %24, 1
%26 = select i1 %25, i32 %24, i32 1
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, 1
%30 = select i1 %29, i32 %28, i32 1
%31 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%32 = load i32, i32* %1
%33 = icmp sgt i32 %32, 1
%34 = select i1 %33, i32 %32, i32 1
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%36 = load i32, i32* %1
%37 = icmp sgt i32 %36, 1
%38 = select i1 %37, i32 %36, i32 1
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%40 = load i32, i32* %1
%41 = icmp sgt i32 %40, 1
%42 = select i1 %41, i32 %40, i32 1
%43 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %6)
%44 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %10)
%45 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %14)
%46 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %18)
%47 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %22)
%48 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %26)
%49 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %30)
%50 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %34)
%51 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %38)
%52 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9, i32 %42)
ret i32 0
}