#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*/ FILE;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ is_comment_line(char *);
scalar_t__ is_empty_line(char *);
int /*<<< orphan*/ remove_comments(char *);
int /*<<< orphan*/ remove_trailing_whitespace(char *);
void remove_empty_lines(FILE *output, FILE *input) {
  char buffer[160 + 1];
  while (fgets(buffer, sizeof buffer, input)) {
    if (!(is_empty_line(buffer) || is_comment_line(buffer))) {
      remove_comments(buffer);
      remove_trailing_whitespace(buffer);
      fputs(buffer, output);
    }
  }
}


x86 assembly (clang, -O0):
<remove_empty_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0xa1,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     11eb <remove_empty_lines+0x8b>
lea    -0xc0(%rbp),%rdi
call   1050 <is_empty_line@plt>
cmp    $0x0,%rax
jne    11e6 <remove_empty_lines+0x86>
lea    -0xc0(%rbp),%rdi
call   1070 <is_comment_line@plt>
cmp    $0x0,%rax
jne    11e6 <remove_empty_lines+0x86>
lea    -0xc0(%rbp),%rdi
call   1030 <remove_comments@plt>
lea    -0xc0(%rbp),%rdi
call   1040 <remove_trailing_whitespace@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <fputs@plt>
jmp    1173 <remove_empty_lines+0x13>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_empty_lines>:
push   %r15
push   %r14
push   %rbx
sub    $0xb0,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsp,%rdi
mov    $0xa1,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     11dc <remove_empty_lines+0x7c>
mov    %rsp,%rbx
jmp    11a5 <remove_empty_lines+0x45>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0xa1,%esi
mov    %r15,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
je     11dc <remove_empty_lines+0x7c>
mov    %rbx,%rdi
call   1050 <is_empty_line@plt>
test   %rax,%rax
jne    1190 <remove_empty_lines+0x30>
mov    %rbx,%rdi
call   1070 <is_comment_line@plt>
test   %rax,%rax
jne    1190 <remove_empty_lines+0x30>
mov    %rbx,%rdi
call   1030 <remove_comments@plt>
mov    %rbx,%rdi
call   1040 <remove_trailing_whitespace@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <fputs@plt>
jmp    1190 <remove_empty_lines+0x30>
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @remove_empty_lines(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [161 x i8]
store i32* %0, i32** %3
store i32* %1, i32** %4
br label %6
6: ; preds = %27, %2
%7 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%8 = load i32*, i32** %4
%9 = call i64 @fgets(i8* %7, i32 161, i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %6
%12 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%13 = call i64 @is_empty_line(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %27, label %15
15: ; preds = %11
%16 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%17 = call i64 @is_comment_line(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %27, label %19
19: ; preds = %15
%20 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%21 = call i32 @remove_comments(i8* %20)
%22 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%23 = call i32 @remove_trailing_whitespace(i8* %22)
%24 = getelementptr inbounds [161 x i8], [161 x i8]* %5, i64 0, i64 0
%25 = load i32*, i32** %3
%26 = call i32 @fputs(i8* %24, i32* %25)
br label %27
27: ; preds = %19, %15, %11
br label %6
28: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @remove_empty_lines(i32* nocapture %0, i32* nocapture %1) {
%3 = alloca [161 x i8]
%4 = getelementptr inbounds [161 x i8], [161 x i8]* %3, i64 0, i64 0
%5 = call i64 @fgets(i8* %4, i32 161, i32* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %2, %17
%8 = call i64 @is_empty_line(i8* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = call i64 @is_comment_line(i8* %4)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = call i32 @remove_comments(i8* %4)
%15 = call i32 @remove_trailing_whitespace(i8* %4)
%16 = call i32 @fputs(i8* %4, i32* %0)
br label %17
17: ; preds = %13, %10, %7
%18 = call i64 @fgets(i8* %4, i32 161, i32* %1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %17, %2
ret void
}