#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);
main() {
  char c;
  int i;
  i = 0;
  while ((c = getchar()) != EOF) {
    putchar(c);
    if (c == '\n')
      i = 0;
    else if (++i > 78) {
      putchar('\\');
      putchar('\n');
      i = 0;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11ae <main+0x8e>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    1177 <main+0x57>
movl   $0x0,-0xc(%rbp)
jmp    11a9 <main+0x89>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x4e,%eax
jle    11a4 <main+0x84>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11a9 <main+0x89>
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r14
cmp    (%r14),%al
jne    1147 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1165 <main+0x45>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %r15d,%ebp
cmp    (%r14),%al
je     113a <main+0x1a>
movsbl %al,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %r15d,%r15d
cmp    $0xa,%bl
je     1156 <main+0x36>
cmp    $0x4e,%ebp
jl     1150 <main+0x30>
mov    $0x5c,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1156 <main+0x36>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %25, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %26
10: ; preds = %4
%11 = load i8, i8* %2
%12 = call i32 @putchar(i8 signext %11)
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 0, i32* %3
br label %25
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
%20 = icmp sgt i32 %19, 78
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @putchar(i8 signext 92)
%23 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %3
br label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %24, %16
br label %4
26: ; preds = %4
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %20, label %4
4: ; preds = %0, %15
%5 = phi i8 [ %17, %15 ], [ %1, %0 ]
%6 = phi i32 [ %16, %15 ], [ 0, %0 ]
%7 = tail call i32 @putchar(i8 signext %5)
%8 = icmp eq i8 %5, 10
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = add nsw i32 %6, 1
%11 = icmp sgt i32 %6, 77
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = tail call i32 @putchar(i8 signext 92)
%14 = tail call i32 @putchar(i8 signext 10)
br label %15
15: ; preds = %4, %9, %12
%16 = phi i32 [ 0, %12 ], [ %10, %9 ], [ 0, %4 ]
%17 = tail call signext i8 (...) @getchar()
%18 = load i8, i8* @EOF
%19 = icmp eq i8 %17, %18
br i1 %19, label %20, label %4
20: ; preds = %15, %0
ret i32 0
}