#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  FILE *f = stdin;
  char buf[16 + 1];
  while (!feof(f)) {
    fgets(buf, 16, f);
    fputs(buf, stdout);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1182 <main+0x42>
jmp    11ab <main+0x6b>
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x10,%esi
call   1040 <fgets@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e39(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
jmp    1164 <main+0x24>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    0x2e98(%rip),%rax
mov    (%rax),%rbx
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
jne    1197 <main+0x57>
mov    %rsp,%r14
mov    0x2e6f(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x10,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
mov    (%r15),%esi
mov    %r14,%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1050 <feof@plt>
test   %eax,%eax
je     1170 <main+0x30>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdin = global i32* null
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [17 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32*, i32** @stdin
store i32* %8, i32** %6
br label %9
9: ; preds = %14, %2
%10 = load i32*, i32** %6
%11 = call i32 @feof(i32* %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%16 = load i32*, i32** %6
%17 = call i32 @fgets(i8* %15, i32 16, i32* %16)
%18 = getelementptr inbounds [17 x i8], [17 x i8]* %7, i64 0, i64 0
%19 = load i32, i32* @stdout
%20 = call i32 @fputs(i8* %18, i32 %19)
br label %9
21: ; preds = %9
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdin = global i32* null
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [17 x i8]
%4 = load i32*, i32** @stdin
%5 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%6 = call i32 @feof(i32* %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2, %8
%9 = call i32 @fgets(i8* %5, i32 16, i32* %4)
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* %5, i32 %10)
%12 = call i32 @feof(i32* %4)
%13 = icmp eq i32 %12, 0
br i1 %13, label %8, label %14
14: ; preds = %8, %2
%15 = call i32 @exit(i32 0)
unreachable
}