#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 detab(char *);
int findLast(char *);
int getLine(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
main() {
  int i, c, len, last, max;
  char line[10 + 1];
  max = 0;
  while ((len = getLine(line, 10 + 1)) > 0) {
    max = max + len;
    if (max == len) {
      len = detab(line);
      if (line[len - 1] == '\n') {
        printf("%s", line);
        max = 0;
      } else {
        last = findLast(line);
        for (i = 0; i <= last; ++i)
          putchar(line[i]);
        printf("...\n");
      }
    } else if (line[len - 1] == '\n')
      max = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x23(%rbp),%rdi
mov    $0xb,%esi
call   1070 <getLine@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jle    124a <main+0xfa>
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    1223 <main+0xd3>
lea    -0x23(%rbp),%rdi
call   1040 <detab@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x23(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11d5 <main+0x85>
lea    -0x23(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
jmp    121e <main+0xce>
lea    -0x23(%rbp),%rdi
call   1060 <findLast@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1210 <main+0xc0>
movslq -0x8(%rbp),%rax
movsbl -0x23(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e8 <main+0x98>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1245 <main+0xf5>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x23(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    1240 <main+0xf0>
movl   $0x0,-0x18(%rbp)
jmp    1245 <main+0xf5>
jmp    1166 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xd(%rsp),%r12
mov    %r12,%rdi
mov    $0xb,%esi
call   1080 <getLine@plt>
test   %eax,%eax
jle    1231 <main+0xd1>
xor    %r13d,%r13d
lea    0xe71(%rip),%r15
xor    %ebp,%ebp
jmp    11bd <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%eax
cmpb   $0xa,0xd(%rsp,%rax,1)
cmove  %r13d,%ebp
mov    %r12,%rdi
mov    $0xb,%esi
call   1080 <getLine@plt>
test   %eax,%eax
jle    1231 <main+0xd1>
mov    %ebp,%ecx
lea    (%rax,%rcx,1),%ebp
test   %ecx,%ecx
jne    11a0 <main+0x40>
mov    %r12,%rdi
call   1050 <detab@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r12,1)
jne    11ed <main+0x8d>
xor    %ebp,%ebp
lea    0xe1f(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11ac <main+0x4c>
mov    %r12,%rdi
call   1070 <findLast@plt>
test   %eax,%eax
js     1224 <main+0xc4>
mov    %eax,%ebx
add    $0x1,%ebx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0xd(%rsp,%r14,1),%edi
call   1030 <putchar@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1210 <main+0xb0>
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    11ac <main+0x4c>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"...\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 [11 x i8]
store i32 0, i32* %1
store i32 0, i32* %6
br label %8
8: ; preds = %61, %0
%9 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%10 = call i32 @getLine(i8* %9, i32 11)
store i32 %10, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %62
12: ; preds = %8
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %51
19: ; preds = %12
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%21 = call i32 @detab(i8* %20)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 10
br i1 %28, label %29, label %32
29: ; preds = %19
%30 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %30)
store i32 0, i32* %6
br label %50
32: ; preds = %19
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%34 = call i32 @findLast(i8* %33)
store i32 %34, i32* %5
store i32 0, i32* %2
br label %35
35: ; preds = %45, %32
%36 = load i32, i32* %2
%37 = load i32, i32* %5
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* %2
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = call i32 @putchar(i8 signext %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
store i32 %47, i32* %2
br label %35
48: ; preds = %35
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %50
50: ; preds = %48, %29
br label %61
51: ; preds = %12
%52 = load i32, i32* %4
%53 = sub nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 10
br i1 %58, label %59, label %60
59: ; preds = %51
store i32 0, i32* %6
br label %60
60: ; preds = %59, %51
br label %61
61: ; preds = %60, %50
br label %8
62: ; preds = %8
%63 = load i32, i32* %1
ret i32 %63
}

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