#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 tail_skipstart(FILE *fp, int numlines) {
  char *buf = 0;
  size_t size = 0;
  while (numlines > 0 && -1 != getline(&buf, &size, fp)) {
    numlines--;
  }
  while (-1 != getline(&buf, &size, fp)) {
    printf("%s", buf);
    tail_quit(buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<tail_skipstart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x21(%rbp)
jle    117e <tail_skipstart+0x4e>
mov    -0x8(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    118e <tail_skipstart+0x5e>
jmp    119c <tail_skipstart+0x6c>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <tail_skipstart+0x1f>
jmp    11a1 <tail_skipstart+0x71>
mov    -0x8(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11df <tail_skipstart+0xaf>
mov    -0x18(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <tail_quit@plt>
jmp    11a1 <tail_skipstart+0x71>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail_skipstart>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
test   %esi,%esi
jle    117d <tail_skipstart+0x4d>
mov    %esi,%ebx
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <getline@plt>
cmp    $0xffffffff,%eax
je     117d <tail_skipstart+0x4d>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jg     1160 <tail_skipstart+0x30>
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r14,%rdx
call   1050 <getline@plt>
cmp    $0xffffffff,%eax
je     11da <tail_skipstart+0xaa>
lea    0xe65(%rip),%r15
lea    0x8(%rsp),%r12
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%rsi
mov    %r15,%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rdi
call   1040 <tail_quit@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <getline@plt>
cmp    $0xffffffff,%eax
jne    11b0 <tail_skipstart+0x80>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @tail_skipstart(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i8* null, i8** %5
store i64 0, i64* %6
br label %7
7: ; preds = %16, %2
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = call i32 @getline(i8** %5, i64* %6, i32* %11)
%13 = icmp ne i32 -1, %12
br label %14
14: ; preds = %10, %7
%15 = phi i1 [ false, %7 ], [ %13, %10 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i32, i32* %4
%18 = add nsw i32 %17, -1
store i32 %18, i32* %4
br label %7
19: ; preds = %14
br label %20
20: ; preds = %24, %19
%21 = load i32*, i32** %3
%22 = call i32 @getline(i8** %5, i64* %6, i32* %21)
%23 = icmp ne i32 -1, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %5
%28 = call i32 @tail_quit(i8* %27)
br label %20
29: ; preds = %20
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @tail_skipstart(i32* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %15
8: ; preds = %2, %8
%9 = phi i32 [ %12, %8 ], [ %1, %2 ]
%10 = call i32 @getline(i8** %3, i64* %4, i32* %0)
%11 = icmp ne i32 %10, -1
%12 = add nsw i32 %9, -1
%13 = icmp sgt i32 %9, 1
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %8, label %15
15: ; preds = %8, %2
%16 = call i32 @getline(i8** %3, i64* %4, i32* %0)
%17 = icmp eq i32 %16, -1
br i1 %17, label %25, label %18
18: ; preds = %15, %18
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @tail_quit(i8* %21)
%23 = call i32 @getline(i8** %3, i64* %4, i32* %0)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %18
25: ; preds = %18, %15
ret i32 0
}