#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 append(char *, char *, int);
int getline_(char *, int);
int /*<<< orphan*/ putchar(char);
int main(int argc, char const *argv[]) {
  int len, last;
  char lines[1000], longer[1000];
  last = 0;
  while ((len = getline_(longer, 1000)) > 0)
    if (len > 79)
      last = append(lines, longer, last);
  for (int i = 0; last > i; ++i)
    putchar(lines[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x7f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getline_@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jle    1195 <main+0x65>
cmpl   $0x4f,-0x14(%rbp)
jle    1190 <main+0x60>
lea    -0x400(%rbp),%rdi
lea    -0x7f0(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1040 <append@plt>
mov    %eax,-0x18(%rbp)
jmp    1150 <main+0x20>
movl   $0x0,-0x7f4(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x7f4(%rbp),%eax
jle    11d6 <main+0xa6>
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    119f <main+0x6f>
xor    %eax,%eax
add    $0x800,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getline_@plt>
test   %eax,%eax
jle    11a6 <main+0x76>
xor    %ebx,%ebx
lea    0x3f0(%rsp),%r14
mov    %rsp,%r15
jmp    1171 <main+0x41>
nopl   0x0(%rax)
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1050 <getline_@plt>
test   %eax,%eax
jle    1187 <main+0x57>
cmp    $0x50,%eax
jb     1160 <main+0x30>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <append@plt>
mov    %eax,%ebx
jmp    1160 <main+0x30>
test   %ebx,%ebx
jle    11a6 <main+0x76>
mov    %ebx,%r14d
xor    %ebx,%ebx
movsbl 0x3f0(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1000 x i8]
%9 = alloca [1000 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %11
11: ; preds = %23, %2
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%13 = call i32 @getline_(i8* %12, i32 1000)
store i32 %13, i32* %6
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 79
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%21 = load i32, i32* %7
%22 = call i32 @append(i8* %19, i8* %20, i32 %21)
store i32 %22, i32* %7
br label %23
23: ; preds = %18, %15
br label %11
24: ; preds = %11
store i32 0, i32* %10
br label %25
25: ; preds = %35, %24
%26 = load i32, i32* %7
%27 = load i32, i32* %10
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i32, i32* %10
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = call i32 @putchar(i8 signext %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %10
%37 = add nsw i32 %36, 1
store i32 %37, i32* %10
br label %25
38: ; preds = %25
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%7 = call i32 @getline_(i8* %6, i32 1000)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %13, label %23
9: ; preds = %19
%10 = icmp sgt i32 %20, 0
br i1 %10, label %11, label %23
11: ; preds = %9
%12 = zext i32 %20 to i64
br label %24
13: ; preds = %2, %19
%14 = phi i32 [ %21, %19 ], [ %7, %2 ]
%15 = phi i32 [ %20, %19 ], [ 0, %2 ]
%16 = icmp ugt i32 %14, 79
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @append(i8* %5, i8* %6, i32 %15)
br label %19
19: ; preds = %17, %13
%20 = phi i32 [ %18, %17 ], [ %15, %13 ]
%21 = call i32 @getline_(i8* %6, i32 1000)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %13, label %9
23: ; preds = %24, %2, %9
ret i32 0
24: ; preds = %11, %24
%25 = phi i64 [ 0, %11 ], [ %29, %24 ]
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @putchar(i8 signext %27)
%29 = add nuw nsw i64 %25, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %23, label %24
}