#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 getLine(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int main() {
  int len, partsNum, splitPos;
  char line[1000];
  while ((len = getLine(line, 1000)) > 0) {
    if (len > 80) {
      splitPos = 80;
      for (int i = 0; i < splitPos; ++i)
        putchar(line[i]);
      putchar('\n');
      for (int i = splitPos; i < len; ++i)
        putchar(line[i]);
    } else {
      printf("%s", line);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1218 <main+0xe8>
cmpl   $0x50,-0x8(%rbp)
jle    1200 <main+0xd0>
movl   $0x50,-0x10(%rbp)
movl   $0x0,-0x404(%rbp)
mov    -0x404(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b1 <main+0x81>
movslq -0x404(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    117a <main+0x4a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x408(%rbp)
mov    -0x408(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fb <main+0xcb>
movslq -0x408(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
mov    -0x408(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x408(%rbp)
jmp    11c4 <main+0x94>
jmp    1213 <main+0xe3>
lea    -0x400(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
test   %eax,%eax
jle    11d4 <main+0xa4>
mov    %eax,%ebp
mov    %rsp,%r15
lea    0xea2(%rip),%r14
jmp    117e <main+0x4e>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    $0x3e8,%esi
call   1050 <getLine@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11d4 <main+0xa4>
cmp    $0x51,%ebp
jb     1160 <main+0x30>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x50,%rbx
jne    1190 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x51,%ebp
jl     116b <main+0x3b>
mov    %ebp,%ebp
mov    $0x50,%ebx
nopl   0x0(%rax)
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11c0 <main+0x90>
jmp    116b <main+0x3b>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
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 @getLine(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %32
5: ; preds = %0, %29
%6 = phi i32 [ %30, %29 ], [ %3, %0 ]
%7 = icmp ugt i32 %6, 80
br i1 %7, label %13, label %27
8: ; preds = %13
%9 = call i32 @putchar(i8 signext 10)
%10 = icmp sgt i32 %6, 80
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = zext i32 %6 to i64
br label %20
13: ; preds = %5, %13
%14 = phi i64 [ %18, %13 ], [ 0, %5 ]
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @putchar(i8 signext %16)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, 80
br i1 %19, label %8, label %13
20: ; preds = %11, %20
%21 = phi i64 [ 80, %11 ], [ %25, %20 ]
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = call i32 @putchar(i8 signext %23)
%25 = add nuw nsw i64 %21, 1
%26 = icmp eq i64 %25, %12
br i1 %26, label %29, label %20
27: ; preds = %5
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %29
29: ; preds = %20, %8, %27
%30 = call i32 @getLine(i8* %2, i32 1000)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %5, label %32
32: ; preds = %29, %0
ret i32 0
}