#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 /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ handle_line(char *);
char *process_line(char *);
int /*<<< orphan*/ stdin;
int main(int argc, const char **argv) {
  char line[8192];
  while (fgets(line, 8192, stdin) != NULL) {
    line[8192 - 1] = 0;
    char *processed_line = process_line(line);
    if (processed_line != NULL) {
      handle_line(processed_line);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2010(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11a3 <main+0x73>
movb   $0x0,-0x11(%rbp)
lea    -0x2010(%rbp),%rdi
call   1050 <process_line@plt>
mov    %rax,-0x2018(%rbp)
cmpq   $0x0,-0x2018(%rbp)
je     119e <main+0x6e>
mov    -0x2018(%rbp),%rdi
call   1030 <handle_line@plt>
jmp    1149 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2008,%rsp
mov    0x2ea7(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0x2000,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     1194 <main+0x64>
mov    %rsp,%rbx
jmp    1175 <main+0x45>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0x2000,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     1194 <main+0x64>
movb   $0x0,0x1fff(%rsp)
mov    %rbx,%rdi
call   1050 <process_line@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    %rax,%rdi
call   1030 <handle_line@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x2008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8192 x i8]
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %22, %2
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %9, i32 8192, i32 %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %23
13: ; preds = %8
%14 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 8191
store i8 0, i8* %14
%15 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%16 = call i8* @process_line(i8* %15)
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = load i8*, i8** %7
%21 = call i32 @handle_line(i8* %20)
br label %22
22: ; preds = %19, %13
br label %8
23: ; preds = %8
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %4, i32 8192, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %19, label %8
8: ; preds = %2
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 8191
br label %10
10: ; preds = %8, %15
store i8 0, i8* %9
%11 = call i8* @process_line(i8* %4)
%12 = icmp eq i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 @handle_line(i8* %11)
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* @stdin
%17 = call i32* @fgets(i8* %4, i32 8192, i32 %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %10
19: ; preds = %15, %2
ret i32 0
}