#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(void) {
  int x[10], i;
  for (i = 0; i < 10; i++) {
    scanf("%d", &x[i]);
    if (x[i] < 1) {
      x[i] = 1;
    }
    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    119b <main+0x7b>
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   $0x1,-0x30(%rbp,%rax,4)
jge    1176 <main+0x56>
movslq -0x34(%rbp),%rax
movl   $0x1,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%esi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%edx
test   %edx,%edx
jg     1146 <main+0x26>
movl   $0x1,(%rsp)
mov    $0x1,%edx
lea    0xeb6(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
lea    0xea0(%rip),%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
test   %edx,%edx
jg     117a <main+0x5a>
movl   $0x1,0x4(%rsp)
mov    $0x1,%edx
lea    0xe82(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
lea    0xe69(%rip),%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%edx
test   %edx,%edx
jg     11b1 <main+0x91>
movl   $0x1,0x8(%rsp)
mov    $0x1,%edx
lea    0xe4b(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
lea    0xe32(%rip),%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jg     11e8 <main+0xc8>
movl   $0x1,0xc(%rsp)
mov    $0x1,%edx
lea    0xe14(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
lea    0xdfb(%rip),%rdi
call   1040 <scanf@plt>
mov    0x10(%rsp),%edx
test   %edx,%edx
jg     121f <main+0xff>
movl   $0x1,0x10(%rsp)
mov    $0x1,%edx
lea    0xddd(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
lea    0xdc4(%rip),%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%edx
test   %edx,%edx
jg     1256 <main+0x136>
movl   $0x1,0x14(%rsp)
mov    $0x1,%edx
lea    0xda6(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0xd8d(%rip),%rdi
call   1040 <scanf@plt>
mov    0x18(%rsp),%edx
test   %edx,%edx
jg     128d <main+0x16d>
movl   $0x1,0x18(%rsp)
mov    $0x1,%edx
lea    0xd6f(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
lea    0xd56(%rip),%rdi
call   1040 <scanf@plt>
mov    0x1c(%rsp),%edx
test   %edx,%edx
jg     12c4 <main+0x1a4>
movl   $0x1,0x1c(%rsp)
mov    $0x1,%edx
lea    0xd38(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
lea    0xd1f(%rip),%rdi
call   1040 <scanf@plt>
mov    0x20(%rsp),%edx
test   %edx,%edx
jg     12fb <main+0x1db>
movl   $0x1,0x20(%rsp)
mov    $0x1,%edx
lea    0xd01(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
lea    0xce8(%rip),%rdi
call   1040 <scanf@plt>
mov    0x24(%rsp),%edx
test   %edx,%edx
jg     1332 <main+0x212>
movl   $0x1,0x24(%rsp)
mov    $0x1,%edx
lea    0xcca(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
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
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %28, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %31
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)
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %7
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [10 x i32], [10 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 = load i32, i32* %3
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %4
31: ; preds = %4
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 = %7, %0
%9 = phi i32 [ 1, %7 ], [ %5, %0 ]
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = load i32, i32* %11
%14 = icmp slt i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %8
store i32 1, i32* %11
br label %16
16: ; preds = %15, %8
%17 = phi i32 [ 1, %15 ], [ %13, %8 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = load i32, i32* %19
%22 = icmp slt i32 %21, 1
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 1, i32* %19
br label %24
24: ; preds = %23, %16
%25 = phi i32 [ 1, %23 ], [ %21, %16 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 %25)
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%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 = %24
store i32 1, i32* %27
br label %32
32: ; preds = %31, %24
%33 = phi i32 [ 1, %31 ], [ %29, %24 ]
%34 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 %33)
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%36 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %35)
%37 = load i32, i32* %35
%38 = icmp slt i32 %37, 1
br i1 %38, label %39, label %40
39: ; preds = %32
store i32 1, i32* %35
br label %40
40: ; preds = %39, %32
%41 = phi i32 [ 1, %39 ], [ %37, %32 ]
%42 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 4, i32 %41)
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %43)
%45 = load i32, i32* %43
%46 = icmp slt i32 %45, 1
br i1 %46, label %47, label %48
47: ; preds = %40
store i32 1, i32* %43
br label %48
48: ; preds = %47, %40
%49 = phi i32 [ 1, %47 ], [ %45, %40 ]
%50 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 %49)
%51 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%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 = %48
store i32 1, i32* %51
br label %56
56: ; preds = %55, %48
%57 = phi i32 [ 1, %55 ], [ %53, %48 ]
%58 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 6, i32 %57)
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %59)
%61 = load i32, i32* %59
%62 = icmp slt i32 %61, 1
br i1 %62, label %63, label %64
63: ; preds = %56
store i32 1, i32* %59
br label %64
64: ; preds = %63, %56
%65 = phi i32 [ 1, %63 ], [ %61, %56 ]
%66 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 7, i32 %65)
%67 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%68 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %67)
%69 = load i32, i32* %67
%70 = icmp slt i32 %69, 1
br i1 %70, label %71, label %72
71: ; preds = %64
store i32 1, i32* %67
br label %72
72: ; preds = %71, %64
%73 = phi i32 [ 1, %71 ], [ %69, %64 ]
%74 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 8, i32 %73)
%75 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%76 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %75)
%77 = load i32, i32* %75
%78 = icmp slt i32 %77, 1
br i1 %78, label %79, label %80
79: ; preds = %72
store i32 1, i32* %75
br label %80
80: ; preds = %79, %72
%81 = phi i32 [ 1, %79 ], [ %77, %72 ]
%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
}