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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1176 <main+0x46>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1240 <main+0x110>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    -0x1010(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
mov    %eax,-0x1014(%rbp)
cmpl   $0x0,-0x1014(%rbp)
jne    11cb <main+0x9b>
jmp    121b <main+0xeb>
movl   $0x0,-0x1018(%rbp)
mov    -0x1018(%rbp),%eax
cmp    -0x1014(%rbp),%eax
jge    1216 <main+0xe6>
movslq -0x1018(%rbp),%rax
lea    0xe2c(%rip),%rdi
movzbl -0x1010(%rbp,%rax,1),%esi
ff
call   1040 <printf@plt>
mov    -0x1018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1018(%rbp)
jmp    11d5 <main+0xa5>
jmp    1194 <main+0x64>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf3(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    %edi,%eax
mov    0x2e8e(%rip),%rcx
mov    (%rcx),%edi
cmp    $0x2,%eax
jl     1169 <main+0x39>
lea    0xea8(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%eax
jmp    1214 <main+0xe4>
mov    %rsi,%r15
mov    (%rsi),%rdx
lea    0xe9e(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2e64(%rip),%r13
mov    0x0(%r13),%ecx
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     11f8 <main+0xc8>
lea    0xe7c(%rip),%rbp
mov    %rsp,%rbx
jmp    11ca <main+0x9a>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1000,%edx
call   1030 <fread@plt>
test   %eax,%eax
je     11f8 <main+0xc8>
test   %eax,%eax
jle    11b0 <main+0x80>
mov    %eax,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsp,%r14,1),%esi
mov    %rbp,%rdi
call   1040 <printf@plt>
add    $0x1,%r14
cmp    %r14,%r12
jne    11e0 <main+0xb0>
jmp    11b0 <main+0x80>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0xe1a(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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 \00"
@.str.3 = [10 x i8] c"%s: done\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%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))
store i32 1, i32* %3
br label %48
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 = %41, %14
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%22 = load i32, i32* @stdin
%23 = call i32 @fread(i8* %21, i32 1, i32 4096, i32 %22)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
br label %42
27: ; preds = %20
store i32 0, i32* %8
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %8
%30 = load i32, i32* %7
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %28
41: ; preds = %28
br label %20
42: ; preds = %26
%43 = load i32, i32* @stderr
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %46)
store i32 0, i32* %3
br label %48
48: ; preds = %42, %11
%49 = load i32, i32* %3
ret i32 %49
}

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 \00"
@.str.3 = [10 x i8] c"%s: done\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%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))
br label %35
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 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fread(i8* %11, i32 1, i32 4096, i32 %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %31, label %15
15: ; preds = %8, %27
%16 = phi i32 [ %29, %27 ], [ %13, %8 ]
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = zext i32 %16 to i64
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ 0, %18 ], [ %25, %20 ]
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8 zeroext %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %19
br i1 %26, label %27, label %20
27: ; preds = %20, %15
%28 = load i32, i32* @stdin
%29 = call i32 @fread(i8* %11, i32 1, i32 4096, i32 %28)
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %15
31: ; preds = %27, %8
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %1
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %31, %6
%36 = phi i32 [ 1, %6 ], [ 0, %31 ]
ret i32 %36
}