int dgets(fd, buf, num)
int fd, num;
char *buf;
{
  static char dgbuf[8192];
  static char *head = dgbuf, *tail = dgbuf;
  register char *s, *t;
  register int n, nr;
  if (head == tail)
    *head = '\0';
  if (!num) {
    head = tail = dgbuf;
    *head = '\0';
    return 0;
  }
  if (num > sizeof(dgbuf) - 1)
    num = sizeof(dgbuf) - 1;
dgetsagain:
  if (head > dgbuf) {
    for (nr = tail - head, s = head, t = dgbuf; nr > 0; nr--)
      *t++ = *s++;
    tail = t;
    head = dgbuf;
  }
  if (head < tail && ((s = index(head, '\n')) || (s = index(head, '\r'))) &&
      s < tail) {
    n = ((s - head + 1) < (num) ? (s - head + 1) : (num));
  dgetsreturnbuf:
    bcopy(head, buf, n);
    head += n;
    if (head == tail)
      head = tail = dgbuf;
    return n;
  }
  if (tail - head >= num) {
    n = num;
    goto dgetsreturnbuf;
  }
  n = sizeof(dgbuf) - (tail - dgbuf) - 1;
  nr = read(fd, tail, n);
  if (nr == -1) {
    head = tail = dgbuf;
    return -1;
  }
  if (!nr) {
    if (head < tail) {
      n = ((tail - head) < (num) ? (tail - head) : (num));
      goto dgetsreturnbuf;
    }
    head = tail = dgbuf;
    return 0;
  }
  tail += nr;
  *tail = '\0';
  for (t = head; (s = index(t, '\n'));) {
    if ((s > head) && (s > dgbuf)) {
      t = s - 1;
      for (nr = 0; *t == '\\'; nr++)
        t--;
      if (nr & 1) {
        t = s + 1;
        s--;
        nr = tail - t;
        while (nr--)
          *s++ = *t++;
        tail -= 2;
        *tail = '\0';
      } else
        s++;
    } else
      s++;
    t = s;
  }
  *tail = '\0';
  goto dgetsagain;
}


x86 assembly (clang, -O0):
<dgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eef(%rip),%rax
cmp    0x2ef0(%rip),%rax
jne    1160 <dgets+0x30>
mov    0x2edb(%rip),%rax
movb   $0x0,(%rax)
cmpl   $0x0,-0x14(%rbp)
jne    119c <dgets+0x6c>
lea    0x2eef(%rip),%rax
mov    %rax,0x2ec8(%rip)
lea    0x2ee1(%rip),%rax
mov    %rax,0x2eb2(%rip)
mov    0x2eab(%rip),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    15f4 <dgets+0x4c4>
movslq -0x14(%rbp),%rax
cmp    $0x1fff,%rax
jbe    11b3 <dgets+0x83>
movl   $0x1fff,-0x14(%rbp)
jmp    11b8 <dgets+0x88>
lea    0x2ea1(%rip),%rax
cmp    %rax,0x2e72(%rip)
jbe    1249 <dgets+0x119>
mov    0x2e6d(%rip),%rax
mov    0x2e5e(%rip),%rcx
sub    %rcx,%rax
mov    %eax,-0x30(%rbp)
mov    0x2e51(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0x2e6e(%rip),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    1230 <dgets+0x100>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    11f6 <dgets+0xc6>
mov    -0x28(%rbp),%rax
mov    %rax,0x2e05(%rip)
lea    0x2e1e(%rip),%rax
mov    %rax,0x2def(%rip)
mov    0x2de8(%rip),%rax
cmp    0x2de9(%rip),%rax
jae    135c <dgets+0x22c>
mov    0x2dd4(%rip),%rdi
mov    $0xa,%esi
call   1030 <index@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    129b <dgets+0x16b>
mov    0x2db5(%rip),%rdi
mov    $0xd,%esi
call   1030 <index@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     135c <dgets+0x22c>
mov    -0x20(%rbp),%rax
cmp    0x2d9a(%rip),%rax
jae    135c <dgets+0x22c>
mov    -0x20(%rbp),%rax
mov    0x2d81(%rip),%rcx
sub    %rcx,%rax
add    $0x1,%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jge    12e6 <dgets+0x1b6>
mov    -0x20(%rbp),%rax
mov    0x2d62(%rip),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    12ee <dgets+0x1be>
movslq -0x14(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %eax,-0x2c(%rbp)
mov    0x2d3c(%rip),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    $0x0,%al
call   1050 <bcopy@plt>
mov    -0x2c(%rbp),%ecx
mov    0x2d24(%rip),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,0x2d17(%rip)
mov    0x2d10(%rip),%rax
cmp    0x2d11(%rip),%rax
jne    1351 <dgets+0x221>
lea    0x2d24(%rip),%rax
mov    %rax,0x2cfd(%rip)
lea    0x2d16(%rip),%rax
mov    %rax,0x2ce7(%rip)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    15f4 <dgets+0x4c4>
mov    0x2cdd(%rip),%rax
mov    0x2cce(%rip),%rcx
sub    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jl     1385 <dgets+0x255>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
jmp    12f5 <dgets+0x1c5>
mov    0x2cb4(%rip),%rcx
lea    0x2ccd(%rip),%rax
sub    %rax,%rcx
mov    $0x2000,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2c91(%rip),%rsi
mov    -0x2c(%rbp),%edx
mov    $0x0,%al
call   1040 <read@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    13ee <dgets+0x2be>
lea    0x2c93(%rip),%rax
mov    %rax,0x2c6c(%rip)
lea    0x2c85(%rip),%rax
mov    %rax,0x2c56(%rip)
movl   $0xffffffff,-0x4(%rbp)
jmp    15f4 <dgets+0x4c4>
cmpl   $0x0,-0x30(%rbp)
jne    1480 <dgets+0x350>
mov    0x2c39(%rip),%rax
cmp    0x2c3a(%rip),%rax
jae    1458 <dgets+0x328>
mov    0x2c2d(%rip),%rax
mov    0x2c1e(%rip),%rcx
sub    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
jge    1444 <dgets+0x314>
mov    0x2c0f(%rip),%rax
mov    0x2c00(%rip),%rcx
sub    %rcx,%rax
mov    %rax,-0x40(%rbp)
jmp    144c <dgets+0x31c>
movslq -0x14(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %eax,-0x2c(%rbp)
jmp    12f5 <dgets+0x1c5>
lea    0x2c01(%rip),%rax
mov    %rax,0x2bda(%rip)
lea    0x2bf3(%rip),%rax
mov    %rax,0x2bc4(%rip)
movl   $0x0,-0x4(%rbp)
jmp    15f4 <dgets+0x4c4>
mov    -0x30(%rbp),%ecx
mov    0x2bb6(%rip),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,0x2ba9(%rip)
mov    0x2ba2(%rip),%rax
movb   $0x0,(%rax)
mov    0x2b90(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0xa,%esi
call   1030 <index@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     15e5 <dgets+0x4b5>
mov    -0x20(%rbp),%rax
cmp    0x2b65(%rip),%rax
jbe    15cc <dgets+0x49c>
lea    0x2b80(%rip),%rax
cmp    %rax,-0x20(%rbp)
jbe    15cc <dgets+0x49c>
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1527 <dgets+0x3f7>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    14fd <dgets+0x3cd>
mov    -0x30(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     15bb <dgets+0x48b>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    0x2aeb(%rip),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x30(%rbp)
cmp    $0x0,%eax
je     159a <dgets+0x46a>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    155f <dgets+0x42f>
mov    0x2a9f(%rip),%rax
add    $0xfffffffffffffffe,%rax
mov    %rax,0x2a94(%rip)
mov    0x2a8d(%rip),%rax
movb   $0x0,(%rax)
jmp    15c7 <dgets+0x497>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    15d8 <dgets+0x4a8>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    14ac <dgets+0x37c>
mov    0x2a54(%rip),%rax
movb   $0x0,(%rax)
jmp    11b8 <dgets+0x88>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgets>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %edi,%r15d
mov    0x2ee8(%rip),%rdi
mov    0x2ee9(%rip),%rsi
cmp    %rsi,%rdi
je     1440 <dgets+0x300>
test   %edx,%edx
je     144b <dgets+0x30b>
mov    %rax,(%rsp)
cmp    $0x1fff,%edx
mov    $0x1fff,%r12d
cmovb  %edx,%r12d
lea    0x2ed5(%rip),%r13
jmp    11a1 <dgets+0x61>
nopl   (%rax)
mov    0x2eb1(%rip),%rsi
movb   $0x0,(%rsi)
mov    0x2e9f(%rip),%rdi
cmp    %r13,%rdi
jbe    1219 <dgets+0xd9>
mov    %esi,%eax
sub    %edi,%eax
mov    %r13,%rcx
test   %eax,%eax
jle    1205 <dgets+0xc5>
mov    %edi,%eax
not    %eax
add    %eax,%esi
cmp    $0x1f,%esi
jb     11de <dgets+0x9e>
lea    (%rdi,%rsi,1),%rax
add    $0x1,%rax
cmp    %r13,%rax
jbe    134f <dgets+0x20f>
lea    (%rsi,%r13,1),%rax
add    $0x1,%rax
cmp    %rax,%rdi
jae    134f <dgets+0x20f>
mov    %r13,%rcx
lea    (%rsi,%r13,1),%rax
mov    %rcx,%rdx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi),%ebx
add    $0x1,%rdi
lea    0x1(%rdx),%rcx
mov    %bl,(%rdx)
cmp    %rax,%rdx
mov    %rcx,%rdx
jne    11f0 <dgets+0xb0>
mov    %rcx,0x2e3c(%rip)
mov    %r13,0x2e2d(%rip)
mov    %rcx,%rsi
mov    %r13,%rdi
cmp    %rsi,%rdi
jae    1257 <dgets+0x117>
mov    $0xa,%esi
call   1030 <index@plt>
test   %rax,%rax
jne    1247 <dgets+0x107>
mov    0x2e0c(%rip),%rdi
mov    $0xd,%esi
call   1030 <index@plt>
test   %rax,%rax
je     1378 <dgets+0x238>
mov    0x2dfa(%rip),%rsi
cmp    %rsi,%rax
jb     14a8 <dgets+0x368>
mov    0x2de2(%rip),%rdi
mov    %rsi,%rax
sub    %rdi,%rax
cmp    %r12,%rax
jge    14c0 <dgets+0x380>
mov    %r13d,%edx
sub    %esi,%edx
add    $0x1fff,%edx
mov    %r15d,%edi
xor    %eax,%eax
call   1040 <read@plt>
test   %eax,%eax
je     146f <dgets+0x32f>
cmp    $0xffffffff,%eax
je     148b <dgets+0x34b>
mov    0x2dae(%rip),%rcx
cltq
lea    (%rcx,%rax,1),%rdx
mov    %rdx,0x2da1(%rip)
movb   $0x0,(%rcx,%rax,1)
mov    0x2d8e(%rip),%rdi
mov    $0xa,%esi
call   1030 <index@plt>
test   %rax,%rax
je     1190 <dgets+0x50>
mov    %rax,%rbp
jmp    12f0 <dgets+0x1b0>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    %rbp,%rsi
mov    %rsi,%rdi
mov    $0xa,%esi
call   1030 <index@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1190 <dgets+0x50>
cmp    %r13,%rbp
jbe    12d0 <dgets+0x190>
cmp    0x2d44(%rip),%rbp
jbe    12d0 <dgets+0x190>
xor    %eax,%eax
cmpb   $0x5c,-0x1(%rbp,%rax,1)
lea    -0x1(%rax),%rax
je     1300 <dgets+0x1c0>
not    %eax
lea    0x1(%rbp),%rsi
test   $0x1,%al
je     12d7 <dgets+0x197>
lea    -0x1(%rbp),%rdi
mov    0x2d28(%rip),%rbx
cmp    %esi,%ebx
je     133b <dgets+0x1fb>
mov    %esi,%eax
not    %eax
lea    (%rbx,%rax,1),%r14d
lea    0x1(%r14),%rdx
call   1060 <memmove@plt>
add    %r14,%rbp
mov    %rbp,%rdi
lea    -0x2(%rbx),%rax
mov    %rax,0x2d02(%rip)
movb   $0x0,-0x2(%rbx)
mov    %rdi,%rsi
jmp    12d7 <dgets+0x197>
lea    0x1(%rsi),%r8
mov    %r8,%rax
and    $0xffffffffffffffe0,%rax
lea    -0x20(%rax),%rcx
mov    %rcx,%rdx
shr    $0x5,%rdx
add    $0x1,%rdx
mov    %edx,%ebp
and    $0x3,%ebp
cmp    $0x60,%rcx
jae    1384 <dgets+0x244>
xor    %ecx,%ecx
jmp    13f0 <dgets+0x2b0>
mov    0x2cc9(%rip),%rsi
jmp    1257 <dgets+0x117>
and    $0xfffffffffffffffc,%rdx
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movups (%rdi,%rcx,1),%xmm0
movups 0x10(%rdi,%rcx,1),%xmm1
movaps %xmm0,(%rcx,%r13,1)
movaps %xmm1,0x10(%rcx,%r13,1)
movups 0x20(%rdi,%rcx,1),%xmm0
movups 0x30(%rdi,%rcx,1),%xmm1
movaps %xmm0,0x20(%rcx,%r13,1)
movaps %xmm1,0x30(%rcx,%r13,1)
movups 0x40(%rdi,%rcx,1),%xmm0
movups 0x50(%rdi,%rcx,1),%xmm1
movaps %xmm0,0x40(%rcx,%r13,1)
movaps %xmm1,0x50(%rcx,%r13,1)
movups 0x60(%rdi,%rcx,1),%xmm0
movups 0x70(%rdi,%rcx,1),%xmm1
movaps %xmm0,0x60(%rcx,%r13,1)
movaps %xmm1,0x70(%rcx,%r13,1)
sub    $0xffffffffffffff80,%rcx
add    $0xfffffffffffffffc,%rdx
jne    1390 <dgets+0x250>
test   %rbp,%rbp
je     142b <dgets+0x2eb>
lea    (%rdi,%rcx,1),%rdx
add    $0x10,%rdx
add    %r13,%rcx
add    $0x10,%rcx
shl    $0x5,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movups -0x10(%rdx,%rbx,1),%xmm0
movups (%rdx,%rbx,1),%xmm1
movaps %xmm0,-0x10(%rcx,%rbx,1)
movaps %xmm1,(%rcx,%rbx,1)
add    $0x20,%rbx
cmp    %rbx,%rbp
jne    1410 <dgets+0x2d0>
lea    (%rax,%r13,1),%rcx
cmp    %rax,%r8
je     1205 <dgets+0xc5>
add    %rax,%rdi
jmp    11e1 <dgets+0xa1>
movb   $0x0,(%rdi)
test   %edx,%edx
jne    1170 <dgets+0x30>
lea    0x2c0e(%rip),%rax
mov    %rax,0x2bef(%rip)
mov    %rax,0x2be0(%rip)
movb   $0x0,0x2bf9(%rip)
xor    %r12d,%r12d
jmp    14fd <dgets+0x3bd>
mov    0x2bca(%rip),%rdi
mov    0x2bcb(%rip),%rax
cmp    %rax,%rdi
jae    150f <dgets+0x3cf>
sub    %rdi,%rax
jmp    14b6 <dgets+0x376>
lea    0x2bce(%rip),%rax
mov    %rax,0x2baf(%rip)
mov    %rax,0x2ba0(%rip)
mov    $0xffffffff,%r12d
jmp    14fd <dgets+0x3bd>
mov    0x2b91(%rip),%rdi
sub    %rdi,%rax
add    $0x1,%rax
cmp    %r12,%rax
cmovge %r12d,%eax
mov    %eax,%r12d
mov    (%rsp),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <bcopy@plt>
movslq %r12d,%rax
add    0x2b68(%rip),%rax
mov    %rax,0x2b61(%rip)
cmp    0x2b62(%rip),%rax
jne    14fd <dgets+0x3bd>
lea    0x2b71(%rip),%rax
mov    %rax,0x2b52(%rip)
mov    %rax,0x2b43(%rip)
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x2b4a(%rip),%rax
mov    %rax,0x2b2b(%rip)
mov    %rax,0x2b1c(%rip)
jmp    1467 <dgets+0x327>

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

LLVM IR (-O2):
@dgets.dgbuf = internal global [8192 x i8] zeroinitializer
@dgets.head = internal unnamed_addr global i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
@dgets.tail = internal unnamed_addr global i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
define i32 @dgets(i32 %0, i8* %1, i32 %2) {
%4 = load i8*, i8** @dgets.head
%5 = load i8*, i8** @dgets.tail
%6 = icmp eq i8* %4, %5
br i1 %6, label %7, label %8
7: ; preds = %3
store i8 0, i8* %4
br label %8
8: ; preds = %7, %3
%9 = icmp eq i32 %2, 0
br i1 %9, label %10, label %11
10: ; preds = %8
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.tail
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.head
store i8 0, i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
br label %242
11: ; preds = %8
%12 = icmp ult i32 %2, 8191
%13 = select i1 %12, i32 %2, i32 8191
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %239, %11
%16 = phi i8* [ %240, %239 ], [ %5, %11 ]
%17 = phi i8* [ %241, %239 ], [ %4, %11 ]
%18 = icmp ugt i8* %17, getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
br i1 %18, label %19, label %132
19: ; preds = %15
%20 = ptrtoint i8* %16 to i64
%21 = ptrtoint i8* %17 to i64
%22 = sub i64 %20, %21
%23 = trunc i64 %22 to i32
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %130
25: ; preds = %19
%26 = xor i64 %21, -1
%27 = add i64 %26, %20
%28 = and i64 %27, 4294967295
%29 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %28
%30 = add nuw nsw i64 %28, 1
%31 = icmp ult i64 %28, 31
br i1 %31, label %120, label %32
32: ; preds = %25
%33 = getelementptr i8, i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 1), i64 %28
%34 = getelementptr i8, i8* %17, i64 1
%35 = getelementptr i8, i8* %34, i64 %28
%36 = icmp ugt i8* %35, getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
%37 = icmp ult i8* %17, %33
%38 = and i1 %36, %37
br i1 %38, label %120, label %39
39: ; preds = %32
%40 = and i64 %30, 8589934560
%41 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %40
%42 = getelementptr i8, i8* %17, i64 %40
%43 = add nsw i64 %40, -32
%44 = lshr exact i64 %43, 5
%45 = add nuw nsw i64 %44, 1
%46 = and i64 %45, 3
%47 = icmp ult i64 %43, 96
br i1 %47, label %99, label %48
48: ; preds = %39
%49 = and i64 %45, 1152921504606846972
br label %50
50: ; preds = %50, %48
%51 = phi i64 [ 0, %48 ], [ %96, %50 ]
%52 = phi i64 [ 0, %48 ], [ %97, %50 ]
%53 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %51
%54 = getelementptr i8, i8* %17, i64 %51
%55 = bitcast i8* %54 to <16 x i8>*
%56 = load <16 x i8>, <16 x i8>* %55
%57 = getelementptr i8, i8* %54, i64 16
%58 = bitcast i8* %57 to <16 x i8>*
%59 = load <16 x i8>, <16 x i8>* %58
%60 = bitcast i8* %53 to <16 x i8>*
store <16 x i8> %56, <16 x i8>* %60
%61 = getelementptr i8, i8* %53, i64 16
%62 = bitcast i8* %61 to <16 x i8>*
store <16 x i8> %59, <16 x i8>* %62
%63 = or i64 %51, 32
%64 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %63
%65 = getelementptr i8, i8* %17, i64 %63
%66 = bitcast i8* %65 to <16 x i8>*
%67 = load <16 x i8>, <16 x i8>* %66
%68 = getelementptr i8, i8* %65, i64 16
%69 = bitcast i8* %68 to <16 x i8>*
%70 = load <16 x i8>, <16 x i8>* %69
%71 = bitcast i8* %64 to <16 x i8>*
store <16 x i8> %67, <16 x i8>* %71
%72 = getelementptr i8, i8* %64, i64 16
%73 = bitcast i8* %72 to <16 x i8>*
store <16 x i8> %70, <16 x i8>* %73
%74 = or i64 %51, 64
%75 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %74
%76 = getelementptr i8, i8* %17, i64 %74
%77 = bitcast i8* %76 to <16 x i8>*
%78 = load <16 x i8>, <16 x i8>* %77
%79 = getelementptr i8, i8* %76, i64 16
%80 = bitcast i8* %79 to <16 x i8>*
%81 = load <16 x i8>, <16 x i8>* %80
%82 = bitcast i8* %75 to <16 x i8>*
store <16 x i8> %78, <16 x i8>* %82
%83 = getelementptr i8, i8* %75, i64 16
%84 = bitcast i8* %83 to <16 x i8>*
store <16 x i8> %81, <16 x i8>* %84
%85 = or i64 %51, 96
%86 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %85
%87 = getelementptr i8, i8* %17, i64 %85
%88 = bitcast i8* %87 to <16 x i8>*
%89 = load <16 x i8>, <16 x i8>* %88
%90 = getelementptr i8, i8* %87, i64 16
%91 = bitcast i8* %90 to <16 x i8>*
%92 = load <16 x i8>, <16 x i8>* %91
%93 = bitcast i8* %86 to <16 x i8>*
store <16 x i8> %89, <16 x i8>* %93
%94 = getelementptr i8, i8* %86, i64 16
%95 = bitcast i8* %94 to <16 x i8>*
store <16 x i8> %92, <16 x i8>* %95
%96 = add nuw i64 %51, 128
%97 = add i64 %52, 4
%98 = icmp eq i64 %97, %49
br i1 %98, label %99, label %50
99: ; preds = %50, %39
%100 = phi i64 [ 0, %39 ], [ %96, %50 ]
%101 = icmp eq i64 %46, 0
br i1 %101, label %118, label %102
102: ; preds = %99, %102
%103 = phi i64 [ %115, %102 ], [ %100, %99 ]
%104 = phi i64 [ %116, %102 ], [ 0, %99 ]
%105 = getelementptr [8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 %103
%106 = getelementptr i8, i8* %17, i64 %103
%107 = bitcast i8* %106 to <16 x i8>*
%108 = load <16 x i8>, <16 x i8>* %107
%109 = getelementptr i8, i8* %106, i64 16
%110 = bitcast i8* %109 to <16 x i8>*
%111 = load <16 x i8>, <16 x i8>* %110
%112 = bitcast i8* %105 to <16 x i8>*
store <16 x i8> %108, <16 x i8>* %112
%113 = getelementptr i8, i8* %105, i64 16
%114 = bitcast i8* %113 to <16 x i8>*
store <16 x i8> %111, <16 x i8>* %114
%115 = add nuw i64 %103, 32
%116 = add i64 %104, 1
%117 = icmp eq i64 %116, %46
br i1 %117, label %118, label %102
118: ; preds = %102, %99
%119 = icmp eq i64 %30, %40
br i1 %119, label %130, label %120
120: ; preds = %32, %25, %118
%121 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), %32 ], [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), %25 ], [ %41, %118 ]
%122 = phi i8* [ %17, %32 ], [ %17, %25 ], [ %42, %118 ]
br label %123
123: ; preds = %120, %123
%124 = phi i8* [ %128, %123 ], [ %121, %120 ]
%125 = phi i8* [ %126, %123 ], [ %122, %120 ]
%126 = getelementptr inbounds i8, i8* %125, i64 1
%127 = load i8, i8* %125
%128 = getelementptr inbounds i8, i8* %124, i64 1
store i8 %127, i8* %124
%129 = icmp eq i8* %124, %29
br i1 %129, label %130, label %123
130: ; preds = %123, %118, %19
%131 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), %19 ], [ %41, %118 ], [ %128, %123 ]
store i8* %131, i8** @dgets.tail
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.head
br label %132
132: ; preds = %130, %15
%133 = phi i8* [ %131, %130 ], [ %16, %15 ]
%134 = phi i8* [ getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), %130 ], [ %17, %15 ]
%135 = icmp ult i8* %134, %133
br i1 %135, label %136, label %168
136: ; preds = %132
%137 = tail call i8* @index(i8* %134, i32 10)
%138 = icmp eq i8* %137, null
br i1 %138, label %139, label %145
139: ; preds = %136
%140 = load i8*, i8** @dgets.head
%141 = tail call i8* @index(i8* %140, i32 13)
%142 = icmp eq i8* %141, null
br i1 %142, label %143, label %145
143: ; preds = %139
%144 = load i8*, i8** @dgets.tail
br label %168
145: ; preds = %139, %136
%146 = phi i8* [ %137, %136 ], [ %141, %139 ]
%147 = load i8*, i8** @dgets.tail
%148 = icmp ult i8* %146, %147
br i1 %148, label %149, label %168
149: ; preds = %145
%150 = load i8*, i8** @dgets.head
%151 = ptrtoint i8* %146 to i64
%152 = ptrtoint i8* %150 to i64
%153 = sub i64 %151, %152
%154 = add nsw i64 %153, 1
%155 = icmp slt i64 %154, %14
%156 = select i1 %155, i64 %154, i64 %14
%157 = trunc i64 %156 to i32
br label %158
158: ; preds = %168, %184, %149
%159 = phi i8* [ %150, %149 ], [ %181, %184 ], [ %170, %168 ]
%160 = phi i32 [ %157, %149 ], [ %190, %184 ], [ %13, %168 ]
%161 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %159, i8* %1, i32 %160)
%162 = load i8*, i8** @dgets.head
%163 = sext i32 %160 to i64
%164 = getelementptr inbounds i8, i8* %162, i64 %163
store i8* %164, i8** @dgets.head
%165 = load i8*, i8** @dgets.tail
%166 = icmp eq i8* %164, %165
br i1 %166, label %167, label %242
167: ; preds = %158
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.tail
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.head
br label %242
168: ; preds = %143, %145, %132
%169 = phi i8* [ %144, %143 ], [ %147, %145 ], [ %133, %132 ]
%170 = load i8*, i8** @dgets.head
%171 = ptrtoint i8* %169 to i64
%172 = ptrtoint i8* %170 to i64
%173 = sub i64 %171, %172
%174 = icmp slt i64 %173, %14
br i1 %174, label %175, label %158
175: ; preds = %168
%176 = trunc i64 %171 to i32
%177 = sub i32 trunc (i64 add (i64 ptrtoint ([8192 x i8]* @dgets.dgbuf to i64), i64 8191) to i32), %176
%178 = tail call i32 (i32, i8*, i32, ...) bitcast (i32 (...)* @read to i32 (i32, i8*, i32, ...)*)(i32 %0, i8* %169, i32 %177)
switch i32 %178, label %192 [
i32 -1, label %179
i32 0, label %180
]
179: ; preds = %175
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.tail
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.head
br label %242
180: ; preds = %175
%181 = load i8*, i8** @dgets.head
%182 = load i8*, i8** @dgets.tail
%183 = icmp ult i8* %181, %182
br i1 %183, label %184, label %191
184: ; preds = %180
%185 = ptrtoint i8* %182 to i64
%186 = ptrtoint i8* %181 to i64
%187 = sub i64 %185, %186
%188 = icmp slt i64 %187, %14
%189 = select i1 %188, i64 %187, i64 %14
%190 = trunc i64 %189 to i32
br label %158
191: ; preds = %180
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.tail
store i8* getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0), i8** @dgets.head
br label %242
192: ; preds = %175
%193 = load i8*, i8** @dgets.tail
%194 = sext i32 %178 to i64
%195 = getelementptr inbounds i8, i8* %193, i64 %194
store i8* %195, i8** @dgets.tail
store i8 0, i8* %195
%196 = load i8*, i8** @dgets.head
%197 = tail call i8* @index(i8* %196, i32 10)
%198 = icmp eq i8* %197, null
br i1 %198, label %239, label %199
199: ; preds = %192, %235
%200 = phi i8* [ %237, %235 ], [ %197, %192 ]
%201 = load i8*, i8** @dgets.head
%202 = icmp ugt i8* %200, %201
%203 = icmp ugt i8* %200, getelementptr inbounds ([8192 x i8], [8192 x i8]* @dgets.dgbuf, i64 0, i64 0)
%204 = and i1 %203, %202
br i1 %204, label %205, label %233
205: ; preds = %199, %205
%206 = phi i8* [ %208, %205 ], [ %200, %199 ]
%207 = phi i32 [ %211, %205 ], [ 0, %199 ]
%208 = getelementptr inbounds i8, i8* %206, i64 -1
%209 = load i8, i8* %208
%210 = icmp eq i8 %209, 92
%211 = add nuw nsw i32 %207, 1
br i1 %210, label %205, label %212
212: ; preds = %205
%213 = and i32 %207, 1
%214 = icmp eq i32 %213, 0
%215 = getelementptr i8, i8* %200, i64 1
br i1 %214, label %235, label %216
216: ; preds = %212
%217 = getelementptr i8, i8* %200, i64 -1
%218 = load i8*, i8** @dgets.tail
%219 = ptrtoint i8* %218 to i64
%220 = ptrtoint i8* %215 to i64
%221 = sub i64 %219, %220
%222 = trunc i64 %221 to i32
%223 = icmp eq i32 %222, 0
br i1 %223, label %230, label %224
224: ; preds = %216
%225 = xor i64 %220, -1
%226 = add i64 %225, %219
%227 = and i64 %226, 4294967295
%228 = add nuw nsw i64 %227, 1
%229 = getelementptr i8, i8* %200, i64 %227
br label %230
230: ; preds = %224, %216
%231 = phi i8* [ %217, %216 ], [ %229, %224 ]
%232 = getelementptr inbounds i8, i8* %218, i64 -2
store i8* %232, i8** @dgets.tail
store i8 0, i8* %232
br label %235
233: ; preds = %199
%234 = getelementptr inbounds i8, i8* %200, i64 1
br label %235
235: ; preds = %212, %230, %233
%236 = phi i8* [ %231, %230 ], [ %234, %233 ], [ %215, %212 ]
%237 = tail call i8* @index(i8* %236, i32 10)
%238 = icmp eq i8* %237, null
br i1 %238, label %239, label %199
239: ; preds = %235, %192
%240 = load i8*, i8** @dgets.tail
store i8 0, i8* %240
%241 = load i8*, i8** @dgets.head
br label %15
242: ; preds = %158, %167, %191, %179, %10
%243 = phi i32 [ -1, %179 ], [ 0, %191 ], [ 0, %10 ], [ %160, %167 ], [ %160, %158 ]
ret i32 %243
}