#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 */
char EOF;
char getchar();
int /*<<< orphan*/ putchar(char);
int main(int argc, char const *argv[]) {
  char c, buff[80];
  int len = 0;
  int mode = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      len = 0;
      mode = 0;
      continue;
    }
    if (mode == 0) {
      if (len == 80) {
        int i;
        for (i = 0; i < len; ++i) {
          putchar(buff[i]);
        }
        putchar(c);
        mode = 1;
      }
    } else {
      putchar(c);
    }
    buff[len++] = c;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e8d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1200 <main+0xe0>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    1186 <main+0x66>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
jmp    1147 <main+0x27>
cmpl   $0x0,-0x78(%rbp)
jne    11de <main+0xbe>
cmpl   $0x50,-0x74(%rbp)
jne    11d9 <main+0xb9>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    11c9 <main+0xa9>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11a1 <main+0x81>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x1,-0x78(%rbp)
jmp    11e7 <main+0xc7>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x11(%rbp),%cl
mov    -0x74(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x74(%rbp)
cltq
mov    %cl,-0x70(%rbp,%rax,1)
jmp    1147 <main+0x27>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eac(%rip),%r14
cmp    (%r14),%al
jne    1152 <main+0x32>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r13d
xor    %eax,%eax
xor    %ebp,%ebp
jmp    1191 <main+0x71>
nopl   0x0(%rax,%rax,1)
movsbl %r13b,%edi
call   1030 <putchar@plt>
mov    $0x1,%r15d
movslq %ebp,%rax
add    $0x1,%ebp
mov    %r13b,(%rsp,%rax,1)
mov    %ebp,%r12d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%r13d
mov    %r15d,%eax
mov    %r12d,%ebp
cmp    (%r14),%r13b
je     1141 <main+0x21>
xor    %r12d,%r12d
mov    $0x0,%r15d
cmp    $0xa,%r13b
je     117c <main+0x5c>
test   %eax,%eax
jne    1160 <main+0x40>
xor    %r15d,%r15d
cmp    $0x50,%ebp
jne    116f <main+0x4f>
xor    %ebx,%ebx
xchg   %ax,%ax
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x50,%rbx
jne    11b0 <main+0x90>
jmp    1160 <main+0x40>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %49, %21, %2
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %6
%13 = sext i8 %12 to i32
%14 = load i8, i8* @EOF
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %13, %15
br i1 %16, label %17, label %55
17: ; preds = %11
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 10
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %8
store i32 0, i32* %9
br label %11
22: ; preds = %17
%23 = load i32, i32* %9
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %46
25: ; preds = %22
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 80
br i1 %27, label %28, label %45
28: ; preds = %25
store i32 0, i32* %10
br label %29
29: ; preds = %39, %28
%30 = load i32, i32* %10
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @putchar(i8 signext %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %29
42: ; preds = %29
%43 = load i8, i8* %6
%44 = call i32 @putchar(i8 signext %43)
store i32 1, i32* %9
br label %45
45: ; preds = %42, %25
br label %49
46: ; preds = %22
%47 = load i8, i8* %6
%48 = call i32 @putchar(i8 signext %47)
br label %49
49: ; preds = %46, %45
%50 = load i8, i8* %6
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
store i32 %52, i32* %8
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 %53
store i8 %50, i8* %54
br label %11
55: ; preds = %11
ret i32 0
}

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