#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(int);
int main() {
  int c, n;
  char s[79 + 1];
  n = 0;
  while ((c = getchar()) != EOF) {
    if (n < 79) {
      s[n] = c;
    } else if (n == 79) {
      printf("%s", s);
    } else if (n > 79) {
      putchar(c);
    }
    if (c == '\n') {
      n = 0;
    } else {
      ++n;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
je     11da <main+0xaa>
cmpl   $0x4f,-0xc(%rbp)
jge    117b <main+0x4b>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x60(%rbp,%rax,1)
jmp    11b6 <main+0x86>
cmpl   $0x4f,-0xc(%rbp)
jne    119a <main+0x6a>
lea    -0x60(%rbp),%rsi
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
jmp    11b1 <main+0x81>
cmpl   $0x4f,-0xc(%rbp)
jle    11ac <main+0x7c>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11b1 <main+0x81>
jmp    11b6 <main+0x86>
cmpl   $0xa,-0x8(%rbp)
jne    11cc <main+0x9c>
movl   $0x0,-0xc(%rbp)
jmp    11d5 <main+0xa5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x60,%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    %r12d,%r12d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e99(%rip),%r13
cmp    0x0(%r13),%eax
jne    1166 <main+0x36>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
lea    0xe91(%rip),%r14
mov    %rsp,%r15
xor    %ebx,%ebx
jmp    11a0 <main+0x70>
cs nopw 0x0(%rax,%rax,1)
movslq %ebx,%rax
mov    %bpl,(%rsp,%rax,1)
add    $0x1,%ebx
cmp    $0xa,%ebp
cmove  %r12d,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
cmp    0x0(%r13),%eax
je     1155 <main+0x25>
cmp    $0x4e,%ebx
jle    1180 <main+0x50>
cmp    $0x4f,%ebx
jne    11c0 <main+0x90>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
jmp    1187 <main+0x57>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <putchar@plt>
jmp    1187 <main+0x57>

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

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