#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 del_space(char *, int);
int getline(char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int main() {
  int len;
  int max;
  char line[1000];
  max = 0;
  while ((len = getline(line, 1000)) > 0) {
    len = del_space(line, len);
    if (len > 1)
      printf("line length:%d %s", len, line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x400(%rbp),%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    119d <main+0x6d>
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <del_space@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1198 <main+0x68>
mov    -0x8(%rbp),%esi
lea    -0x400(%rbp),%rdx
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
jmp    1149 <main+0x19>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    118f <main+0x5f>
mov    %rsp,%rbx
lea    0xeab(%rip),%r14
jmp    1171 <main+0x41>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    118f <main+0x5f>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <del_space@plt>
cmp    $0x2,%eax
jl     1160 <main+0x30>
mov    %r14,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"line length:%d %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 %14
5: ; preds = %0, %11
%6 = phi i32 [ %12, %11 ], [ %3, %0 ]
%7 = call i32 @del_space(i8* %2, i32 %6)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %2)
br label %11
11: ; preds = %9, %5
%12 = call i32 @getline(i8* %2, i32 1000)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %11, %0
ret i32 0
}