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

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
char *parser_get_next_line(FILE *fp) {
  static char buffer[8192];
  unsigned int n = 0, count = 0;
  int c, continuation = 0;
  while (n < sizeof(buffer) - 1) {
    c = fgetc(fp);
    if (c == EOF)
      break;
    count++;
    if (c == '\r')
      continue;
    if (continuation) {
      if (c == ' ' || c == '\t')
        continue;
      continuation = 0;
    }
    if (c == '\n') {
      if (n && buffer[n - 1] == '\\') {
        buffer[--n] = '\0';
        continuation = 1;
      }
      while (n && isspace(buffer[n - 1]))
        buffer[--n] = '\0';
      if (!continuation)
        break;
      buffer[n++] = ' ';
      continue;
    }
    buffer[n++] = c;
  }
  if (count == 0)
    return NULL;
  buffer[n] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<parser_get_next_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    $0x1fff,%rax
jae    12bc <parser_get_next_line+0x19c>
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e82(%rip),%rcx
cmp    (%rcx),%eax
jne    1173 <parser_get_next_line+0x53>
jmp    12bc <parser_get_next_line+0x19c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xd,-0x1c(%rbp)
jne    118b <parser_get_next_line+0x6b>
jmp    1141 <parser_get_next_line+0x21>
cmpl   $0x0,-0x20(%rbp)
je     11b5 <parser_get_next_line+0x95>
cmpl   $0x20,-0x1c(%rbp)
je     11a9 <parser_get_next_line+0x89>
cmpl   $0x9,-0x1c(%rbp)
jne    11ae <parser_get_next_line+0x8e>
jmp    1141 <parser_get_next_line+0x21>
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jne    1299 <parser_get_next_line+0x179>
cmpl   $0x0,-0x14(%rbp)
je     1206 <parser_get_next_line+0xe6>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2e66(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1206 <parser_get_next_line+0xe6>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2e45(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x20(%rbp)
jmp    120b <parser_get_next_line+0xeb>
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x21(%rbp)
je     123e <parser_get_next_line+0x11e>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2e15(%rip),%rax
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    124e <parser_get_next_line+0x12e>
jmp    126b <parser_get_next_line+0x14b>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2dde(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    120b <parser_get_next_line+0xeb>
cmpl   $0x0,-0x20(%rbp)
jne    127a <parser_get_next_line+0x15a>
jmp    12bc <parser_get_next_line+0x19c>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2db0(%rip),%rax
movb   $0x20,(%rax,%rcx,1)
jmp    1141 <parser_get_next_line+0x21>
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2d8c(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    1141 <parser_get_next_line+0x21>
cmpl   $0x0,-0x18(%rbp)
jne    12d3 <parser_get_next_line+0x1b3>
movq   $0x0,-0x8(%rbp)
jmp    12ee <parser_get_next_line+0x1ce>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
lea    0x2d61(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2d56(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parser_get_next_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
xor    %ebx,%ebx
mov    0x2eb1(%rip),%r12
xor    %ebp,%ebp
xor    %r13d,%r13d
mov    %ebp,%r14d
nop
cmp    $0x1ffe,%ebx
ja     11fd <parser_get_next_line+0xdd>
mov    %r15,%rdi
call   1030 <fgetc@plt>
cmp    (%r12),%eax
je     1200 <parser_get_next_line+0xe0>
add    $0x1,%ebp
cmp    $0xd,%eax
je     1140 <parser_get_next_line+0x20>
test   %r13d,%r13d
je     117b <parser_get_next_line+0x5b>
mov    $0x1,%r13d
cmp    $0x9,%eax
je     1140 <parser_get_next_line+0x20>
cmp    $0x20,%eax
je     1140 <parser_get_next_line+0x20>
cmp    $0xa,%eax
jne    11da <parser_get_next_line+0xba>
test   %ebx,%ebx
je     1216 <parser_get_next_line+0xf6>
lea    -0x1(%rbx),%eax
lea    0x2eae(%rip),%rcx
mov    (%rax,%rcx,1),%r13b
cmp    $0x5c,%r13b
jne    11a6 <parser_get_next_line+0x86>
movb   $0x0,(%rax,%rcx,1)
mov    %eax,%ebx
test   %eax,%eax
je     11f1 <parser_get_next_line+0xd1>
lea    -0x1(%rbx),%r14d
add    %rcx,%r14
movsbl (%r14),%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     11ca <parser_get_next_line+0xaa>
movb   $0x0,(%r14)
add    $0xffffffffffffffff,%r14
add    $0xffffffff,%ebx
jne    11ad <parser_get_next_line+0x8d>
xor    %ebx,%ebx
cmp    $0x5c,%r13b
jne    1200 <parser_get_next_line+0xe0>
mov    $0x1,%r13d
mov    $0x20,%al
jmp    11dd <parser_get_next_line+0xbd>
xor    %r13d,%r13d
mov    %ebx,%ecx
lea    0x2e5a(%rip),%rdx
mov    %al,(%rcx,%rdx,1)
add    $0x1,%ebx
jmp    113c <parser_get_next_line+0x1c>
mov    $0x1,%r13d
mov    $0x20,%al
xor    %ebx,%ebx
jmp    11dd <parser_get_next_line+0xbd>
mov    %r14d,%ebp
test   %ebp,%ebp
je     121c <parser_get_next_line+0xfc>
mov    %ebx,%eax
lea    0x2e33(%rip),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    %rcx,%rax
jmp    121e <parser_get_next_line+0xfe>
xor    %ebx,%ebx
test   %ebp,%ebp
jne    1204 <parser_get_next_line+0xe4>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@parser_get_next_line.buffer = internal global [8192 x i8] zeroinitializer
@EOF = global i32 0
define i8* @parser_get_next_line(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %7
br label %8
8: ; preds = %83, %78, %34, %24, %1
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = icmp ult i64 %10, 8191
br i1 %11, label %12, label %90
12: ; preds = %8
%13 = load i32*, i32** %3
%14 = call i32 @fgetc(i32* %13)
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
br label %90
19: ; preds = %12
%20 = load i32, i32* %5
%21 = add i32 %20, 1
store i32 %21, i32* %5
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 13
br i1 %23, label %24, label %25
24: ; preds = %19
br label %8
25: ; preds = %19
%26 = load i32, i32* %7
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %25
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 32
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 9
br i1 %33, label %34, label %35
34: ; preds = %31, %28
br label %8
35: ; preds = %31
store i32 0, i32* %7
br label %36
36: ; preds = %35, %25
%37 = load i32, i32* %6
%38 = icmp eq i32 %37, 10
br i1 %38, label %39, label %83
39: ; preds = %36
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %55
42: ; preds = %39
%43 = load i32, i32* %4
%44 = sub i32 %43, 1
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 92
br i1 %49, label %50, label %55
50: ; preds = %42
%51 = load i32, i32* %4
%52 = add i32 %51, -1
store i32 %52, i32* %4
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %53
store i8 0, i8* %54
store i32 1, i32* %7
br label %55
55: ; preds = %50, %42, %39
br label %56
56: ; preds = %69, %55
%57 = load i32, i32* %4
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i32, i32* %4
%61 = sub i32 %60, 1
%62 = zext i32 %61 to i64
%63 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = call i64 @isspace(i8 signext %64)
%66 = icmp ne i64 %65, 0
br label %67
67: ; preds = %59, %56
%68 = phi i1 [ false, %56 ], [ %66, %59 ]
br i1 %68, label %69, label %74
69: ; preds = %67
%70 = load i32, i32* %4
%71 = add i32 %70, -1
store i32 %71, i32* %4
%72 = zext i32 %71 to i64
%73 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %72
store i8 0, i8* %73
br label %56
74: ; preds = %67
%75 = load i32, i32* %7
%76 = icmp ne i32 %75, 0
br i1 %76, label %78, label %77
77: ; preds = %74
br label %90
78: ; preds = %74
%79 = load i32, i32* %4
%80 = add i32 %79, 1
store i32 %80, i32* %4
%81 = zext i32 %79 to i64
%82 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %81
store i8 32, i8* %82
br label %8
83: ; preds = %36
%84 = load i32, i32* %6
%85 = trunc i32 %84 to i8
%86 = load i32, i32* %4
%87 = add i32 %86, 1
store i32 %87, i32* %4
%88 = zext i32 %86 to i64
%89 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %88
store i8 %85, i8* %89
br label %8
90: ; preds = %77, %18, %8
%91 = load i32, i32* %5
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %90
store i8* null, i8** %2
br label %98
94: ; preds = %90
%95 = load i32, i32* %4
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %96
store i8 0, i8* %97
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 0), i8** %2
br label %98
98: ; preds = %94, %93
%99 = load i8*, i8** %2
ret i8* %99
}

LLVM IR (-O2):
@parser_get_next_line.buffer = internal global [8192 x i8] zeroinitializer
@EOF = global i32 0
define i8* @parser_get_next_line(i32* nocapture %0) {
br label %2
2: ; preds = %53, %1
%3 = phi i32 [ 0, %1 ], [ %59, %53 ]
%4 = phi i32 [ 0, %1 ], [ %17, %53 ]
%5 = phi i32 [ 0, %1 ], [ %56, %53 ]
%6 = icmp ult i32 %3, 8191
br label %7
7: ; preds = %22, %2
%8 = phi i32 [ %4, %2 ], [ %17, %22 ]
%9 = phi i32 [ %5, %2 ], [ 1, %22 ]
br label %10
10: ; preds = %7, %16
%11 = phi i32 [ %17, %16 ], [ %8, %7 ]
br i1 %6, label %12, label %62
12: ; preds = %10
%13 = tail call i32 @fgetc(i32* %0)
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %62, label %16
16: ; preds = %12
%17 = add i32 %11, 1
%18 = icmp eq i32 %13, 13
br i1 %18, label %10, label %19
19: ; preds = %16
%20 = icmp eq i32 %9, 0
br i1 %20, label %23, label %21
21: ; preds = %19
switch i32 %13, label %60 [
i32 32, label %22
i32 9, label %22
i32 10, label %25
]
22: ; preds = %21, %21
br label %7
23: ; preds = %19
%24 = icmp eq i32 %13, 10
br i1 %24, label %25, label %60
25: ; preds = %21, %23
%26 = icmp eq i32 %3, 0
br i1 %26, label %62, label %27
27: ; preds = %25
%28 = add nsw i32 %3, -1
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 92
br i1 %32, label %33, label %35
33: ; preds = %27
store i8 0, i8* %30
%34 = icmp eq i32 %28, 0
br i1 %34, label %53, label %35
35: ; preds = %27, %33
%36 = phi i32 [ %28, %33 ], [ %3, %27 ]
%37 = zext i32 %36 to i64
br label %38
38: ; preds = %35, %46
%39 = phi i64 [ %37, %35 ], [ %40, %46 ]
%40 = add nsw i64 %39, -1
%41 = and i64 %40, 4294967295
%42 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = tail call i64 @isspace(i8 signext %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %49, label %46
46: ; preds = %38
%47 = trunc i64 %40 to i32
store i8 0, i8* %42
%48 = icmp eq i32 %47, 0
br i1 %48, label %51, label %38
49: ; preds = %38
%50 = trunc i64 %39 to i32
br label %51
51: ; preds = %46, %49
%52 = phi i32 [ %50, %49 ], [ 0, %46 ]
br i1 %32, label %53, label %62
53: ; preds = %51, %33, %60
%54 = phi i32 [ %3, %60 ], [ %52, %51 ], [ 0, %33 ]
%55 = phi i8 [ %61, %60 ], [ 32, %51 ], [ 32, %33 ]
%56 = phi i32 [ 0, %60 ], [ 1, %51 ], [ 1, %33 ]
%57 = zext i32 %54 to i64
%58 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %57
store i8 %55, i8* %58
%59 = add i32 %54, 1
br label %2
60: ; preds = %21, %23
%61 = trunc i32 %13 to i8
br label %53
62: ; preds = %25, %51, %12, %10
%63 = phi i32 [ %3, %10 ], [ %3, %12 ], [ 0, %25 ], [ %52, %51 ]
%64 = phi i32 [ %11, %12 ], [ %4, %10 ], [ %17, %51 ], [ %17, %25 ]
%65 = icmp eq i32 %64, 0
br i1 %65, label %69, label %66
66: ; preds = %62
%67 = zext i32 %63 to i64
%68 = getelementptr inbounds [8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 %67
store i8 0, i8* %68
br label %69
69: ; preds = %62, %66
%70 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @parser_get_next_line.buffer, i64 0, i64 0), %66 ], [ null, %62 ]
ret i8* %70
}