#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int main() {
  FILE *in = fopen("task.in", "r");
  FILE *out = fopen("task.out", "w");
  int array[10];
  int last = 10 - 1;
  for (int i = 0; i < 10; i++) {
    fscanf(in, "%d", &array[i]);
  }
  fclose(in);
  for (int i = 0; i < last; i++) {
    fprintf(out, "%d ", array[i]);
  }
  fprintf(out, "%d\n", array[last]);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9d(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x9,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    11c2 <main+0x82>
mov    -0x10(%rbp),%rdi
movslq -0x48(%rbp),%rax
lea    -0x40(%rbp),%rdx
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe66(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    118b <main+0x4b>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1204 <main+0xc4>
mov    -0x18(%rbp),%rdi
movslq -0x4c(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe27(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11d2 <main+0x92>
mov    -0x18(%rbp),%rdi
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe05(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xeb0(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea4(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xe99(%rip),%r15
mov    %rsp,%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x14(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x1c(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x20(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
lea    0x24(%rsp),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <fscanf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    (%rsp),%edx
lea    0xdec(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x4(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x10(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x14(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x18(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x1c(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x20(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
mov    0x24(%rsp),%edx
lea    0xd62(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%d \00"
@.str.6 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [10 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
%9 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %9, i32** %3
store i32 9, i32* %5
store i32 0, i32* %6
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32*, i32** %2
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %16
%18 = call i32 @fscanf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %10
22: ; preds = %10
%23 = load i32*, i32** %2
%24 = call i32 @fclose(i32* %23)
store i32 0, i32* %7
br label %25
25: ; preds = %36, %22
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %39
29: ; preds = %25
%30 = load i32*, i32** %3
%31 = load i32, i32* %7
%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 @fprintf(i32* %30, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %29
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %25
39: ; preds = %25
%40 = load i32*, i32** %3
%41 = load i32, i32* %5
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = load i32*, i32** %3
%47 = call i32 @fclose(i32* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [4 x i8] c"%d \00"
@.str.6 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%6 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%8 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%10 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %9)
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%12 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%14 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %13)
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%16 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %15)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%18 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %17)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%20 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%22 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %21)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%24 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %23)
%25 = call i32 @fclose(i32* %2)
%26 = load i32, i32* %5
%27 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %9
%31 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %11
%33 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %13
%35 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %15
%37 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %17
%39 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %19
%41 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %21
%43 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %23
%45 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = call i32 @fclose(i32* %3)
ret i32 0
}