#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 scalar_t__ ssize_t;
typedef int j;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ EINTR;
scalar_t__ EPIPE;
scalar_t__ EWOULDBLOCK;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
scalar_t__ write(int, unsigned char *, size_t);
ssize_t gen_data(char *name, int fd, size_t len, size_t *offset, int nonblock,
                 int epipe_ok) {
  unsigned char buffer[65536];
  ssize_t total = 0;
  int would_block = 0;
  ssize_t to_send = len - *offset;
  while (*offset < len) {
    size_t l = (len - *offset < 65536) ? len - *offset : 65536;
    size_t written = 0;
    size_t i, j;
    for (i = 0, j = *offset; i < l; i++, j++)
      buffer[i] = (((j) >> ((((j)&3) << 3) + 2)) & 0xff);
    while (written < l) {
      ssize_t bytes;
      do {
        bytes = write(fd, buffer + written, l - written);
      } while (bytes < 0 &&
               (EINTR == errno ||
                (!nonblock && (EAGAIN == errno || EWOULDBLOCK == errno))));
      if (bytes < 0) {
        if (nonblock && (EAGAIN == errno || EWOULDBLOCK == errno)) {
          would_block = 1;
          break;
        }
        if (EPIPE == errno && epipe_ok) {
          *offset = len;
          return to_send;
        }
        fprintf(stderr, "Couldn't write to %s : %s\n", name, strerror(errno));
        return -1;
      }
      written += bytes;
    }
    total += written;
    *offset += written;
    if (would_block)
      break;
  }
  return total;
}


x86 assembly (clang, -O0):
<gen_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10090,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
movq   $0x0,-0x10038(%rbp)
movl   $0x0,-0x1003c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x10048(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
cmp    -0x20(%rbp),%rax
jae    14b2 <gen_data+0x382>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    (%rcx),%rax
cmp    $0x10000,%rax
jae    11b8 <gen_data+0x88>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    (%rcx),%rax
mov    %rax,-0x10078(%rbp)
jmp    11c9 <gen_data+0x99>
mov    $0x10000,%eax
mov    %rax,-0x10078(%rbp)
jmp    11c9 <gen_data+0x99>
mov    -0x10078(%rbp),%rax
mov    %rax,-0x10050(%rbp)
movq   $0x0,-0x10058(%rbp)
movq   $0x0,-0x10060(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10068(%rbp)
mov    -0x10060(%rbp),%rax
cmp    -0x10050(%rbp),%rax
jae    126b <gen_data+0x13b>
mov    -0x10068(%rbp),%rax
mov    -0x10068(%rbp),%rcx
and    $0x3,%rcx
shl    $0x3,%rcx
add    $0x2,%rcx
shr    %cl,%rax
and    $0xff,%rax
mov    %al,%cl
mov    -0x10060(%rbp),%rax
mov    %cl,-0x10030(%rbp,%rax,1)
mov    -0x10060(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10060(%rbp)
mov    -0x10068(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10068(%rbp)
jmp    11fb <gen_data+0xcb>
jmp    1270 <gen_data+0x140>
mov    -0x10058(%rbp),%rax
cmp    -0x10050(%rbp),%rax
jae    1475 <gen_data+0x345>
jmp    1289 <gen_data+0x159>
mov    -0x14(%rbp),%edi
lea    -0x10030(%rbp),%rsi
add    -0x10058(%rbp),%rsi
mov    -0x10050(%rbp),%rdx
sub    -0x10058(%rbp),%rdx
call   1030 <write@plt>
mov    %rax,-0x10070(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10070(%rbp)
mov    %al,-0x10079(%rbp)
jge    1361 <gen_data+0x231>
mov    0x2cef(%rip),%rax
mov    (%rax),%rcx
mov    $0x1,%al
mov    0x2cf3(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x1007a(%rbp)
je     1355 <gen_data+0x225>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x1007b(%rbp)
jne    1349 <gen_data+0x219>
mov    0x2cab(%rip),%rax
mov    (%rax),%rcx
mov    $0x1,%al
mov    0x2cbf(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x1007c(%rbp)
je     133d <gen_data+0x20d>
mov    0x2ca1(%rip),%rax
mov    (%rax),%rax
mov    0x2c9f(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1007c(%rbp)
mov    -0x1007c(%rbp),%al
mov    %al,-0x1007b(%rbp)
mov    -0x1007b(%rbp),%al
mov    %al,-0x1007a(%rbp)
mov    -0x1007a(%rbp),%al
mov    %al,-0x10079(%rbp)
mov    -0x10079(%rbp),%al
test   $0x1,%al
jne    1289 <gen_data+0x159>
cmpq   $0x0,-0x10070(%rbp)
jge    145b <gen_data+0x32b>
cmpl   $0x0,-0x2c(%rbp)
je     13ca <gen_data+0x29a>
mov    0x2c22(%rip),%rax
mov    (%rax),%rax
mov    0x2c38(%rip),%rcx
cmp    (%rcx),%rax
je     13bb <gen_data+0x28b>
mov    0x2c20(%rip),%rax
mov    (%rax),%rax
mov    0x2c1e(%rip),%rcx
cmp    (%rcx),%rax
jne    13ca <gen_data+0x29a>
movl   $0x1,-0x1003c(%rbp)
jmp    1475 <gen_data+0x345>
mov    0x2c07(%rip),%rax
mov    (%rax),%rax
mov    0x2bf5(%rip),%rcx
cmp    (%rcx),%rax
jne    1409 <gen_data+0x2d9>
cmpl   $0x0,-0x30(%rbp)
je     1409 <gen_data+0x2d9>
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10048(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    14bd <gen_data+0x38d>
mov    0x2bd0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1008c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10088(%rbp)
mov    0x2ba6(%rip),%rax
mov    (%rax),%rdi
call   1050 <strerror@plt>
mov    -0x1008c(%rbp),%edi
mov    -0x10088(%rbp),%rdx
mov    %rax,%rcx
lea    0xbb7(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    14bd <gen_data+0x38d>
mov    -0x10070(%rbp),%rax
add    -0x10058(%rbp),%rax
mov    %rax,-0x10058(%rbp)
jmp    1270 <gen_data+0x140>
mov    -0x10058(%rbp),%rax
add    -0x10038(%rbp),%rax
mov    %rax,-0x10038(%rbp)
mov    -0x10058(%rbp),%rcx
mov    -0x28(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
cmpl   $0x0,-0x1003c(%rbp)
je     14ad <gen_data+0x37d>
jmp    14b2 <gen_data+0x382>
jmp    1179 <gen_data+0x49>
mov    -0x10038(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x100b8,%rsp
mov    %r8d,0xc(%rsp)
mov    (%rcx),%r8
mov    %rdx,%rax
sub    %r8,%rax
jbe    1a19 <gen_data+0x8e9>
mov    %esi,%r14d
mov    %r9d,0x8(%rsp)
mov    %rax,0x90(%rsp)
xor    %r11d,%r11d
mov    $0x10000,%r15d
movdqa 0xf09(%rip),%xmm11
movdqa 0xf10(%rip),%xmm13
movapd 0xf17(%rip),%xmm14
movdqa 0xf1e(%rip),%xmm15
mov    %rcx,(%rsp)
mov    %rdi,0x98(%rsp)
mov    %rdx,0x58(%rsp)
mov    %rdx,%r12
sub    %r8,%r12
cmp    $0x10000,%r12
cmovae %r15,%r12
test   %r12,%r12
je     11d0 <gen_data+0xa0>
cmp    $0x10,%r12
jae    11e0 <gen_data+0xb0>
mov    %r8,%r9
xor    %ebp,%ebp
jmp    18d9 <gen_data+0x7a9>
nopl   0x0(%rax)
xor    %ebx,%ebx
jmp    19b6 <gen_data+0x886>
nopw   0x0(%rax,%rax,1)
mov    %r12d,%ebp
and    $0x1fff0,%ebp
movq   %r8,%xmm0
pshufd $0x44,%xmm0,%xmm8
movdqa %xmm8,%xmm10
paddq  0xdfe(%rip),%xmm10
movdqa %xmm8,%xmm9
paddq  0xe00(%rip),%xmm9
movdqa %xmm8,%xmm7
paddq  0xe03(%rip),%xmm7
movdqa %xmm8,%xmm6
paddq  0xe06(%rip),%xmm6
movdqa %xmm8,%xmm12
paddq  0xe08(%rip),%xmm12
movdqa %xmm8,%xmm5
paddq  0xe0b(%rip),%xmm5
movdqa %xmm8,%xmm1
paddq  0xe0e(%rip),%xmm1
paddq  0xe15(%rip),%xmm8
lea    -0x10(%rbp),%rax
mov    %rax,%rsi
shr    $0x4,%rsi
add    $0x1,%rsi
test   %rax,%rax
je     19cd <gen_data+0x89d>
mov    %rsi,%rax
and    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
nopl   0x0(%rax)
movdqa %xmm1,0x10(%rsp)
movdqa %xmm12,0xa0(%rsp)
movdqa %xmm5,0x60(%rsp)
movdqa %xmm7,0x20(%rsp)
movdqa %xmm6,0x30(%rsp)
movdqa %xmm10,0x80(%rsp)
movdqa %xmm9,0x70(%rsp)
movdqa %xmm8,0x40(%rsp)
movdqa 0x40(%rsp),%xmm8
psllq  $0x3,%xmm8
movdqa 0x10(%rsp),%xmm1
psllq  $0x3,%xmm1
movdqa %xmm5,%xmm2
psllq  $0x3,%xmm2
movdqa %xmm12,%xmm5
psllq  $0x3,%xmm5
movdqa 0x30(%rsp),%xmm6
psllq  $0x3,%xmm6
movdqa 0x20(%rsp),%xmm7
psllq  $0x3,%xmm7
movdqa %xmm9,%xmm4
psllq  $0x3,%xmm4
movdqa %xmm10,%xmm3
psllq  $0x3,%xmm3
pand   %xmm11,%xmm3
pand   %xmm11,%xmm4
pand   %xmm11,%xmm7
pand   %xmm11,%xmm6
pand   %xmm11,%xmm5
pand   %xmm11,%xmm2
pand   %xmm11,%xmm1
pand   %xmm11,%xmm8
por    %xmm13,%xmm8
por    %xmm13,%xmm1
por    %xmm13,%xmm2
por    %xmm13,%xmm5
por    %xmm13,%xmm6
por    %xmm13,%xmm4
por    %xmm13,%xmm3
movdqa %xmm10,%xmm0
psrlq  %xmm3,%xmm0
pshufd $0xee,%xmm3,%xmm9
movdqa 0x80(%rsp),%xmm10
psrlq  %xmm9,%xmm10
movdqa 0x70(%rsp),%xmm3
psrlq  %xmm4,%xmm3
por    %xmm13,%xmm7
pshufd $0xee,%xmm4,%xmm9
movdqa 0x70(%rsp),%xmm4
psrlq  %xmm9,%xmm4
movsd  %xmm0,%xmm10
movdqa 0x20(%rsp),%xmm0
psrlq  %xmm7,%xmm0
pshufd $0xee,%xmm7,%xmm9
movdqa 0x20(%rsp),%xmm7
psrlq  %xmm9,%xmm7
movdqa 0x30(%rsp),%xmm9
psrlq  %xmm6,%xmm9
movsd  %xmm3,%xmm4
pshufd $0xee,%xmm6,%xmm3
movdqa 0x30(%rsp),%xmm6
psrlq  %xmm3,%xmm6
movsd  %xmm0,%xmm7
movdqa %xmm12,%xmm0
psrlq  %xmm5,%xmm0
pshufd $0xee,%xmm5,%xmm3
movdqa %xmm12,%xmm5
psrlq  %xmm3,%xmm5
movdqa 0x60(%rsp),%xmm3
psrlq  %xmm2,%xmm3
movsd  %xmm9,%xmm6
pshufd $0xee,%xmm2,%xmm9
movdqa 0x60(%rsp),%xmm2
psrlq  %xmm9,%xmm2
movsd  %xmm0,%xmm5
movdqa 0x10(%rsp),%xmm9
psrlq  %xmm1,%xmm9
pshufd $0xee,%xmm1,%xmm0
movdqa 0x10(%rsp),%xmm1
psrlq  %xmm0,%xmm1
movdqa 0x40(%rsp),%xmm12
psrlq  %xmm8,%xmm12
movsd  %xmm3,%xmm2
pshufd $0xee,%xmm8,%xmm3
movdqa 0x40(%rsp),%xmm0
psrlq  %xmm3,%xmm0
movsd  %xmm9,%xmm1
movsd  %xmm12,%xmm0
andpd  %xmm14,%xmm0
andpd  %xmm14,%xmm1
packuswb %xmm1,%xmm0
andpd  %xmm14,%xmm2
andpd  %xmm14,%xmm5
packuswb %xmm5,%xmm2
packuswb %xmm2,%xmm0
andpd  %xmm14,%xmm6
andpd  %xmm14,%xmm7
packuswb %xmm7,%xmm6
andpd  %xmm14,%xmm4
andpd  %xmm14,%xmm10
packuswb %xmm10,%xmm4
packuswb %xmm4,%xmm6
packuswb %xmm6,%xmm0
movdqa %xmm0,0xb0(%rsp,%rcx,1)
movdqa 0x80(%rsp),%xmm10
paddq  %xmm15,%xmm10
movdqa 0x70(%rsp),%xmm9
paddq  %xmm15,%xmm9
movdqa 0x20(%rsp),%xmm12
paddq  %xmm15,%xmm12
movdqa 0x30(%rsp),%xmm3
paddq  %xmm15,%xmm3
movdqa 0xa0(%rsp),%xmm6
paddq  %xmm15,%xmm6
movdqa 0x60(%rsp),%xmm5
paddq  %xmm15,%xmm5
movdqa 0x10(%rsp),%xmm7
paddq  %xmm15,%xmm7
movdqa 0x40(%rsp),%xmm0
paddq  %xmm15,%xmm0
movdqa %xmm0,%xmm8
psllq  $0x3,%xmm8
movdqa %xmm9,%xmm1
psllq  $0x3,%xmm1
movdqa %xmm10,%xmm2
psllq  $0x3,%xmm2
pand   %xmm11,%xmm2
pand   %xmm11,%xmm1
por    %xmm13,%xmm1
por    %xmm13,%xmm2
movdqa %xmm10,%xmm4
psrlq  %xmm2,%xmm4
pshufd $0xee,%xmm2,%xmm2
psrlq  %xmm2,%xmm10
movdqa %xmm9,%xmm2
psrlq  %xmm1,%xmm2
pshufd $0xee,%xmm1,%xmm1
psrlq  %xmm1,%xmm9
movdqa %xmm5,%xmm1
psllq  $0x3,%xmm1
movsd  %xmm4,%xmm10
movdqa %xmm12,%xmm4
psllq  $0x3,%xmm4
pand   %xmm11,%xmm4
por    %xmm13,%xmm4
movsd  %xmm2,%xmm9
movdqa %xmm12,%xmm2
psrlq  %xmm4,%xmm2
pshufd $0xee,%xmm4,%xmm4
psrlq  %xmm4,%xmm12
movdqa %xmm3,%xmm4
psllq  $0x3,%xmm4
pand   %xmm11,%xmm4
por    %xmm13,%xmm4
movsd  %xmm2,%xmm12
movdqa %xmm3,%xmm2
psrlq  %xmm4,%xmm2
pshufd $0xee,%xmm4,%xmm4
psrlq  %xmm4,%xmm3
movdqa %xmm6,%xmm4
psllq  $0x3,%xmm4
pand   %xmm11,%xmm4
pand   %xmm11,%xmm1
por    %xmm13,%xmm1
por    %xmm13,%xmm4
movsd  %xmm2,%xmm3
movdqa %xmm6,%xmm2
psrlq  %xmm4,%xmm2
pshufd $0xee,%xmm4,%xmm4
psrlq  %xmm4,%xmm6
movdqa %xmm5,%xmm4
psrlq  %xmm1,%xmm4
pshufd $0xee,%xmm1,%xmm1
psrlq  %xmm1,%xmm5
movdqa %xmm7,%xmm1
psllq  $0x3,%xmm1
pand   %xmm11,%xmm1
pand   %xmm11,%xmm8
por    %xmm13,%xmm8
por    %xmm13,%xmm1
movsd  %xmm2,%xmm6
movdqa %xmm7,%xmm2
psrlq  %xmm1,%xmm2
pshufd $0xee,%xmm1,%xmm1
psrlq  %xmm1,%xmm7
movdqa %xmm0,%xmm1
psrlq  %xmm8,%xmm1
movsd  %xmm4,%xmm5
pshufd $0xee,%xmm8,%xmm4
movdqa 0x40(%rsp),%xmm8
psrlq  %xmm4,%xmm0
movdqa 0xa5f(%rip),%xmm4
movsd  %xmm2,%xmm7
movsd  %xmm1,%xmm0
movdqa 0x10(%rsp),%xmm1
andpd  %xmm14,%xmm0
andpd  %xmm14,%xmm7
packuswb %xmm7,%xmm0
movdqa 0x20(%rsp),%xmm7
andpd  %xmm14,%xmm5
andpd  %xmm14,%xmm6
packuswb %xmm6,%xmm5
movdqa 0x30(%rsp),%xmm6
packuswb %xmm5,%xmm0
movdqa 0x60(%rsp),%xmm5
andpd  %xmm14,%xmm3
andpd  %xmm14,%xmm12
packuswb %xmm12,%xmm3
movdqa 0xa0(%rsp),%xmm12
andpd  %xmm14,%xmm9
andpd  %xmm14,%xmm10
packuswb %xmm10,%xmm9
movdqa 0x80(%rsp),%xmm10
packuswb %xmm9,%xmm3
movdqa 0x70(%rsp),%xmm9
packuswb %xmm3,%xmm0
movdqa %xmm0,0xc0(%rsp,%rcx,1)
add    $0x20,%rcx
paddq  %xmm4,%xmm8
paddq  %xmm4,%xmm1
paddq  %xmm4,%xmm5
paddq  %xmm4,%xmm12
paddq  %xmm4,%xmm6
paddq  %xmm4,%xmm7
paddq  %xmm4,%xmm9
paddq  %xmm4,%xmm10
add    $0xfffffffffffffffe,%rax
jne    1280 <gen_data+0x150>
test   $0x1,%sil
je     18d0 <gen_data+0x7a0>
movdqa %xmm5,%xmm0
psllq  $0x3,%xmm0
movdqa %xmm1,%xmm4
movdqa %xmm6,%xmm1
psllq  $0x3,%xmm1
movdqa %xmm10,%xmm2
psllq  $0x3,%xmm2
pand   %xmm11,%xmm2
por    %xmm13,%xmm2
movdqa %xmm10,%xmm3
psrlq  %xmm2,%xmm3
pshufd $0xee,%xmm2,%xmm2
psrlq  %xmm2,%xmm10
movdqa %xmm9,%xmm2
psllq  $0x3,%xmm2
pand   %xmm11,%xmm2
por    %xmm13,%xmm2
movsd  %xmm3,%xmm10
movdqa %xmm9,%xmm3
psrlq  %xmm2,%xmm3
pshufd $0xee,%xmm2,%xmm2
psrlq  %xmm2,%xmm9
movdqa %xmm7,%xmm2
psllq  $0x3,%xmm2
pand   %xmm11,%xmm2
pand   %xmm11,%xmm1
por    %xmm13,%xmm1
por    %xmm13,%xmm2
movsd  %xmm3,%xmm9
movdqa %xmm7,%xmm3
psrlq  %xmm2,%xmm3
pshufd $0xee,%xmm2,%xmm2
psrlq  %xmm2,%xmm7
movdqa %xmm6,%xmm2
psrlq  %xmm1,%xmm2
pshufd $0xee,%xmm1,%xmm1
psrlq  %xmm1,%xmm6
movdqa %xmm12,%xmm1
psllq  $0x3,%xmm1
pand   %xmm11,%xmm1
pand   %xmm11,%xmm0
por    %xmm13,%xmm0
por    %xmm13,%xmm1
movsd  %xmm3,%xmm7
movdqa %xmm12,%xmm3
psrlq  %xmm1,%xmm3
pshufd $0xee,%xmm1,%xmm1
psrlq  %xmm1,%xmm12
movdqa %xmm5,%xmm1
psrlq  %xmm0,%xmm1
movsd  %xmm2,%xmm6
pshufd $0xee,%xmm0,%xmm0
psrlq  %xmm0,%xmm5
movsd  %xmm3,%xmm12
movdqa %xmm4,%xmm0
psllq  $0x3,%xmm0
pand   %xmm11,%xmm0
por    %xmm13,%xmm0
movsd  %xmm1,%xmm5
movdqa %xmm4,%xmm1
psrlq  %xmm0,%xmm1
pshufd $0xee,%xmm0,%xmm0
psrlq  %xmm0,%xmm4
movdqa %xmm8,%xmm0
psllq  $0x3,%xmm0
pand   %xmm11,%xmm0
por    %xmm13,%xmm0
movsd  %xmm1,%xmm4
movdqa %xmm8,%xmm1
psrlq  %xmm0,%xmm1
pshufd $0xee,%xmm0,%xmm0
psrlq  %xmm0,%xmm8
movsd  %xmm1,%xmm8
andpd  %xmm14,%xmm8
andpd  %xmm14,%xmm4
packuswb %xmm4,%xmm8
andpd  %xmm14,%xmm5
andpd  %xmm14,%xmm12
packuswb %xmm12,%xmm5
packuswb %xmm5,%xmm8
andpd  %xmm14,%xmm6
andpd  %xmm14,%xmm7
packuswb %xmm7,%xmm6
andpd  %xmm14,%xmm9
andpd  %xmm14,%xmm10
packuswb %xmm10,%xmm9
packuswb %xmm9,%xmm6
packuswb %xmm6,%xmm8
movdqa %xmm8,0xb0(%rsp,%rcx,1)
cmp    %rbp,%r12
je     1920 <gen_data+0x7f0>
lea    (%r8,%rbp,1),%r9
lea    0x0(,%r9,8),%rsi
mov    %r12,%rbx
sub    %rbp,%rbx
lea    (%rsp,%rbp,1),%r10
add    $0xb0,%r10
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r9,%rbp,1),%rax
mov    %esi,%ecx
and    $0x18,%cl
or     $0x2,%cl
shr    %cl,%rax
mov    %al,(%r10,%rbp,1)
add    $0x1,%rbp
add    $0x8,%rsi
cmp    %rbp,%rbx
jne    1900 <gen_data+0x7d0>
test   %r12,%r12
je     19b0 <gen_data+0x880>
mov    %r11,%rbp
xor    %ebx,%ebx
jmp    193c <gen_data+0x80c>
add    %rax,%rbx
cmp    %rbx,%r12
jbe    19de <gen_data+0x8ae>
lea    (%rsp,%rbx,1),%r13
add    $0xb0,%r13
mov    %r12,%r15
sub    %rbx,%r15
nopl   (%rax)
mov    %r14d,%edi
mov    %r13,%rsi
mov    %r15,%rdx
call   1030 <write@plt>
test   %rax,%rax
jns    1930 <gen_data+0x800>
mov    0x2666(%rip),%rax
mov    (%rax),%rdi
mov    0x264c(%rip),%rax
cmp    %rdi,(%rax)
je     1950 <gen_data+0x820>
mov    0x2630(%rip),%rax
cmp    %rdi,(%rax)
sete   %cl
mov    0x263b(%rip),%rax
cmp    %rdi,(%rax)
sete   %al
or     %cl,%al
cmpl   $0x0,0xc(%rsp)
jne    1a1e <gen_data+0x8ee>
test   %al,%al
jne    1950 <gen_data+0x820>
jmp    1a31 <gen_data+0x901>
nopl   0x0(%rax)
xor    %ebx,%ebx
mov    (%rsp),%rcx
add    %rbx,%r11
add    %rbx,%r8
mov    %r8,(%rcx)
cmp    %rdx,%r8
jb     11a3 <gen_data+0x73>
jmp    1a88 <gen_data+0x958>
xor    %ecx,%ecx
test   $0x1,%sil
jne    1728 <gen_data+0x5f8>
jmp    18d0 <gen_data+0x7a0>
mov    (%rsp),%rcx
mov    (%rcx),%r8
mov    0x58(%rsp),%rdx
mov    %rbp,%r11
mov    $0x10000,%r15d
movdqa 0x684(%rip),%xmm11
movdqa 0x68b(%rip),%xmm13
movapd 0x692(%rip),%xmm14
movdqa 0x699(%rip),%xmm15
jmp    19b6 <gen_data+0x886>
xor    %r11d,%r11d
jmp    1a88 <gen_data+0x958>
test   %al,%al
je     1a31 <gen_data+0x901>
mov    %rbp,%r11
add    %rbx,%r11
mov    (%rsp),%rax
add    %rbx,(%rax)
jmp    1a88 <gen_data+0x958>
cmpl   $0x0,0x8(%rsp)
je     1a5a <gen_data+0x92a>
mov    0x2599(%rip),%rax
cmp    %rdi,(%rax)
jne    1a5a <gen_data+0x92a>
mov    (%rsp),%rax
mov    0x58(%rsp),%rcx
mov    %rcx,(%rax)
mov    0x90(%rsp),%r11
jmp    1a88 <gen_data+0x958>
mov    0x257f(%rip),%rax
mov    (%rax),%ebx
call   1050 <strerror@plt>
lea    0x661(%rip),%rsi
mov    %ebx,%edi
mov    0x98(%rsp),%rdx
mov    %rax,%rcx
call   1040 <fprintf@plt>
mov    $0xffffffffffffffff,%r11
mov    %r11,%rax
add    $0x100b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EINTR = global i64 0
@errno = global i64 0
@EAGAIN = global i64 0
@EWOULDBLOCK = global i64 0
@EPIPE = global i64 0
@stderr = global i32 0
@.str = [27 x i8] c"Couldn't write to %s : %s\0A\00"
define i64 @gen_data(i8* %0, i32 %1, i64 %2, i64* %3, i32 %4, i32 %5) {
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64*
%12 = alloca i32
%13 = alloca i32
%14 = alloca [65536 x i8]
%15 = alloca i64
%16 = alloca i32
%17 = alloca i64
%18 = alloca i64
%19 = alloca i64
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
store i8* %0, i8** %8
store i32 %1, i32* %9
store i64 %2, i64* %10
store i64* %3, i64** %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i64 0, i64* %15
store i32 0, i32* %16
%23 = load i64, i64* %10
%24 = load i64*, i64** %11
%25 = load i64, i64* %24
%26 = sub i64 %23, %25
store i64 %26, i64* %17
br label %27
27: ; preds = %156, %6
%28 = load i64*, i64** %11
%29 = load i64, i64* %28
%30 = load i64, i64* %10
%31 = icmp ult i64 %29, %30
br i1 %31, label %32, label %157
32: ; preds = %27
%33 = load i64, i64* %10
%34 = load i64*, i64** %11
%35 = load i64, i64* %34
%36 = sub i64 %33, %35
%37 = icmp ult i64 %36, 65536
br i1 %37, label %38, label %43
38: ; preds = %32
%39 = load i64, i64* %10
%40 = load i64*, i64** %11
%41 = load i64, i64* %40
%42 = sub i64 %39, %41
br label %44
43: ; preds = %32
br label %44
44: ; preds = %43, %38
%45 = phi i64 [ %42, %38 ], [ 65536, %43 ]
store i64 %45, i64* %18
store i64 0, i64* %19
store i64 0, i64* %20
%46 = load i64*, i64** %11
%47 = load i64, i64* %46
store i64 %47, i64* %21
br label %48
48: ; preds = %63, %44
%49 = load i64, i64* %20
%50 = load i64, i64* %18
%51 = icmp ult i64 %49, %50
br i1 %51, label %52, label %68
52: ; preds = %48
%53 = load i64, i64* %21
%54 = load i64, i64* %21
%55 = and i64 %54, 3
%56 = shl i64 %55, 3
%57 = add i64 %56, 2
%58 = lshr i64 %53, %57
%59 = and i64 %58, 255
%60 = trunc i64 %59 to i8
%61 = load i64, i64* %20
%62 = getelementptr inbounds [65536 x i8], [65536 x i8]* %14, i64 0, i64 %61
store i8 %60, i8* %62
br label %63
63: ; preds = %52
%64 = load i64, i64* %20
%65 = add i64 %64, 1
store i64 %65, i64* %20
%66 = load i64, i64* %21
%67 = add i64 %66, 1
store i64 %67, i64* %21
br label %48
68: ; preds = %48
br label %69
69: ; preds = %141, %68
%70 = load i64, i64* %19
%71 = load i64, i64* %18
%72 = icmp ult i64 %70, %71
br i1 %72, label %73, label %145
73: ; preds = %69
br label %74
74: ; preds = %107, %73
%75 = load i32, i32* %9
%76 = getelementptr inbounds [65536 x i8], [65536 x i8]* %14, i64 0, i64 0
%77 = load i64, i64* %19
%78 = getelementptr inbounds i8, i8* %76, i64 %77
%79 = load i64, i64* %18
%80 = load i64, i64* %19
%81 = sub i64 %79, %80
%82 = call i64 @write(i32 %75, i8* %78, i64 %81)
store i64 %82, i64* %22
br label %83
83: ; preds = %74
%84 = load i64, i64* %22
%85 = icmp slt i64 %84, 0
br i1 %85, label %86, label %107
86: ; preds = %83
%87 = load i64, i64* @EINTR
%88 = load i64, i64* @errno
%89 = icmp eq i64 %87, %88
br i1 %89, label %105, label %90
90: ; preds = %86
%91 = load i32, i32* %12
%92 = icmp ne i32 %91, 0
br i1 %92, label %103, label %93
93: ; preds = %90
%94 = load i64, i64* @EAGAIN
%95 = load i64, i64* @errno
%96 = icmp eq i64 %94, %95
br i1 %96, label %101, label %97
97: ; preds = %93
%98 = load i64, i64* @EWOULDBLOCK
%99 = load i64, i64* @errno
%100 = icmp eq i64 %98, %99
br label %101
101: ; preds = %97, %93
%102 = phi i1 [ true, %93 ], [ %100, %97 ]
br label %103
103: ; preds = %101, %90
%104 = phi i1 [ false, %90 ], [ %102, %101 ]
br label %105
105: ; preds = %103, %86
%106 = phi i1 [ true, %86 ], [ %104, %103 ]
br label %107
107: ; preds = %105, %83
%108 = phi i1 [ false, %83 ], [ %106, %105 ]
br i1 %108, label %74, label %109
109: ; preds = %107
%110 = load i64, i64* %22
%111 = icmp slt i64 %110, 0
br i1 %111, label %112, label %141
112: ; preds = %109
%113 = load i32, i32* %12
%114 = icmp ne i32 %113, 0
br i1 %114, label %115, label %124
115: ; preds = %112
%116 = load i64, i64* @EAGAIN
%117 = load i64, i64* @errno
%118 = icmp eq i64 %116, %117
br i1 %118, label %123, label %119
119: ; preds = %115
%120 = load i64, i64* @EWOULDBLOCK
%121 = load i64, i64* @errno
%122 = icmp eq i64 %120, %121
br i1 %122, label %123, label %124
123: ; preds = %119, %115
store i32 1, i32* %16
br label %145
124: ; preds = %119, %112
%125 = load i64, i64* @EPIPE
%126 = load i64, i64* @errno
%127 = icmp eq i64 %125, %126
br i1 %127, label %128, label %135
128: ; preds = %124
%129 = load i32, i32* %13
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %135
131: ; preds = %128
%132 = load i64, i64* %10
%133 = load i64*, i64** %11
store i64 %132, i64* %133
%134 = load i64, i64* %17
store i64 %134, i64* %7
br label %159
135: ; preds = %128, %124
%136 = load i32, i32* @stderr
%137 = load i8*, i8** %8
%138 = load i64, i64* @errno
%139 = call i8* @strerror(i64 %138)
%140 = call i32 @fprintf(i32 %136, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %137, i8* %139)
store i64 -1, i64* %7
br label %159
141: ; preds = %109
%142 = load i64, i64* %22
%143 = load i64, i64* %19
%144 = add i64 %143, %142
store i64 %144, i64* %19
br label %69
145: ; preds = %123, %69
%146 = load i64, i64* %19
%147 = load i64, i64* %15
%148 = add i64 %147, %146
store i64 %148, i64* %15
%149 = load i64, i64* %19
%150 = load i64*, i64** %11
%151 = load i64, i64* %150
%152 = add i64 %151, %149
store i64 %152, i64* %150
%153 = load i32, i32* %16
%154 = icmp ne i32 %153, 0
br i1 %154, label %155, label %156
155: ; preds = %145
br label %157
156: ; preds = %145
br label %27
157: ; preds = %155, %27
%158 = load i64, i64* %15
store i64 %158, i64* %7
br label %159
159: ; preds = %157, %135, %131
%160 = load i64, i64* %7
ret i64 %160
}

LLVM IR (-O2):
@EINTR = global i64 0
@errno = global i64 0
@EAGAIN = global i64 0
@EWOULDBLOCK = global i64 0
@EPIPE = global i64 0
@stderr = global i32 0
@.str = [27 x i8] c"Couldn't write to %s : %s\0A\00"
define i64 @gen_data(i8* %0, i32 %1, i64 %2, i64* nocapture %3, i32 %4, i32 %5) {
%7 = alloca [65536 x i8]
%8 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%9 = load i64, i64* %3
%10 = sub i64 %2, %9
%11 = icmp ult i64 %9, %2
br i1 %11, label %12, label %137
12: ; preds = %6
%13 = icmp eq i32 %4, 0
br label %14
14: ; preds = %12, %131
%15 = phi i64 [ %9, %12 ], [ %135, %131 ]
%16 = phi i64 [ 0, %12 ], [ %134, %131 ]
%17 = sub i64 %2, %15
%18 = icmp ult i64 %17, 65536
%19 = select i1 %18, i64 %17, i64 65536
%20 = icmp eq i64 %19, 0
br i1 %20, label %131, label %21
21: ; preds = %14
%22 = icmp ult i64 %19, 16
br i1 %22, label %74, label %23
23: ; preds = %21
%24 = and i64 %19, 131056
%25 = add i64 %15, %24
%26 = insertelement <16 x i64> poison, i64 %15, i64 0
%27 = shufflevector <16 x i64> %26, <16 x i64> poison, <16 x i32> zeroinitializer
%28 = add <16 x i64> %27, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>
%29 = add nsw i64 %24, -16
%30 = lshr exact i64 %29, 4
%31 = add nuw nsw i64 %30, 1
%32 = and i64 %31, 1
%33 = icmp eq i64 %29, 0
br i1 %33, label %60, label %34
34: ; preds = %23
%35 = and i64 %31, 2305843009213693950
br label %36
36: ; preds = %36, %34
%37 = phi i64 [ 0, %34 ], [ %56, %36 ]
%38 = phi <16 x i64> [ %28, %34 ], [ %57, %36 ]
%39 = phi i64 [ 0, %34 ], [ %58, %36 ]
%40 = shl <16 x i64> %38, <i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3>
%41 = and <16 x i64> %40, <i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24>
%42 = or <16 x i64> %41, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
%43 = lshr <16 x i64> %38, %42
%44 = trunc <16 x i64> %43 to <16 x i8>
%45 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %37
%46 = bitcast i8* %45 to <16 x i8>*
store <16 x i8> %44, <16 x i8>* %46
%47 = or i64 %37, 16
%48 = add <16 x i64> %38, <i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16, i64 16>
%49 = shl <16 x i64> %48, <i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3>
%50 = and <16 x i64> %49, <i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24>
%51 = or <16 x i64> %50, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
%52 = lshr <16 x i64> %48, %51
%53 = trunc <16 x i64> %52 to <16 x i8>
%54 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %47
%55 = bitcast i8* %54 to <16 x i8>*
store <16 x i8> %53, <16 x i8>* %55
%56 = add nuw i64 %37, 32
%57 = add <16 x i64> %38, <i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32>
%58 = add i64 %39, 2
%59 = icmp eq i64 %58, %35
br i1 %59, label %60, label %36
60: ; preds = %36, %23
%61 = phi i64 [ 0, %23 ], [ %56, %36 ]
%62 = phi <16 x i64> [ %28, %23 ], [ %57, %36 ]
%63 = icmp eq i64 %32, 0
br i1 %63, label %72, label %64
64: ; preds = %60
%65 = shl <16 x i64> %62, <i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3, i64 3>
%66 = and <16 x i64> %65, <i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24, i64 24>
%67 = or <16 x i64> %66, <i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2, i64 2>
%68 = lshr <16 x i64> %62, %67
%69 = trunc <16 x i64> %68 to <16 x i8>
%70 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %61
%71 = bitcast i8* %70 to <16 x i8>*
store <16 x i8> %69, <16 x i8>* %71
br label %72
72: ; preds = %60, %64
%73 = icmp eq i64 %19, %24
br i1 %73, label %77, label %74
74: ; preds = %21, %72
%75 = phi i64 [ %15, %21 ], [ %25, %72 ]
%76 = phi i64 [ 0, %21 ], [ %24, %72 ]
br label %78
77: ; preds = %78, %72
br i1 %20, label %131, label %90
78: ; preds = %74, %78
%79 = phi i64 [ %88, %78 ], [ %75, %74 ]
%80 = phi i64 [ %87, %78 ], [ %76, %74 ]
%81 = shl i64 %79, 3
%82 = and i64 %81, 24
%83 = or i64 %82, 2
%84 = lshr i64 %79, %83
%85 = trunc i64 %84 to i8
%86 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %80
store i8 %85, i8* %86
%87 = add nuw nsw i64 %80, 1
%88 = add i64 %79, 1
%89 = icmp eq i64 %87, %19
br i1 %89, label %77, label %78
90: ; preds = %77, %125
%91 = phi i64 [ %127, %125 ], [ 0, %77 ]
%92 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 %91
%93 = sub i64 %19, %91
%94 = call i64 @write(i32 %1, i8* %92, i64 %93)
%95 = icmp slt i64 %94, 0
br i1 %95, label %96, label %125
96: ; preds = %90, %107
%97 = load i64, i64* @EINTR
%98 = load i64, i64* @errno
%99 = icmp eq i64 %97, %98
br i1 %99, label %107, label %100
100: ; preds = %96
%101 = load i64, i64* @EAGAIN
%102 = icmp eq i64 %101, %98
%103 = load i64, i64* @EWOULDBLOCK
%104 = icmp eq i64 %103, %98
%105 = select i1 %102, i1 true, i1 %104
br i1 %13, label %106, label %110
106: ; preds = %100
br i1 %105, label %107, label %115
107: ; preds = %106, %96
%108 = call i64 @write(i32 %1, i8* %92, i64 %93)
%109 = icmp slt i64 %108, 0
br i1 %109, label %96, label %125
110: ; preds = %100
br i1 %105, label %111, label %115
111: ; preds = %110
%112 = add i64 %91, %16
%113 = load i64, i64* %3
%114 = add i64 %113, %91
store i64 %114, i64* %3
br label %137
115: ; preds = %106, %110
%116 = load i64, i64* @EPIPE
%117 = icmp eq i64 %116, %98
%118 = icmp ne i32 %5, 0
%119 = and i1 %118, %117
br i1 %119, label %120, label %121
120: ; preds = %115
store i64 %2, i64* %3
br label %137
121: ; preds = %115
%122 = load i32, i32* @stderr
%123 = tail call i8* @strerror(i64 %98)
%124 = tail call i32 @fprintf(i32 %122, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %123)
br label %137
125: ; preds = %107, %90
%126 = phi i64 [ %94, %90 ], [ %108, %107 ]
%127 = add i64 %126, %91
%128 = icmp ugt i64 %19, %127
br i1 %128, label %90, label %129
129: ; preds = %125
%130 = load i64, i64* %3
br label %131
131: ; preds = %14, %129, %77
%132 = phi i64 [ %15, %77 ], [ %130, %129 ], [ %15, %14 ]
%133 = phi i64 [ 0, %77 ], [ %127, %129 ], [ 0, %14 ]
%134 = add i64 %133, %16
%135 = add i64 %132, %133
store i64 %135, i64* %3
%136 = icmp ult i64 %135, %2
br i1 %136, label %14, label %137
137: ; preds = %131, %6, %111, %120, %121
%138 = phi i64 [ -1, %121 ], [ %10, %120 ], [ %112, %111 ], [ 0, %6 ], [ %134, %131 ]
ret i64 %138
}