#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 */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
char *make_lower(int /*<<< orphan*/);
scalar_t__ streq(char *, char *);
int /*<<< orphan*/ trim(int /*<<< orphan*/);
int /*<<< orphan*/ trim_comment(char *);
char *get_line(FILE *in, char *buffer) {
  if (fgets(buffer, 1024, in) == NULL)
    return NULL;
  char *line = make_lower(trim(trim_comment(buffer)));
  if (streq(line, ""))
    return get_line(in, buffer);
  else
    return line;
}


x86 assembly (clang, -O0):
<get_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x400,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1199 <get_line+0x39>
movq   $0x0,-0x8(%rbp)
jmp    11ec <get_line+0x8c>
mov    -0x18(%rbp),%rdi
call   1080 <trim_comment@plt>
mov    %eax,%edi
call   1040 <trim@plt>
mov    %eax,%edi
call   1070 <make_lower@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe41(%rip),%rsi
call   1050 <streq@plt>
cmp    $0x0,%rax
je     11e4 <get_line+0x84>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_line@plt>
mov    %rax,-0x8(%rbp)
jmp    11ec <get_line+0x8c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r13
mov    %rdi,%r15
xor    %r14d,%r14d
lea    0xe97(%rip),%r12
nopl   0x0(%rax)
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11b1 <get_line+0x61>
mov    %r13,%rdi
call   1070 <trim_comment@plt>
mov    %eax,%edi
call   1030 <trim@plt>
mov    %eax,%edi
call   1060 <make_lower@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <streq@plt>
test   %rax,%rax
jne    1170 <get_line+0x20>
mov    %rbx,%r14
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @get_line(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = load i32*, i32** %4
%9 = call i32* @fgets(i8* %7, i32 1024, i32* %8)
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i8* null, i8** %3
br label %26
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @trim_comment(i8* %13)
%15 = call i32 @trim(i32 %14)
%16 = call i8* @make_lower(i32 %15)
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i64 @streq(i8* %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = load i32*, i32** %4
%22 = load i8*, i8** %5
%23 = call i8* @get_line(i32* %21, i8* %22)
store i8* %23, i8** %3
br label %26
24: ; preds = %12
%25 = load i8*, i8** %6
store i8* %25, i8** %3
br label %26
26: ; preds = %24, %20, %11
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @get_line(i32* nocapture %0, i8* %1) {
br label %3
3: ; preds = %6, %2
%4 = tail call i32* @fgets(i8* %1, i32 1024, i32* %0)
%5 = icmp eq i32* %4, null
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = tail call i32 @trim_comment(i8* %1)
%8 = tail call i32 @trim(i32 %7)
%9 = tail call i8* @make_lower(i32 %8)
%10 = tail call i64 @streq(i8* %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %6, %3
%13 = phi i8* [ null, %3 ], [ %9, %6 ]
ret i8* %13
}