#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 */
typedef int /*<<< orphan*/ line;

/* Variables and functions */
int /*<<< orphan*/ cleanup(char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int empties = -1;
  char line[1024];
  while (fgets(line, sizeof(line), stdin)) {
    cleanup(line);
    if (line[0] != '\n') {
      if (empties > 0)
        putchar('\n');
      empties = 0;
      fputs(line, stdout);
      continue;
    }
    if (empties < 0)
      continue;
    empties++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
lea    -0x420(%rbp),%rdi
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11f2 <main+0xb2>
lea    -0x420(%rbp),%rdi
call   1060 <cleanup@plt>
movsbl -0x420(%rbp),%eax
cmp    $0xa,%eax
je     11d5 <main+0x95>
cmpl   $0x0,-0x14(%rbp)
jle    11b4 <main+0x74>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
lea    -0x420(%rbp),%rdi
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
jmp    1160 <main+0x20>
cmpl   $0x0,-0x14(%rbp)
jge    11e4 <main+0xa4>
jmp    1160 <main+0x20>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1160 <main+0x20>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    0x2e94(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11c9 <main+0x89>
mov    $0xffffffff,%ebp
mov    %rsp,%rbx
mov    0x2e60(%rip),%r15
jmp    119e <main+0x5e>
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
not    %eax
shr    $0x1f,%eax
add    %eax,%ebp
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11c9 <main+0x89>
mov    %rbx,%rdi
call   1060 <cleanup@plt>
cmpb   $0xa,(%rsp)
je     1180 <main+0x40>
test   %ebp,%ebp
jle    11ba <main+0x7a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
call   1040 <fputs@plt>
xor    %ebp,%ebp
jmp    1189 <main+0x49>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
br label %8
8: ; preds = %33, %32, %25, %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i64 @fgets(i8* %9, i32 1024, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %36
13: ; preds = %8
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%15 = call i32 @cleanup(i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 10
br i1 %19, label %20, label %29
20: ; preds = %13
%21 = load i32, i32* %6
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @putchar(i8 signext 10)
br label %25
25: ; preds = %23, %20
store i32 0, i32* %6
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%27 = load i32, i32* @stdout
%28 = call i32 @fputs(i8* %26, i32 %27)
br label %8
29: ; preds = %13
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %29
br label %8
33: ; preds = %29
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %8
36: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %4, i32 1024, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %29, label %8
8: ; preds = %2, %20
%9 = phi i32 [ %21, %20 ], [ -1, %2 ]
%10 = call i32 @cleanup(i8* %4)
%11 = load i8, i8* %4
%12 = icmp eq i8 %11, 10
br i1 %12, label %25, label %13
13: ; preds = %8
%14 = icmp sgt i32 %9, 0
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @putchar(i8 signext 10)
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* @stdout
%19 = call i32 @fputs(i8* %4, i32 %18)
br label %20
20: ; preds = %17, %25
%21 = phi i32 [ 0, %17 ], [ %28, %25 ]
%22 = load i32, i32* @stdin
%23 = call i64 @fgets(i8* %4, i32 1024, i32 %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %8
25: ; preds = %8
%26 = xor i32 %9, -1
%27 = lshr i32 %26, 31
%28 = add nsw i32 %27, %9
br label %20
29: ; preds = %20, %2
ret i32 0
}