#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 getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int len, total;
  char line[100];
  len = total = 0;
  while ((len = getline(line, 100)) > 0) {
    total = total + len;
    if (total > 80)
      printf("%s", line);
    if (len + 1 < 100 || line[len - 1] == '\n')
      total = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1040 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11ab <main+0x8b>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x50,-0xc(%rbp)
jle    117a <main+0x5a>
lea    -0x70(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    $0x64,%eax
jl     119f <main+0x7f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11a6 <main+0x86>
movl   $0x0,-0xc(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1040 <getline@plt>
test   %eax,%eax
jle    1187 <main+0x67>
mov    %eax,%ebx
xor    %ebp,%ebp
lea    0xeba(%rip),%r14
mov    %rsp,%r15
jmp    1165 <main+0x45>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %r15,%rdi
mov    $0x64,%esi
call   1040 <getline@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1187 <main+0x67>
add    %ebx,%ebp
cmp    $0x51,%ebp
jl     1177 <main+0x57>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
cmp    $0x63,%ebx
jb     1150 <main+0x30>
add    $0xffffffff,%ebx
cmpb   $0xa,(%rsp,%rbx,1)
je     1150 <main+0x30>
jmp    1152 <main+0x32>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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