#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 */
scalar_t__ isBlankLine(char *);
int my_getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rmTrailingBlank(char *);
int main() {
  char line[1000];
  int len;
  while ((len = my_getline(line, 1000)) > 0) {
    if (isBlankLine(line))
      continue;
    rmTrailingBlank(line);
    printf("%s", line);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1060 <my_getline@plt>
mov    %eax,-0x3f4(%rbp)
cmp    $0x0,%eax
jle    11b1 <main+0x71>
lea    -0x3f0(%rbp),%rdi
call   1030 <isBlankLine@plt>
cmp    $0x0,%rax
je     118d <main+0x4d>
jmp    1152 <main+0x12>
lea    -0x3f0(%rbp),%rdi
call   1050 <rmTrailingBlank@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
jmp    1152 <main+0x12>
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   1060 <my_getline@plt>
test   %eax,%eax
jle    11a3 <main+0x63>
mov    %rsp,%rbx
lea    0xe9b(%rip),%r14
jmp    1181 <main+0x41>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1060 <my_getline@plt>
test   %eax,%eax
jle    11a3 <main+0x63>
mov    %rbx,%rdi
call   1030 <isBlankLine@plt>
test   %rax,%rax
jne    1170 <main+0x30>
mov    %rbx,%rdi
call   1050 <rmTrailingBlank@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    1170 <main+0x30>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%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 @my_getline(i8* %2, i32 1000)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %0, %11
%6 = call i64 @isBlankLine(i8* %2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i32 @rmTrailingBlank(i8* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %8, %5
%12 = call i32 @my_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
}