#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);
int /*<<< orphan*/ printf(char *, char *);
int trimline(char *, int);
int main() {
  int len;
  char line[100];
  len = 0;
  while ((len = getline(line, 100)) > 0) {
    if ((len = trimline(line, len)) > 0 && (len != 1 || line[0] != '\n'))
      printf("%s", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    11a4 <main+0x74>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1040 <trimline@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    119f <main+0x6f>
cmpl   $0x1,-0x8(%rbp)
jne    118f <main+0x5f>
movsbl -0x70(%rbp),%eax
cmp    $0xa,%eax
je     119f <main+0x6f>
lea    -0x70(%rbp),%rsi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsp,%rdi
mov    $0x64,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    1197 <main+0x67>
mov    %rsp,%rbx
lea    0xeae(%rip),%r14
jmp    117c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <getline@plt>
test   %eax,%eax
jle    1197 <main+0x67>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <trimline@plt>
test   %eax,%eax
jle    116b <main+0x3b>
cmp    $0x1,%eax
jne    1160 <main+0x30>
cmpb   $0xa,(%rsp)
je     116b <main+0x3b>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @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, i32 100)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %0, %16
%6 = phi i32 [ %17, %16 ], [ %3, %0 ]
%7 = call i32 @trimline(i8* %2, i32 %6)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = icmp ne i32 %7, 1
%11 = load i8, i8* %2
%12 = icmp ne i8 %11, 10
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %16
16: ; preds = %9, %14, %5
%17 = call i32 @getline(i8* %2, i32 100)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %5, label %19
19: ; preds = %16, %0
ret i32 0
}