#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int read(int /*<<< orphan*/, char **, int);
int /*<<< orphan*/ write(int /*<<< orphan*/, char **, int);
int main(void) {
  char *Buffer[255];
  int CurrentSize = 0;
  while ((CurrentSize = read(STDIN_FILENO, Buffer, 255)) > 0)
    write(STDOUT_FILENO, Buffer, CurrentSize);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x804(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    -0x800(%rbp),%rsi
mov    $0xff,%edx
call   1040 <read@plt>
mov    %eax,-0x804(%rbp)
cmp    $0x0,%eax
jle    1195 <main+0x65>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    -0x800(%rbp),%rsi
mov    -0x804(%rbp),%edx
call   1030 <write@plt>
jmp    114c <main+0x1c>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x800,%rsp
mov    0x2e8d(%rip),%r14
mov    (%r14),%edi
mov    %rsp,%rsi
mov    $0xff,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    1191 <main+0x61>
mov    0x2e92(%rip),%r15
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0xff,%edx
call   1040 <read@plt>
test   %eax,%eax
jg     1170 <main+0x40>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8*]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* @STDIN_FILENO
%6 = getelementptr inbounds [255 x i8*], [255 x i8*]* %2, i64 0, i64 0
%7 = call i32 @read(i32 %5, i8** %6, i32 255)
store i32 %7, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i32, i32* @STDOUT_FILENO
%11 = getelementptr inbounds [255 x i8*], [255 x i8*]* %2, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @write(i32 %10, i8** %11, i32 %12)
br label %4
14: ; preds = %4
%15 = load i32, i32* @EXIT_SUCCESS
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [255 x i8*]
%2 = bitcast [255 x i8*]* %1 to i8*
%3 = getelementptr inbounds [255 x i8*], [255 x i8*]* %1, i64 0, i64 0
%4 = load i32, i32* @STDIN_FILENO
%5 = call i32 @read(i32 %4, i8** %3, i32 255)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = phi i32 [ %12, %7 ], [ %5, %0 ]
%9 = load i32, i32* @STDOUT_FILENO
%10 = call i32 @write(i32 %9, i8** %3, i32 %8)
%11 = load i32, i32* @STDIN_FILENO
%12 = call i32 @read(i32 %11, i8** %3, i32 255)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %0
%15 = load i32, i32* @EXIT_SUCCESS
%16 = tail call i32 @exit(i32 %15)
unreachable
}