#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
void tail_plus(FILE *file, unsigned long int line) {
  char s[1026 + 1];
  for (unsigned int i = 0; fgets(s, 1026, file) != NULL; i++) {
    if (i >= line - 1)
      printf("%s", s);
  }
}


x86 assembly (clang, -O0):
<tail_plus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x424(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x402,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     119f <tail_plus+0x7f>
mov    -0x424(%rbp),%eax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jb     1186 <tail_plus+0x66>
lea    -0x420(%rbp),%rsi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    118b <tail_plus+0x6b>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    113d <tail_plus+0x1d>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail_plus>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x410,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0x402,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     118c <tail_plus+0x6c>
add    $0xffffffffffffffff,%rbx
xor    %ebp,%ebp
mov    %rsp,%r15
lea    0xea6(%rip),%r12
jmp    1178 <tail_plus+0x58>
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %r15,%rdi
mov    $0x402,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     118c <tail_plus+0x6c>
mov    %ebp,%eax
cmp    %rax,%rbx
ja     1160 <tail_plus+0x40>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
jmp    1160 <tail_plus+0x40>
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @tail_plus(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca [1027 x i8]
%6 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
store i32 0, i32* %6
br label %7
7: ; preds = %22, %2
%8 = getelementptr inbounds [1027 x i8], [1027 x i8]* %5, i64 0, i64 0
%9 = load i32*, i32** %3
%10 = call i32* @fgets(i8* %8, i32 1026, i32* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %25
12: ; preds = %7
%13 = load i32, i32* %6
%14 = zext i32 %13 to i64
%15 = load i64, i64* %4
%16 = sub i64 %15, 1
%17 = icmp uge i64 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %12
%19 = getelementptr inbounds [1027 x i8], [1027 x i8]* %5, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %6
%24 = add i32 %23, 1
store i32 %24, i32* %6
br label %7
25: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @tail_plus(i32* nocapture %0, i64 %1) {
%3 = alloca [1027 x i8]
%4 = getelementptr inbounds [1027 x i8], [1027 x i8]* %3, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 1026, i32* %0)
%6 = icmp eq i32* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = add i64 %1, -1
br label %10
9: ; preds = %16, %2
ret void
10: ; preds = %7, %16
%11 = phi i32 [ 0, %7 ], [ %17, %16 ]
%12 = zext i32 %11 to i64
%13 = icmp ugt i64 %8, %12
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %16
16: ; preds = %10, %14
%17 = add i32 %11, 1
%18 = call i32* @fgets(i8* %4, i32 1026, i32* %0)
%19 = icmp eq i32* %18, null
br i1 %19, label %9, label %10
}