#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 findnewline(char *, int);
int /*<<< orphan*/ getlines(char *);
int /*<<< orphan*/ putchar(char);
int main() {
  char userinput[1000];
  int i, j, k;
  getlines(userinput);
  for (j = 0, i = 0; i < 1000 - 1 && userinput[i] != '\0'; i += j) {
    if ((j = findnewline(userinput, i)) > 80) {
      for (k = 0; k < j; k++)
        putchar(userinput[i + k]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
call   1050 <getlines@plt>
movl   $0x0,-0x3f8(%rbp)
movl   $0x0,-0x3f4(%rbp)
xor    %eax,%eax
cmpl   $0x3e7,-0x3f4(%rbp)
mov    %al,-0x3fd(%rbp)
jge    1195 <main+0x65>
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0x3fd(%rbp)
mov    -0x3fd(%rbp),%al
test   $0x1,%al
jne    11a8 <main+0x78>
jmp    1235 <main+0x105>
lea    -0x3f0(%rbp),%rdi
mov    -0x3f4(%rbp),%esi
call   1040 <findnewline@plt>
mov    %eax,-0x3f8(%rbp)
cmp    $0x50,%eax
jle    1219 <main+0xe9>
movl   $0x0,-0x3fc(%rbp)
mov    -0x3fc(%rbp),%eax
cmp    -0x3f8(%rbp),%eax
jge    1214 <main+0xe4>
mov    -0x3f4(%rbp),%eax
add    -0x3fc(%rbp),%eax
cltq
movsbl -0x3f0(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
mov    -0x3fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3fc(%rbp)
jmp    11d3 <main+0xa3>
jmp    1219 <main+0xe9>
jmp    121e <main+0xee>
mov    -0x3f8(%rbp),%eax
add    -0x3f4(%rbp),%eax
mov    %eax,-0x3f4(%rbp)
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
call   1050 <getlines@plt>
xor    %r13d,%r13d
jmp    115c <main+0x2c>
xchg   %ax,%ax
add    %r15d,%r13d
cmp    $0x3e7,%r13d
jge    11a4 <main+0x74>
movslq %r13d,%r12
cmpb   $0x0,(%rsp,%r12,1)
je     11a4 <main+0x74>
mov    %rsp,%rdi
mov    %r13d,%esi
call   1040 <findnewline@plt>
mov    %eax,%r15d
cmp    $0x51,%eax
jl     1150 <main+0x20>
mov    %r15d,%r14d
lea    (%rsp,%r12,1),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1190 <main+0x60>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @getlines(i8* %2)
br label %4
4: ; preds = %0, %23
%5 = phi i32 [ 0, %0 ], [ %24, %23 ]
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %4
%11 = call i32 @findnewline(i8* %2, i32 %5)
%12 = icmp sgt i32 %11, 80
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = zext i32 %11 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %21, %15 ]
%17 = add nsw i64 %16, %6
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = call i32 @putchar(i8 signext %19)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %14
br i1 %22, label %23, label %15
23: ; preds = %15, %10
%24 = add nsw i32 %11, %5
%25 = icmp slt i32 %24, 999
br i1 %25, label %4, label %26
26: ; preds = %23, %4
ret i32 0
}