#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 *, char *);
int /*<<< orphan*/ fold(char *, char *);
int get_line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
main() {
  int len;
  char line[1000];
  char folded_line[1000];
  char detabbed_line[1000];
  while ((len = get_line(line, 1000)) > 0) {
    len = detab(detabbed_line, line);
    if (len < 80) {
      printf("%s", detabbed_line);
    } else {
      fold(folded_line, detabbed_line);
      printf("%s", folded_line);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11d2 <main+0x92>
lea    -0xbd0(%rbp),%rdi
lea    -0x3f0(%rbp),%rsi
call   1030 <detab@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x50,-0x8(%rbp)
jge    11a7 <main+0x67>
lea    -0xbd0(%rbp),%rsi
lea    0xe63(%rip),%rdi
call   1050 <printf@plt>
jmp    11cd <main+0x8d>
lea    -0x7e0(%rbp),%rdi
lea    -0xbd0(%rbp),%rsi
call   1060 <fold@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe38(%rip),%rdi
call   1050 <printf@plt>
jmp    1152 <main+0x12>
xor    %eax,%eax
add    $0xbd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xbc8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
test   %eax,%eax
jle    11bc <main+0x7c>
lea    0x3f0(%rsp),%rbx
mov    %rsp,%r14
lea    0xe8f(%rip),%r15
lea    0x7e0(%rsp),%r12
jmp    1199 <main+0x59>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r14,%rdi
mov    $0x3e8,%esi
call   1040 <get_line@plt>
test   %eax,%eax
jle    11bc <main+0x7c>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <detab@plt>
mov    %rbx,%rsi
cmp    $0x50,%eax
jl     1180 <main+0x40>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <fold@plt>
mov    %r12,%rsi
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0xbc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %25, %0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = call i32 @get_line(i8* %7, i32 1000)
store i32 %8, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %6
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%13 = call i32 @detab(i8* %11, i8* %12)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 80
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %25
19: ; preds = %10
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%22 = call i32 @fold(i8* %20, i8* %21)
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19, %16
br label %6
26: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = call i32 @get_line(i8* %4, i32 1000)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0, %14
%10 = call i32 @detab(i8* %6, i8* %4)
%11 = icmp slt i32 %10, 80
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @fold(i8* %5, i8* %6)
br label %14
14: ; preds = %9, %12
%15 = phi i8* [ %5, %12 ], [ %6, %9 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @get_line(i8* %4, i32 1000)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %9, label %19
19: ; preds = %14, %0
ret i32 0
}