#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 *, ...);
int main() {
  int c, i;
  int c_count = 0;
  const int TEXT_WIDTH = 80;
  const int MAX_LEN = 128;
  char word[MAX_LEN];
  i = 0;
  while ((c = getchar())) {
    if ((c != ' ') && (c != '\t') && (c != '\n')) {
      word[i] = c;
      i++;
    } else {
      if (c_count > TEXT_WIDTH) {
        c_count = 0 + i;
        printf("\n");
      }
      word[i] = '\0';
      printf("%s%c", word, c);
      i = 0;
    }
    if (i == TEXT_WIDTH) {
      word[i] = '\0';
      printf("%s-\n", word);
      i = 0;
    }
    if (c == EOF) {
      if (c_count > TEXT_WIDTH) {
        printf("\n");
      }
      word[i - 1] = '\0';
      printf("%s\n", word);
      break;
    }
    c_count++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x50,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1284 <main+0x164>
cmpl   $0x20,-0x8(%rbp)
je     11a4 <main+0x84>
cmpl   $0x9,-0x8(%rbp)
je     11a4 <main+0x84>
cmpl   $0xa,-0x8(%rbp)
je     11a4 <main+0x84>
mov    -0x8(%rbp),%eax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0xa0(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11f0 <main+0xd0>
cmpl   $0x50,-0x10(%rbp)
jle    11c5 <main+0xa5>
mov    -0xc(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x10(%rbp)
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
mov    -0x8(%rbp),%edx
lea    0xe25(%rip),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x50,-0xc(%rbp)
jne    1222 <main+0x102>
movslq -0xc(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    0xdf8(%rip),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2dbc(%rip),%rcx
cmp    (%rcx),%eax
jne    1276 <main+0x156>
cmpl   $0x50,-0x10(%rbp)
jle    124c <main+0x12c>
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0xa0(%rbp,%rax,1)
lea    0xda7(%rip),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1284 <main+0x164>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1155 <main+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea8(%rip),%r14
mov    %rsp,%r12
mov    0x2e86(%rip),%r13
xor    %ebp,%ebp
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
lea    -0x9(%rbx),%eax
cmp    $0x2,%eax
jb     11c0 <main+0x80>
cmp    $0x20,%ebx
je     11c0 <main+0x80>
test   %ebx,%ebx
je     1219 <main+0xd9>
movslq %r15d,%rax
mov    %bl,(%rsp,%rax,1)
add    $0x1,%r15d
cmp    $0x50,%r15d
jne    11eb <main+0xab>
movb   $0x0,0x50(%rsp)
xor    %r15d,%r15d
lea    0xe58(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11eb <main+0xab>
nopl   0x0(%rax)
cmp    $0x51,%ebp
jl     11d2 <main+0x92>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15d,%ebp
movslq %r15d,%rax
movb   $0x0,(%rsp,%rax,1)
xor    %r15d,%r15d
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    0x0(%r13),%ebx
je     11f9 <main+0xb9>
add    $0x1,%ebp
jmp    1170 <main+0x30>
cmp    $0x51,%ebp
jl     1208 <main+0xc8>
mov    $0xa,%edi
call   1030 <putchar@plt>
movslq %r15d,%rax
movb   $0x0,-0x1(%rax,%r12,1)
mov    %r12,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [5 x i8] c"%s%c\00"
@.str.2 = [5 x i8] c"%s-\0A\00"
@EOF = global i32 0
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %4
store i32 80, i32* %5
store i32 128, i32* %6
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %7
%9 = alloca i8, i64 128
store i32 0, i32* %3
br label %10
10: ; preds = %66, %0
%11 = call i32 (...) @getchar()
store i32 %11, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %69
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 32
br i1 %15, label %16, label %30
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp ne i32 %17, 9
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp ne i32 %20, 10
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i32, i32* %2
%24 = trunc i32 %23 to i8
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %9, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %43
30: ; preds = %19, %16, %13
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 80
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* %3
%35 = add nsw i32 0, %34
store i32 %35, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %33, %30
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %9, i64 %39
store i8 0, i8* %40
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %41)
store i32 0, i32* %3
br label %43
43: ; preds = %37, %22
%44 = load i32, i32* %3
%45 = icmp eq i32 %44, 80
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* %3
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %9, i64 %48
store i8 0, i8* %49
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %9)
store i32 0, i32* %3
br label %51
51: ; preds = %46, %43
%52 = load i32, i32* %2
%53 = load i32, i32* @EOF
%54 = icmp eq i32 %52, %53
br i1 %54, label %55, label %66
55: ; preds = %51
%56 = load i32, i32* %4
%57 = icmp sgt i32 %56, 80
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %60
60: ; preds = %58, %55
%61 = load i32, i32* %3
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %9, i64 %63
store i8 0, i8* %64
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %9)
br label %69
66: ; preds = %51
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %10
69: ; preds = %60, %10
store i32 0, i32* %1
%70 = load i8*, i8** %7
%71 = load i32, i32* %1
ret i32 %71
}

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