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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0x51,%esi
call   1060 <mygetline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11e1 <main+0xa1>
cmpl   $0x50,-0x8(%rbp)
jle    11dc <main+0x9c>
lea    -0x60(%rbp),%rsi
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x61(%rbp)
je     11b4 <main+0x74>
movsbl -0x9(%rbp),%eax
mov    0x2e3f(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    11c4 <main+0x84>
jmp    11d2 <main+0x92>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
jmp    1183 <main+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rdi
mov    $0x51,%esi
call   1060 <mygetline@plt>
test   %eax,%eax
jle    11b9 <main+0x79>
lea    0xe9f(%rip),%r14
mov    %rsp,%r15
mov    0x2e7d(%rip),%rbx
jmp    118b <main+0x4b>
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x51,%esi
call   1060 <mygetline@plt>
test   %eax,%eax
jle    11b9 <main+0x79>
cmp    $0x51,%eax
jb     117a <main+0x3a>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1170 <main+0x30>
cmp    (%rbx),%al
je     1170 <main+0x30>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x60>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i8 0
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 @mygetline(i8* %2, i32 81)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %28
5: ; preds = %0, %25
%6 = phi i32 [ %26, %25 ], [ %3, %0 ]
%7 = icmp ugt i32 %6, 80
br i1 %7, label %8, label %25
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%10 = call signext i8 (...) @getchar()
%11 = icmp ne i8 %10, 10
%12 = load i8, i8* @EOF
%13 = icmp ne i8 %10, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %23
15: ; preds = %8, %15
%16 = phi i8 [ %18, %15 ], [ %10, %8 ]
%17 = call i32 @putchar(i8 signext %16)
%18 = call signext i8 (...) @getchar()
%19 = icmp ne i8 %18, 10
%20 = load i8, i8* @EOF
%21 = icmp ne i8 %18, %20
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %15, label %23
23: ; preds = %15, %8
%24 = call i32 @putchar(i8 signext 10)
br label %25
25: ; preds = %23, %5
%26 = call i32 @mygetline(i8* %2, i32 81)
%27 = icmp sgt i32 %26, 0
br i1 %27, label %5, label %28
28: ; preds = %25, %0
ret i32 0
}