#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*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ has_zero(unsigned int);
scalar_t__ has_zero64(unsigned long long);
int /*<<< orphan*/ memmove(char *, char *, int);
int read(int /*<<< orphan*/, char *, int);
const char *fgets2(FILE *stream) {
  static char buffer[(256 * 1024) + 68];
  static char *end = buffer;
  static char *line = buffer;
  char *next;
  int ret;
  next = line;
  while (1) {
    if (next <= end) {
      while ((((unsigned long)next) & 3) && *next != '\n')
        next++;
      if ((((unsigned long)next) & 4) &&
          !has_zero(*(unsigned int *)next ^ 0x0A0A0A0AU))
        next += 4;
    }
    while (next <= (end - 68)) {
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
      if (has_zero64(*(unsigned long long *)next ^ 0x0A0A0A0A0A0A0A0AULL))
        break;
      next += 8;
    }
    if (!has_zero(*(unsigned int *)next ^ 0x0A0A0A0AU))
      next += 4;
    while (next < end) {
      if (*next == '\n') {
        const char *start = line;
        *next = '\0';
        line = next + 1;
        return start;
      }
      next++;
    }
    if (line > buffer) {
      if (end != line)
        memmove(buffer, line, end - line);
      end = buffer + (end - line);
      next = end;
      line = buffer;
    } else {
      if (end == buffer + (256 * 1024))
        return NULL;
    }
    ret = read(fileno(stream), end, buffer + (256 * 1024) - end);
    if (ret <= 0) {
      if (end == line)
        return NULL;
      *end = '\0';
      end = line;
      return line;
    }
    end += ret;
    *end = '\n';
  }
}


x86 assembly (clang, -O0):
<fgets2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2eed(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    0x2ed6(%rip),%rax
ja     1202 <fgets2+0xb2>
jmp    117d <fgets2+0x2d>
mov    -0x18(%rbp),%rcx
and    $0x3,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     11a4 <fgets2+0x54>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11b4 <fgets2+0x64>
jmp    11c5 <fgets2+0x75>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    117d <fgets2+0x2d>
mov    -0x18(%rbp),%rax
and    $0x4,%rax
cmp    $0x0,%rax
je     11fd <fgets2+0xad>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
xor    $0xa0a0a0a,%edi
call   1050 <has_zero@plt>
cmp    $0x0,%eax
jne    11fd <fgets2+0xad>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    1202 <fgets2+0xb2>
jmp    1207 <fgets2+0xb7>
mov    -0x18(%rbp),%rax
mov    0x2e36(%rip),%rcx
add    $0xffffffffffffffbc,%rcx
cmp    %rcx,%rax
ja     13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     1244 <fgets2+0xf4>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     1275 <fgets2+0x125>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     12a6 <fgets2+0x156>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     12d7 <fgets2+0x187>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     1308 <fgets2+0x1b8>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     1339 <fgets2+0x1e9>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     136a <fgets2+0x21a>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movabs $0xa0a0a0a0a0a0a0a,%rdi
0a 0a 0a
xor    (%rax),%rdi
call   1070 <has_zero64@plt>
cmp    $0x0,%rax
je     139b <fgets2+0x24b>
jmp    13ac <fgets2+0x25c>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1207 <fgets2+0xb7>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
xor    $0xa0a0a0a,%edi
call   1050 <has_zero@plt>
cmp    $0x0,%eax
jne    13d2 <fgets2+0x282>
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    13d7 <fgets2+0x287>
mov    -0x18(%rbp),%rax
cmp    0x2c66(%rip),%rax
jae    1437 <fgets2+0x2e7>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1426 <fgets2+0x2d6>
mov    0x2c51(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,0x2c37(%rip)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    159d <fgets2+0x44d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    13d7 <fgets2+0x287>
lea    0x2c32(%rip),%rax
cmp    %rax,0x2c0b(%rip)
jbe    14c5 <fgets2+0x375>
mov    0x2bf6(%rip),%rax
cmp    0x2bf7(%rip),%rax
je     1485 <fgets2+0x335>
mov    0x2bea(%rip),%rsi
mov    0x2bdb(%rip),%rax
mov    0x2bdc(%rip),%rcx
sub    %rcx,%rax
mov    %eax,%edx
lea    0x2bf0(%rip),%rdi
call   1060 <memmove@plt>
mov    0x2bbc(%rip),%rcx
mov    0x2bbd(%rip),%rax
sub    %rax,%rcx
lea    0x2bd3(%rip),%rax
add    %rcx,%rax
mov    %rax,0x2ba1(%rip)
mov    0x2b9a(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0x2bb7(%rip),%rax
mov    %rax,0x2b90(%rip)
jmp    14f1 <fgets2+0x3a1>
lea    0x2ba4(%rip),%rax
add    $0x40000,%rax
cmp    %rax,0x2b6f(%rip)
jne    14ec <fgets2+0x39c>
movq   $0x0,-0x8(%rbp)
jmp    159d <fgets2+0x44d>
jmp    14f1 <fgets2+0x3a1>
mov    -0x10(%rbp),%rdi
call   1040 <fileno@plt>
mov    %eax,%edi
mov    0x2b45(%rip),%rsi
mov    0x2b3e(%rip),%rcx
lea    0x2b5f(%rip),%rax
add    $0x40000,%rax
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     1577 <fgets2+0x427>
mov    0x2b13(%rip),%rax
cmp    0x2b14(%rip),%rax
jne    154f <fgets2+0x3ff>
movq   $0x0,-0x8(%rbp)
jmp    159d <fgets2+0x44d>
mov    0x2af2(%rip),%rax
movb   $0x0,(%rax)
mov    0x2af0(%rip),%rax
mov    %rax,0x2ae1(%rip)
mov    0x2ae2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    159d <fgets2+0x44d>
mov    -0x1c(%rbp),%ecx
mov    0x2ac7(%rip),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,0x2aba(%rip)
mov    0x2ab3(%rip),%rax
movb   $0xa,(%rax)
jmp    1167 <fgets2+0x17>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
movabs $0xa0a0a0a0a0a0a0a,%rbx
0a 0a 0a
mov    0x2ee1(%rip),%r13
mov    0x2ed2(%rip),%rax
mov    $0xa0a0a0a,%ebp
lea    0x2eee(%rip),%r12
xor    %r14d,%r14d
cmp    %rax,%r13
ja     1217 <fgets2+0xc7>
test   $0x3,%r13b
je     11a0 <fgets2+0x50>
cmpb   $0xa,0x0(%r13)
jne    11b0 <fgets2+0x60>
mov    %r13,%rcx
jmp    11e0 <fgets2+0x90>
mov    %r13,%rcx
test   $0x4,%cl
jne    11e8 <fgets2+0x98>
jmp    1217 <fgets2+0xc7>
nopw   0x0(%rax,%rax,1)
lea    0x1(%r13),%rcx
test   $0x3,%cl
je     11e0 <fgets2+0x90>
cmpb   $0xa,(%rcx)
je     11e0 <fgets2+0x90>
lea    0x2(%r13),%rcx
test   $0x3,%cl
je     11e0 <fgets2+0x90>
cmpb   $0xa,(%rcx)
je     11e0 <fgets2+0x90>
lea    0x3(%r13),%rcx
test   $0x3,%cl
je     11e0 <fgets2+0x90>
cmpb   $0xa,(%rcx)
jne    1201 <fgets2+0xb1>
nopw   0x0(%rax,%rax,1)
mov    %rcx,%r13
test   $0x4,%cl
je     1217 <fgets2+0xc7>
mov    0x0(%r13),%edi
xor    %ebp,%edi
call   1050 <has_zero@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    0x0(%r13,%rcx,4),%r13
jmp    1210 <fgets2+0xc0>
add    $0x4,%r13
jmp    119b <fgets2+0x4b>
nopw   0x0(%rax,%rax,1)
mov    0x2e31(%rip),%rax
add    $0xffffffffffffffbc,%rax
cmp    %rax,%r13
ja     12f0 <fgets2+0x1a0>
mov    0x0(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12f0 <fgets2+0x1a0>
mov    0x8(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12b9 <fgets2+0x169>
mov    0x10(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12bf <fgets2+0x16f>
mov    0x18(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12c5 <fgets2+0x175>
mov    0x20(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12cb <fgets2+0x17b>
mov    0x28(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12d1 <fgets2+0x181>
mov    0x30(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12d7 <fgets2+0x187>
mov    0x38(%r13),%rdi
xor    %rbx,%rdi
call   1070 <has_zero64@plt>
test   %rax,%rax
jne    12dd <fgets2+0x18d>
add    $0x40,%r13
jmp    1210 <fgets2+0xc0>
add    $0x8,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x10,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x18,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x20,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x28,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x30,%r13
jmp    12f0 <fgets2+0x1a0>
add    $0x38,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
xor    %ebp,%edi
call   1050 <has_zero@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
lea    0x0(%r13,%rcx,4),%r13
mov    0x2d3a(%rip),%rdx
cmp    %rdx,%r13
jae    1337 <fgets2+0x1e7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0xa,0x0(%r13)
je     13e2 <fgets2+0x292>
add    $0x1,%r13
cmp    %rdx,%r13
jb     1320 <fgets2+0x1d0>
mov    %rdx,%r13
mov    0x2d12(%rip),%rsi
cmp    %r12,%rsi
jbe    1370 <fgets2+0x220>
cmp    %rsi,%rdx
je     1380 <fgets2+0x230>
sub    %esi,%edx
mov    %r12,%rdi
call   1060 <memmove@plt>
mov    0x2cef(%rip),%r13
mov    0x2cf0(%rip),%rdx
jmp    1383 <fgets2+0x233>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x42cf9(%rip),%rax
cmp    %rax,%rdx
jne    1397 <fgets2+0x247>
jmp    13f9 <fgets2+0x2a9>
xchg   %ax,%ax
mov    %rdx,%r13
sub    %rdx,%r13
add    %r12,%r13
mov    %r13,0x2cb8(%rip)
mov    %r12,0x2cb9(%rip)
mov    %r15,%rdi
call   1040 <fileno@plt>
mov    0x2ca2(%rip),%rsi
mov    %r12d,%edx
sub    %esi,%edx
add    $0x40000,%edx
mov    %eax,%edi
call   1030 <read@plt>
mov    0x2c89(%rip),%rcx
test   %eax,%eax
jle    140b <fgets2+0x2bb>
mov    %eax,%edx
lea    (%rcx,%rdx,1),%rax
mov    %rax,0x2c78(%rip)
movb   $0xa,(%rcx,%rdx,1)
cmp    %rax,%r13
jbe    118e <fgets2+0x3e>
jmp    1217 <fgets2+0xc7>
mov    0x2c67(%rip),%r14
movb   $0x0,0x0(%r13)
add    $0x1,%r13
mov    %r13,0x2c57(%rip)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c3e(%rip),%r14
cmp    %r14,%rcx
je     1423 <fgets2+0x2d3>
movb   $0x0,(%rcx)
mov    %r14,0x2c27(%rip)
jmp    13f9 <fgets2+0x2a9>
xor    %r14d,%r14d
jmp    13f9 <fgets2+0x2a9>

LLVM IR (-O0):
@fgets2.buffer = internal global [262212 x i8] zeroinitializer
@fgets2.end = internal global i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i32 0, i32 0)
@fgets2.line = internal global i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i32 0, i32 0)
define i8* @fgets2(i32* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %3
%7 = load i8*, i8** @fgets2.line
store i8* %7, i8** %4
br label %8
8: ; preds = %1, %209
%9 = load i8*, i8** %4
%10 = load i8*, i8** @fgets2.end
%11 = icmp ule i8* %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
br label %13
13: ; preds = %25, %12
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %14 to i64
%16 = and i64 %15, 3
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %13
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 10
br label %23
23: ; preds = %18, %13
%24 = phi i1 [ false, %13 ], [ %22, %18 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
br label %13
28: ; preds = %23
%29 = load i8*, i8** %4
%30 = ptrtoint i8* %29 to i64
%31 = and i64 %30, 4
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %43
33: ; preds = %28
%34 = load i8*, i8** %4
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %35
%37 = xor i32 %36, 168430090
%38 = call i32 @has_zero(i32 %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %33
%41 = load i8*, i8** %4
%42 = getelementptr inbounds i8, i8* %41, i64 4
store i8* %42, i8** %4
br label %43
43: ; preds = %40, %33, %28
br label %44
44: ; preds = %43, %8
br label %45
45: ; preds = %128, %44
%46 = load i8*, i8** %4
%47 = load i8*, i8** @fgets2.end
%48 = getelementptr inbounds i8, i8* %47, i64 -68
%49 = icmp ule i8* %46, %48
br i1 %49, label %50, label %131
50: ; preds = %45
%51 = load i8*, i8** %4
%52 = bitcast i8* %51 to i64*
%53 = load i64, i64* %52
%54 = xor i64 %53, 723401728380766730
%55 = call i64 @has_zero64(i64 %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %50
br label %131
58: ; preds = %50
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i64 8
store i8* %60, i8** %4
%61 = load i8*, i8** %4
%62 = bitcast i8* %61 to i64*
%63 = load i64, i64* %62
%64 = xor i64 %63, 723401728380766730
%65 = call i64 @has_zero64(i64 %64)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %68
67: ; preds = %58
br label %131
68: ; preds = %58
%69 = load i8*, i8** %4
%70 = getelementptr inbounds i8, i8* %69, i64 8
store i8* %70, i8** %4
%71 = load i8*, i8** %4
%72 = bitcast i8* %71 to i64*
%73 = load i64, i64* %72
%74 = xor i64 %73, 723401728380766730
%75 = call i64 @has_zero64(i64 %74)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %68
br label %131
78: ; preds = %68
%79 = load i8*, i8** %4
%80 = getelementptr inbounds i8, i8* %79, i64 8
store i8* %80, i8** %4
%81 = load i8*, i8** %4
%82 = bitcast i8* %81 to i64*
%83 = load i64, i64* %82
%84 = xor i64 %83, 723401728380766730
%85 = call i64 @has_zero64(i64 %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %78
br label %131
88: ; preds = %78
%89 = load i8*, i8** %4
%90 = getelementptr inbounds i8, i8* %89, i64 8
store i8* %90, i8** %4
%91 = load i8*, i8** %4
%92 = bitcast i8* %91 to i64*
%93 = load i64, i64* %92
%94 = xor i64 %93, 723401728380766730
%95 = call i64 @has_zero64(i64 %94)
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %98
97: ; preds = %88
br label %131
98: ; preds = %88
%99 = load i8*, i8** %4
%100 = getelementptr inbounds i8, i8* %99, i64 8
store i8* %100, i8** %4
%101 = load i8*, i8** %4
%102 = bitcast i8* %101 to i64*
%103 = load i64, i64* %102
%104 = xor i64 %103, 723401728380766730
%105 = call i64 @has_zero64(i64 %104)
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %108
107: ; preds = %98
br label %131
108: ; preds = %98
%109 = load i8*, i8** %4
%110 = getelementptr inbounds i8, i8* %109, i64 8
store i8* %110, i8** %4
%111 = load i8*, i8** %4
%112 = bitcast i8* %111 to i64*
%113 = load i64, i64* %112
%114 = xor i64 %113, 723401728380766730
%115 = call i64 @has_zero64(i64 %114)
%116 = icmp ne i64 %115, 0
br i1 %116, label %117, label %118
117: ; preds = %108
br label %131
118: ; preds = %108
%119 = load i8*, i8** %4
%120 = getelementptr inbounds i8, i8* %119, i64 8
store i8* %120, i8** %4
%121 = load i8*, i8** %4
%122 = bitcast i8* %121 to i64*
%123 = load i64, i64* %122
%124 = xor i64 %123, 723401728380766730
%125 = call i64 @has_zero64(i64 %124)
%126 = icmp ne i64 %125, 0
br i1 %126, label %127, label %128
127: ; preds = %118
br label %131
128: ; preds = %118
%129 = load i8*, i8** %4
%130 = getelementptr inbounds i8, i8* %129, i64 8
store i8* %130, i8** %4
br label %45
131: ; preds = %127, %117, %107, %97, %87, %77, %67, %57, %45
%132 = load i8*, i8** %4
%133 = bitcast i8* %132 to i32*
%134 = load i32, i32* %133
%135 = xor i32 %134, 168430090
%136 = call i32 @has_zero(i32 %135)
%137 = icmp ne i32 %136, 0
br i1 %137, label %141, label %138
138: ; preds = %131
%139 = load i8*, i8** %4
%140 = getelementptr inbounds i8, i8* %139, i64 4
store i8* %140, i8** %4
br label %141
141: ; preds = %138, %131
br label %142
142: ; preds = %157, %141
%143 = load i8*, i8** %4
%144 = load i8*, i8** @fgets2.end
%145 = icmp ult i8* %143, %144
br i1 %145, label %146, label %160
146: ; preds = %142
%147 = load i8*, i8** %4
%148 = load i8, i8* %147
%149 = sext i8 %148 to i32
%150 = icmp eq i32 %149, 10
br i1 %150, label %151, label %157
151: ; preds = %146
%152 = load i8*, i8** @fgets2.line
store i8* %152, i8** %6
%153 = load i8*, i8** %4
store i8 0, i8* %153
%154 = load i8*, i8** %4
%155 = getelementptr inbounds i8, i8* %154, i64 1
store i8* %155, i8** @fgets2.line
%156 = load i8*, i8** %6
store i8* %156, i8** %2
br label %215
157: ; preds = %146
%158 = load i8*, i8** %4
%159 = getelementptr inbounds i8, i8* %158, i32 1
store i8* %159, i8** %4
br label %142
160: ; preds = %142
%161 = load i8*, i8** @fgets2.line
%162 = icmp ugt i8* %161, getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0)
br i1 %162, label %163, label %184
163: ; preds = %160
%164 = load i8*, i8** @fgets2.end
%165 = load i8*, i8** @fgets2.line
%166 = icmp ne i8* %164, %165
br i1 %166, label %167, label %176
167: ; preds = %163
%168 = load i8*, i8** @fgets2.line
%169 = load i8*, i8** @fgets2.end
%170 = load i8*, i8** @fgets2.line
%171 = ptrtoint i8* %169 to i64
%172 = ptrtoint i8* %170 to i64
%173 = sub i64 %171, %172
%174 = trunc i64 %173 to i32
%175 = call i32 @memmove(i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0), i8* %168, i32 %174)
br label %176
176: ; preds = %167, %163
%177 = load i8*, i8** @fgets2.end
%178 = load i8*, i8** @fgets2.line
%179 = ptrtoint i8* %177 to i64
%180 = ptrtoint i8* %178 to i64
%181 = sub i64 %179, %180
%182 = getelementptr inbounds i8, i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0), i64 %181
store i8* %182, i8** @fgets2.end
%183 = load i8*, i8** @fgets2.end
store i8* %183, i8** %4
store i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0), i8** @fgets2.line
br label %189
184: ; preds = %160
%185 = load i8*, i8** @fgets2.end
%186 = icmp eq i8* %185, getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 262144)
br i1 %186, label %187, label %188
187: ; preds = %184
store i8* null, i8** %2
br label %215
188: ; preds = %184
br label %189
189: ; preds = %188, %176
%190 = load i32*, i32** %3
%191 = call i32 @fileno(i32* %190)
%192 = load i8*, i8** @fgets2.end
%193 = load i8*, i8** @fgets2.end
%194 = ptrtoint i8* %193 to i64
%195 = sub i64 ptrtoint (i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 262144) to i64), %194
%196 = trunc i64 %195 to i32
%197 = call i32 @read(i32 %191, i8* %192, i32 %196)
store i32 %197, i32* %5
%198 = load i32, i32* %5
%199 = icmp sle i32 %198, 0
br i1 %199, label %200, label %209
200: ; preds = %189
%201 = load i8*, i8** @fgets2.end
%202 = load i8*, i8** @fgets2.line
%203 = icmp eq i8* %201, %202
br i1 %203, label %204, label %205
204: ; preds = %200
store i8* null, i8** %2
br label %215
205: ; preds = %200
%206 = load i8*, i8** @fgets2.end
store i8 0, i8* %206
%207 = load i8*, i8** @fgets2.line
store i8* %207, i8** @fgets2.end
%208 = load i8*, i8** @fgets2.line
store i8* %208, i8** %2
br label %215
209: ; preds = %189
%210 = load i32, i32* %5
%211 = load i8*, i8** @fgets2.end
%212 = sext i32 %210 to i64
%213 = getelementptr inbounds i8, i8* %211, i64 %212
store i8* %213, i8** @fgets2.end
%214 = load i8*, i8** @fgets2.end
store i8 10, i8* %214
br label %8
215: ; preds = %205, %204, %187, %151
%216 = load i8*, i8** %2
ret i8* %216
}

LLVM IR (-O2):
@fgets2.buffer = internal global [262212 x i8] zeroinitializer
@fgets2.end = internal unnamed_addr global i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0)
@fgets2.line = internal unnamed_addr global i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0)
define i8* @fgets2(i32* nocapture %0) {
%2 = load i8*, i8** @fgets2.line
%3 = load i8*, i8** @fgets2.end
br label %4
4: ; preds = %189, %1
%5 = phi i8* [ %3, %1 ], [ %191, %189 ]
%6 = phi i8* [ %2, %1 ], [ %176, %189 ]
%7 = icmp ugt i8* %6, %5
br i1 %7, label %61, label %8
8: ; preds = %4
%9 = ptrtoint i8* %6 to i64
%10 = and i64 %9, 3
%11 = icmp eq i64 %10, 0
br i1 %11, label %47, label %12
12: ; preds = %8
%13 = load i8, i8* %6
%14 = icmp eq i8 %13, 10
br i1 %14, label %15, label %18
15: ; preds = %39, %31, %23, %12
%16 = phi i8* [ %6, %12 ], [ %19, %23 ], [ %27, %31 ], [ %35, %39 ]
%17 = ptrtoint i8* %16 to i64
br label %47
18: ; preds = %12
%19 = getelementptr inbounds i8, i8* %6, i64 1
%20 = ptrtoint i8* %19 to i64
%21 = and i64 %20, 3
%22 = icmp eq i64 %21, 0
br i1 %22, label %44, label %23
23: ; preds = %18
%24 = load i8, i8* %19
%25 = icmp eq i8 %24, 10
br i1 %25, label %15, label %26
26: ; preds = %23
%27 = getelementptr inbounds i8, i8* %6, i64 2
%28 = ptrtoint i8* %27 to i64
%29 = and i64 %28, 3
%30 = icmp eq i64 %29, 0
br i1 %30, label %44, label %31
31: ; preds = %26
%32 = load i8, i8* %27
%33 = icmp eq i8 %32, 10
br i1 %33, label %15, label %34
34: ; preds = %31
%35 = getelementptr inbounds i8, i8* %6, i64 3
%36 = ptrtoint i8* %35 to i64
%37 = and i64 %36, 3
%38 = icmp eq i64 %37, 0
br i1 %38, label %44, label %39
39: ; preds = %34
%40 = load i8, i8* %35
%41 = icmp eq i8 %40, 10
br i1 %41, label %15, label %42
42: ; preds = %39
%43 = getelementptr inbounds i8, i8* %6, i64 4
br label %44
44: ; preds = %42, %34, %26, %18
%45 = phi i8* [ %19, %18 ], [ %27, %26 ], [ %35, %34 ], [ %43, %42 ]
%46 = ptrtoint i8* %45 to i64
br label %47
47: ; preds = %44, %15, %8
%48 = phi i64 [ %9, %8 ], [ %17, %15 ], [ %46, %44 ]
%49 = phi i8* [ %6, %8 ], [ %16, %15 ], [ %45, %44 ]
%50 = and i64 %48, 4
%51 = icmp eq i64 %50, 0
br i1 %51, label %61, label %52
52: ; preds = %47
%53 = bitcast i8* %49 to i32*
%54 = load i32, i32* %53
%55 = xor i32 %54, 168430090
%56 = tail call i32 @has_zero(i32 %55)
%57 = icmp eq i32 %56, 0
%58 = select i1 %57, i64 4, i64 0
%59 = getelementptr i8, i8* %49, i64 %58
%60 = load i8*, i8** @fgets2.end
br label %61
61: ; preds = %52, %47, %4
%62 = phi i8* [ %5, %47 ], [ %5, %4 ], [ %60, %52 ]
%63 = phi i8* [ %49, %47 ], [ %6, %4 ], [ %59, %52 ]
%64 = getelementptr inbounds i8, i8* %62, i64 -68
%65 = icmp ugt i8* %63, %64
br i1 %65, label %127, label %66
66: ; preds = %61, %122
%67 = phi i8* [ %123, %122 ], [ %63, %61 ]
%68 = bitcast i8* %67 to i64*
%69 = load i64, i64* %68
%70 = xor i64 %69, 723401728380766730
%71 = tail call i64 @has_zero64(i64 %70)
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %127
73: ; preds = %66
%74 = getelementptr inbounds i8, i8* %67, i64 8
%75 = bitcast i8* %74 to i64*
%76 = load i64, i64* %75
%77 = xor i64 %76, 723401728380766730
%78 = tail call i64 @has_zero64(i64 %77)
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %127
80: ; preds = %73
%81 = getelementptr inbounds i8, i8* %67, i64 16
%82 = bitcast i8* %81 to i64*
%83 = load i64, i64* %82
%84 = xor i64 %83, 723401728380766730
%85 = tail call i64 @has_zero64(i64 %84)
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %127
87: ; preds = %80
%88 = getelementptr inbounds i8, i8* %67, i64 24
%89 = bitcast i8* %88 to i64*
%90 = load i64, i64* %89
%91 = xor i64 %90, 723401728380766730
%92 = tail call i64 @has_zero64(i64 %91)
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %127
94: ; preds = %87
%95 = getelementptr inbounds i8, i8* %67, i64 32
%96 = bitcast i8* %95 to i64*
%97 = load i64, i64* %96
%98 = xor i64 %97, 723401728380766730
%99 = tail call i64 @has_zero64(i64 %98)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %127
101: ; preds = %94
%102 = getelementptr inbounds i8, i8* %67, i64 40
%103 = bitcast i8* %102 to i64*
%104 = load i64, i64* %103
%105 = xor i64 %104, 723401728380766730
%106 = tail call i64 @has_zero64(i64 %105)
%107 = icmp eq i64 %106, 0
br i1 %107, label %108, label %127
108: ; preds = %101
%109 = getelementptr inbounds i8, i8* %67, i64 48
%110 = bitcast i8* %109 to i64*
%111 = load i64, i64* %110
%112 = xor i64 %111, 723401728380766730
%113 = tail call i64 @has_zero64(i64 %112)
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %127
115: ; preds = %108
%116 = getelementptr inbounds i8, i8* %67, i64 56
%117 = bitcast i8* %116 to i64*
%118 = load i64, i64* %117
%119 = xor i64 %118, 723401728380766730
%120 = tail call i64 @has_zero64(i64 %119)
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %127
122: ; preds = %115
%123 = getelementptr inbounds i8, i8* %67, i64 64
%124 = load i8*, i8** @fgets2.end
%125 = getelementptr inbounds i8, i8* %124, i64 -68
%126 = icmp ugt i8* %123, %125
br i1 %126, label %127, label %66
127: ; preds = %122, %66, %73, %80, %87, %94, %101, %108, %115, %61
%128 = phi i8* [ %63, %61 ], [ %116, %115 ], [ %109, %108 ], [ %102, %101 ], [ %95, %94 ], [ %88, %87 ], [ %81, %80 ], [ %74, %73 ], [ %67, %66 ], [ %123, %122 ]
%129 = bitcast i8* %128 to i32*
%130 = load i32, i32* %129
%131 = xor i32 %130, 168430090
%132 = tail call i32 @has_zero(i32 %131)
%133 = icmp eq i32 %132, 0
%134 = select i1 %133, i64 4, i64 0
%135 = getelementptr i8, i8* %128, i64 %134
%136 = load i8*, i8** @fgets2.end
%137 = ptrtoint i8* %136 to i64
%138 = icmp ult i8* %135, %136
br i1 %138, label %139, label %153
139: ; preds = %127
%140 = ptrtoint i8* %128 to i64
%141 = sub i64 %137, %140
%142 = getelementptr i8, i8* %128, i64 %141
br label %143
143: ; preds = %139, %150
%144 = phi i8* [ %151, %150 ], [ %135, %139 ]
%145 = load i8, i8* %144
%146 = icmp eq i8 %145, 10
br i1 %146, label %147, label %150
147: ; preds = %143
%148 = load i8*, i8** @fgets2.line
store i8 0, i8* %144
%149 = getelementptr inbounds i8, i8* %144, i64 1
store i8* %149, i8** @fgets2.line
br label %192
150: ; preds = %143
%151 = getelementptr inbounds i8, i8* %144, i64 1
%152 = icmp ult i8* %151, %136
br i1 %152, label %143, label %153
153: ; preds = %150, %127
%154 = phi i8* [ %135, %127 ], [ %142, %150 ]
%155 = load i8*, i8** @fgets2.line
%156 = icmp ugt i8* %155, getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0)
br i1 %156, label %157, label %173
157: ; preds = %153
%158 = icmp eq i8* %136, %155
br i1 %158, label %168, label %159
159: ; preds = %157
%160 = ptrtoint i8* %155 to i64
%161 = sub i64 %137, %160
%162 = trunc i64 %161 to i32
%163 = tail call i32 @memmove(i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0), i8* %155, i32 %162)
%164 = load i8*, i8** @fgets2.end
%165 = load i8*, i8** @fgets2.line
%166 = ptrtoint i8* %164 to i64
%167 = ptrtoint i8* %165 to i64
br label %168
168: ; preds = %159, %157
%169 = phi i64 [ %167, %159 ], [ %137, %157 ]
%170 = phi i64 [ %166, %159 ], [ %137, %157 ]
%171 = sub i64 %170, %169
%172 = getelementptr inbounds [262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 %171
store i8* %172, i8** @fgets2.end
store i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 0), i8** @fgets2.line
br label %175
173: ; preds = %153
%174 = icmp eq i8* %136, getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 262144)
br i1 %174, label %192, label %175
175: ; preds = %173, %168
%176 = phi i8* [ %172, %168 ], [ %154, %173 ]
%177 = tail call i32 @fileno(i32* %0)
%178 = load i8*, i8** @fgets2.end
%179 = ptrtoint i8* %178 to i64
%180 = trunc i64 %179 to i32
%181 = sub i32 ptrtoint (i8* getelementptr inbounds ([262212 x i8], [262212 x i8]* @fgets2.buffer, i64 0, i64 262144) to i32), %180
%182 = tail call i32 @read(i32 %177, i8* %178, i32 %181)
%183 = icmp slt i32 %182, 1
%184 = load i8*, i8** @fgets2.end
br i1 %183, label %185, label %189
185: ; preds = %175
%186 = load i8*, i8** @fgets2.line
%187 = icmp eq i8* %184, %186
br i1 %187, label %192, label %188
188: ; preds = %185
store i8 0, i8* %184
store i8* %186, i8** @fgets2.end
br label %192
189: ; preds = %175
%190 = zext i32 %182 to i64
%191 = getelementptr inbounds i8, i8* %184, i64 %190
store i8* %191, i8** @fgets2.end
store i8 10, i8* %191
br label %4
192: ; preds = %173, %185, %188, %147
%193 = phi i8* [ %148, %147 ], [ %186, %188 ], [ null, %185 ], [ null, %173 ]
ret i8* %193
}