#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int fread(int **, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  if (argc > 1) {
    fprintf(stderr, "< entrada > salida\n");
    return 1;
  }
  fprintf(stderr, "%s: running\n", argv[0]);
  for (;;) {
    int x[4096];
    int r = fread(&x, sizeof(int), 4096, stdin);
    {
      int i;
      for (i = 0; i < r; i++) {
        printf("%d\n", x[i]);
      }
    }
  }
  fprintf(stderr, "%s: done\n", argv[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1178 <main+0x48>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x4020,%rsp
pop    %rbp
ret
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe85(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    -0x4010(%rbp),%rdi
mov    0x2e44(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x4014(%rbp)
movl   $0x0,-0x4018(%rbp)
mov    -0x4018(%rbp),%eax
cmp    -0x4014(%rbp),%eax
jge    1205 <main+0xd5>
movslq -0x4018(%rbp),%rax
mov    -0x4010(%rbp,%rax,4),%esi
lea    0xe35(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4018(%rbp)
jmp    11c5 <main+0x95>
jmp    1196 <main+0x66>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4000,%rsp
mov    %edi,%eax
mov    0x2e8f(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x2,%eax
jl     1174 <main+0x44>
lea    0xea9(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x4000,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    (%rsi),%rdx
lea    0xe96(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2e5c(%rip),%r15
mov    %rsp,%r14
lea    0xe8b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%ecx
mov    %r14,%rdi
mov    $0x4,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
jle    11a0 <main+0x70>
mov    %eax,%r13d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%rsp,%rbx,4),%esi
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11c0 <main+0x90>
jmp    11a0 <main+0x70>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"< entrada > salida\0A\00"
@.str.1 = [13 x i8] c"%s: running\0A\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 1
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %37, %14
%21 = bitcast [4096 x i32]* %6 to i32**
%22 = load i32, i32* @stdin
%23 = call i32 @fread(i32** %21, i32 4, i32 4096, i32 %22)
store i32 %23, i32* %7
store i32 0, i32* %8
br label %24
24: ; preds = %34, %20
%25 = load i32, i32* %8
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4096 x i32], [4096 x i32]* %6, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %28
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %24
37: ; preds = %24
br label %20
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"< entrada > salida\0A\00"
@.str.1 = [13 x i8] c"%s: running\0A\00"
@stdin = global i32 0
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i32]
%4 = icmp sgt i32 %0, 1
%5 = load i32, i32* @stderr
br i1 %4, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 1
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = bitcast [4096 x i32]* %3 to i8*
%12 = bitcast [4096 x i32]* %3 to i32**
br label %13
13: ; preds = %26, %8
%14 = load i32, i32* @stdin
%15 = call i32 @fread(i32** %12, i32 4, i32 4096, i32 %14)
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = zext i32 %15 to i64
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %24, %19 ]
%21 = getelementptr inbounds [4096 x i32], [4096 x i32]* %3, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, %18
br i1 %25, label %26, label %19
26: ; preds = %19, %13
br label %13
}