#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 /*<<< orphan*/ printf(char *, ...);
void main() {
  char line[100];
  int length;
  while ((length = getLine(line)) > 0) {
    int i = 0;
    while (length >= 25) {
      for (i += 25; i > 0 && line[i] != ' '; --i)
        ;
      if (i == 0) {
        length -= 25;
        printf("What sort of words are you using, more than %d in length ?",
               25);
      }
      line[i] = '\n';
      length -= i;
    }
    printf("%s\n", line);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x70(%rbp),%rdi
call   1040 <getLine@plt>
mov    %eax,-0x74(%rbp)
cmp    $0x0,%eax
jle    11f4 <main+0xd4>
movl   $0x0,-0x78(%rbp)
cmpl   $0x19,-0x74(%rbp)
jl     11dd <main+0xbd>
mov    -0x78(%rbp),%eax
add    $0x19,%eax
mov    %eax,-0x78(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x78(%rbp)
mov    %al,-0x79(%rbp)
jle    117b <main+0x5b>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    118b <main+0x6b>
jmp    119e <main+0x7e>
jmp    1190 <main+0x70>
mov    -0x78(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
jmp    115a <main+0x3a>
cmpl   $0x0,-0x78(%rbp)
jne    11c4 <main+0xa4>
mov    -0x74(%rbp),%eax
sub    $0x19,%eax
mov    %eax,-0x74(%rbp)
lea    0xe48(%rip),%rdi
mov    $0x19,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x78(%rbp),%rax
movb   $0xa,-0x70(%rbp,%rax,1)
mov    -0x78(%rbp),%ecx
mov    -0x74(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x74(%rbp)
jmp    1147 <main+0x27>
lea    -0x70(%rbp),%rsi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112b <main+0xb>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
call   1050 <getLine@plt>
test   %eax,%eax
jle    11e6 <main+0xb6>
mov    %eax,%ebp
lea    0xead(%rip),%r15
mov    %rsp,%r14
jmp    1176 <main+0x46>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1050 <getLine@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    11e6 <main+0xb6>
cmp    $0x19,%ebp
jb     1160 <main+0x30>
xor    %ebx,%ebx
jmp    1192 <main+0x62>
nop
test   %ebx,%ebx
je     11d0 <main+0xa0>
movslq %ebx,%rax
movb   $0xa,(%rsp,%rax,1)
sub    %eax,%ebp
cmp    $0x18,%ebp
jle    1160 <main+0x30>
mov    %ebx,%eax
lea    0x19(%rax),%ebx
cmp    $0xffffffe8,%eax
jl     1180 <main+0x50>
test   %ebx,%ebx
mov    $0x1,%eax
cmovle %ebx,%eax
add    $0xffffffff,%eax
nopl   0x0(%rax)
mov    %ebx,%ecx
cmpb   $0x20,(%rsp,%rcx,1)
je     1184 <main+0x54>
lea    -0x1(%rbx),%ecx
cmp    $0x1,%ebx
mov    %ecx,%ebx
jg     11b0 <main+0x80>
mov    %eax,%ebx
jmp    1180 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffe7,%ebp
xor    %ebx,%ebx
mov    %r15,%rdi
mov    $0x19,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1184 <main+0x54>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [59 x i8] c"What sort of words are you using, more than %d in length ?\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = alloca i32
br label %4
4: ; preds = %45, %0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = call i32 @getLine(i8* %5)
store i32 %6, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %48
8: ; preds = %4
store i32 0, i32* %3
br label %9
9: ; preds = %38, %8
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 25
br i1 %11, label %12, label %45
12: ; preds = %9
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 25
store i32 %14, i32* %3
br label %15
15: ; preds = %28, %12
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 32
br label %25
25: ; preds = %18, %15
%26 = phi i1 [ false, %15 ], [ %24, %18 ]
br i1 %26, label %27, label %31
27: ; preds = %25
br label %28
28: ; preds = %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, -1
store i32 %30, i32* %3
br label %15
31: ; preds = %25
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %2
%36 = sub nsw i32 %35, 25
store i32 %36, i32* %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 25)
br label %38
38: ; preds = %34, %31
%39 = load i32, i32* %3
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %40
store i8 10, i8* %41
%42 = load i32, i32* %3
%43 = load i32, i32* %2
%44 = sub nsw i32 %43, %42
store i32 %44, i32* %2
br label %9
45: ; preds = %9
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %46)
br label %4
48: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [59 x i8] c"What sort of words are you using, more than %d in length ?\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @getLine(i8* %2)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %42
5: ; preds = %0, %38
%6 = phi i32 [ %40, %38 ], [ %3, %0 ]
%7 = icmp ugt i32 %6, 24
br i1 %7, label %8, label %38
8: ; preds = %5, %31
%9 = phi i32 [ %32, %31 ], [ 0, %5 ]
%10 = phi i32 [ %36, %31 ], [ %6, %5 ]
%11 = add i32 %9, 25
%12 = icmp sgt i32 %9, -25
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = call i32 @llvm.smin.i32(i32 %11, i32 1)
%15 = add i32 %14, -1
br label %16
16: ; preds = %13, %22
%17 = phi i32 [ %23, %22 ], [ %11, %13 ]
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 32
br i1 %21, label %31, label %22
22: ; preds = %16
%23 = add nsw i32 %17, -1
%24 = icmp sgt i32 %17, 1
br i1 %24, label %16, label %25
25: ; preds = %22, %8
%26 = phi i32 [ %11, %8 ], [ %15, %22 ]
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = add nsw i32 %10, -25
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 25)
br label %31
31: ; preds = %16, %28, %25
%32 = phi i32 [ 0, %28 ], [ %26, %25 ], [ %17, %16 ]
%33 = phi i32 [ %29, %28 ], [ %10, %25 ], [ %10, %16 ]
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %34
store i8 10, i8* %35
%36 = sub nsw i32 %33, %32
%37 = icmp sgt i32 %36, 24
br i1 %37, label %8, label %38
38: ; preds = %31, %5
%39 = call i32 @puts(i8* %2)
%40 = call i32 @getLine(i8* %2)
%41 = icmp sgt i32 %40, 0
br i1 %41, label %5, label %42
42: ; preds = %38, %0
ret void
}