#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 getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ tail_quit(char *);
int /*<<< orphan*/ usleep(int);
int tail_follow(FILE *fp) {
  char *buf = 0;
  size_t size = 0;
  int v;
  while (1) {
    v = getline(&buf, &size, fp);
    if (v != -1) {
      printf("%s", buf);
      tail_quit(buf);
    } else
      usleep(500000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<tail_follow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     1198 <tail_follow+0x58>
mov    -0x10(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <tail_quit@plt>
jmp    11a2 <tail_follow+0x62>
mov    $0x7a120,%edi
call   1060 <usleep@plt>
jmp    115c <tail_follow+0x1c>

x86 assembly (clang, -O2):
<tail_follow>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xe8f(%rip),%r12
jmp    1197 <tail_follow+0x57>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8(%rsp),%rsi
mov    %r12,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
call   1040 <tail_quit@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <getline@plt>
cmp    $0xffffffff,%eax
jne    1180 <tail_follow+0x40>
mov    $0x7a120,%edi
call   1060 <usleep@plt>
jmp    1197 <tail_follow+0x57>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @tail_follow(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %2
store i8* null, i8** %3
store i64 0, i64* %4
br label %6
6: ; preds = %1, %18
%7 = load i32*, i32** %2
%8 = call i32 @getline(i8** %3, i64* %4, i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i8*, i8** %3
%15 = call i32 @tail_quit(i8* %14)
br label %18
16: ; preds = %6
%17 = call i32 @usleep(i32 500000)
br label %18
18: ; preds = %16, %11
br label %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @tail_follow(i32* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
br label %6
6: ; preds = %16, %1
%7 = call i32 @getline(i8** %2, i64* %3, i32* %0)
%8 = icmp eq i32 %7, -1
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %2
%13 = call i32 @tail_quit(i8* %12)
br label %16
14: ; preds = %6
%15 = call i32 @usleep(i32 500000)
br label %16
16: ; preds = %14, %9
br label %6
}