#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 */
typedef struct writes TYPE_1__;

/* Type definitions */
typedef char *off_t;
struct writes {
  char *offset;
};

/* Variables and functions */
int O_CREAT;
int O_RDONLY;
int O_RDWR;
int /*<<< orphan*/ S_IRWXU;
int close(int);
int errno;
int /*<<< orphan*/ free(TYPE_1__ *);
TYPE_1__ *malloc(int);
int open(char *, int, int /*<<< orphan*/);
int pread(int, unsigned long *, int, char *);
int /*<<< orphan*/ printf(char *, ...);
int pwrite(int, unsigned long *, int, char *);
scalar_t__ random();
int unlink(char *);
int test_random(void) {
  unsigned long value;
  int fd, rc, ret;
  int i, j, k, idx, diff;
  char *tmpname = "test-random.dat";
  struct writes {
    off_t offset;
    union {
      unsigned long value;
      unsigned char bytes[8];
    };
  } * ptr;
  ptr = malloc(65537 * sizeof(struct writes));
  ptr[0].value = 0x1234;
  if (sizeof(unsigned long) != 8 || ptr[0].bytes[0] != 0x34) {
    free(ptr);
    return (2);
  }
  for (i = 0; i < 65537; i++) {
    ptr[i].offset = (off_t)random();
    ptr[i].value = (unsigned long)random();
  }
  fd = open(tmpname, O_CREAT | O_RDWR, S_IRWXU);
  if (fd < 0) {
    printf("Fail to create file %s, errno = %d at line %d!\n", tmpname, errno,
           183);
    return (1);
  }
  for (i = 0; i < 65537; i++) {
    ret = pwrite(fd, &ptr[i].value, sizeof(ptr[i].value), ptr[i].offset);
    if (ret != sizeof(ptr[i].value)) {
      printf("Fail to write (%lu: %lu), errno = %d at line %d!\n", ptr[i].value,
             ptr[i].offset, errno, 190);
      return (1);
    }
  }
  rc = close(fd);
  if (rc < 0) {
    printf("Fail to close file %s, errno = %d at line %d!\n", tmpname, errno,
           196);
    return (1);
  }
  for (i = 0; i < 65537; i++) {
    for (j = i + 1; j < 65537; j++) {
      if (ptr[j].offset >= ptr[i].offset + 8)
        continue;
      if (ptr[j].offset + 8 <= ptr[i].offset)
        continue;
      if (ptr[i].offset > ptr[j].offset) {
        idx = 0;
        diff = ptr[i].offset - ptr[j].offset;
        for (k = diff; k < 8; k++, idx++)
          ptr[i].bytes[idx] = ptr[j].bytes[k];
      } else {
        idx = 0;
        diff = ptr[j].offset - ptr[i].offset;
        for (k = diff; k < 8; k++, idx++)
          ptr[i].bytes[k] = ptr[j].bytes[idx];
      }
    }
  }
  fd = open(tmpname, O_RDONLY, S_IRWXU);
  if (fd < 0) {
    printf("Fail to open file %s, errno = %d at line %d!\n", tmpname, errno,
           224);
    return (1);
  }
  for (i = 0; i < 65537; i++) {
    ret = pread(fd, &value, sizeof(ptr[i].value), ptr[i].offset);
    if (ret != sizeof(ptr[i].value)) {
      printf("Fail to read at %lu, errno = %d at line %d!\n", ptr[i].offset,
             errno, 231);
      return (1);
    }
    if (value != ptr[i].value) {
      printf("Fail to read at %lu (%lu versus %lu) at line %d!\n",
             ptr[i].offset, value, ptr[i].value, 236);
      return (1);
    }
  }
  rc = close(fd);
  if (rc < 0) {
    printf("Fail to close file %s, errno = %d at line %d!\n", tmpname, errno,
           242);
    return (1);
  }
  rc = unlink(tmpname);
  if (rc) {
    printf("Fail to remove file %s, errno = %d at line %d!\n", tmpname, errno,
           247);
    return (1);
  }
  free(ptr);
  return (0);
}


x86 assembly (clang, -O0):
<test_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xe61(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    $0x100010,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movq   $0x1234,0x8(%rax)
mov    -0x40(%rbp),%rax
movzbl 0x8(%rax),%eax
cmp    $0x34,%eax
je     11e3 <test_random+0x53>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movl   $0x2,-0x4(%rbp)
jmp    176f <test_random+0x5df>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10001,-0x20(%rbp)
jge    123e <test_random+0xae>
mov    $0x0,%al
call   1070 <random@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1070 <random@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ea <test_random+0x5a>
mov    -0x38(%rbp),%rdi
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
mov    0x2d86(%rip),%rax
or     (%rax),%esi
mov    0x2d85(%rip),%rax
mov    (%rax),%edx
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    129b <test_random+0x10b>
mov    -0x38(%rbp),%rsi
mov    0x2d46(%rip),%rax
mov    (%rax),%edx
lea    0xd8d(%rip),%rdi
mov    $0xb7,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10001,-0x20(%rbp)
jge    1353 <test_random+0x1c3>
mov    -0x14(%rbp),%edi
mov    -0x40(%rbp),%rsi
movslq -0x20(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
add    $0x8,%rsi
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rcx
mov    $0x8,%edx
call   1090 <pwrite@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x8,%rax
je     1340 <test_random+0x1b0>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rsi
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rdx
mov    0x2ca2(%rip),%rax
mov    (%rax),%ecx
lea    0xd19(%rip),%rdi
mov    $0xbe,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
jmp    1345 <test_random+0x1b5>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12a2 <test_random+0x112>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1394 <test_random+0x204>
mov    -0x38(%rbp),%rsi
mov    0x2c4d(%rip),%rax
mov    (%rax),%edx
lea    0xcf6(%rip),%rdi
mov    $0xc4,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10001,-0x20(%rbp)
jge    158d <test_random+0x3fd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x10001,-0x24(%rbp)
jge    157a <test_random+0x3ea>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
mov    (%rcx),%rcx
add    $0x8,%rcx
cmp    %rcx,%rax
jb     13f4 <test_random+0x264>
jmp    156c <test_random+0x3dc>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
add    $0x8,%rax
mov    -0x40(%rbp),%rcx
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
cmp    (%rcx),%rax
ja     1427 <test_random+0x297>
jmp    156c <test_random+0x3dc>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
movslq -0x24(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
cmp    (%rcx),%rax
jbe    14dc <test_random+0x34c>
movl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
movslq -0x24(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x8,-0x28(%rbp)
jge    14d7 <test_random+0x347>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    0x8(%rax,%rcx,1),%dl
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
mov    %dl,0x8(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1488 <test_random+0x2f8>
jmp    1567 <test_random+0x3d7>
movl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rax
mov    -0x40(%rbp),%rcx
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x8,-0x28(%rbp)
jge    1562 <test_random+0x3d2>
mov    -0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
mov    0x8(%rax,%rcx,1),%dl
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
mov    %dl,0x8(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1513 <test_random+0x383>
jmp    1567 <test_random+0x3d7>
jmp    156c <test_random+0x3dc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13b1 <test_random+0x221>
jmp    157f <test_random+0x3ef>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    139b <test_random+0x20b>
mov    -0x38(%rbp),%rdi
mov    0x2a38(%rip),%rax
mov    (%rax),%esi
mov    0x2a3f(%rip),%rax
mov    (%rax),%edx
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    15e1 <test_random+0x451>
mov    -0x38(%rbp),%rsi
mov    0x2a00(%rip),%rax
mov    (%rax),%edx
lea    0xad8(%rip),%rdi
mov    $0xe0,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10001,-0x20(%rbp)
jge    16dc <test_random+0x54c>
mov    -0x14(%rbp),%edi
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rcx
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   10b0 <pread@plt>
mov    %eax,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x8,%rax
je     1663 <test_random+0x4d3>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
mov    0x297e(%rip),%rax
mov    (%rax),%edx
lea    0xa84(%rip),%rdi
mov    $0xe7,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movslq -0x20(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
cmp    0x8(%rcx),%rax
je     16c9 <test_random+0x539>
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rcx
lea    0xa4c(%rip),%rdi
mov    $0xec,%r8d
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
jmp    16ce <test_random+0x53e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    15e8 <test_random+0x458>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    171d <test_random+0x58d>
mov    -0x38(%rbp),%rsi
mov    0x28c4(%rip),%rax
mov    (%rax),%edx
lea    0x96d(%rip),%rdi
mov    $0xf2,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
mov    -0x38(%rbp),%rdi
call   1040 <unlink@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     175f <test_random+0x5cf>
mov    -0x38(%rbp),%rsi
mov    0x2882(%rip),%rax
mov    (%rax),%edx
lea    0x9e7(%rip),%rdi
mov    $0xf7,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    176f <test_random+0x5df>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_random>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    $0x100010,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
movq   $0x1234,0x8(%rax)
mov    $0x8,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <random@plt>
mov    %rax,-0x8(%r12,%rbx,1)
xor    %eax,%eax
call   1070 <random@plt>
mov    %rax,(%r12,%rbx,1)
add    $0x10,%rbx
cmp    $0x100018,%rbx
jne    11c0 <test_random+0x30>
mov    0x2e0d(%rip),%rax
mov    0x2de6(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2de3(%rip),%rax
mov    (%rax),%edx
lea    0xdfa(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1660 <test_random+0x4d0>
mov    %eax,%r14d
mov    $0x8,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%rsi
mov    -0x8(%r12,%rbx,1),%rbp
mov    %r14d,%edi
mov    $0x8,%edx
mov    %rbp,%rcx
call   1090 <pwrite@plt>
cmp    $0x8,%eax
jne    1681 <test_random+0x4f1>
add    $0x10,%rbx
cmp    $0x100018,%rbx
jne    1220 <test_random+0x90>
mov    %r14d,%edi
call   1060 <close@plt>
test   %eax,%eax
js     1765 <test_random+0x5d5>
lea    0x28(%r12),%r11
lea    0x18(%r12),%rbp
lea    0x8(%r12),%r13
lea    0xb(%r12),%rax
mov    %rax,0x10(%rsp)
lea    0x1b(%r12),%rax
mov    %rax,0x28(%rsp)
mov    $0x1,%eax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
jmp    12bf <test_random+0x12f>
addq   $0x1,0x20(%rsp)
add    $0x10,%r11
add    $0x10,%rbp
add    $0x10,%r13
addq   $0x10,0x10(%rsp)
addq   $0x10,0x28(%rsp)
mov    0x38(%rsp),%rax
cmp    $0x10001,%rax
je     16aa <test_random+0x51a>
lea    0x1(%rax),%rcx
mov    %rcx,0x38(%rsp)
cmp    $0xffff,%rax
ja     1290 <test_random+0x100>
mov    %rax,%rcx
shl    $0x4,%rcx
lea    (%r12,%rcx,1),%rdx
add    $0x8,%rdx
mov    %rdx,0x30(%rsp)
add    %rax,%rax
add    $0x3,%rax
mov    %rax,0x40(%rsp)
add    %r12,%rcx
mov    %rcx,0x48(%rsp)
mov    0x28(%rsp),%r8
mov    %rbp,%rcx
mov    %r11,%rdi
xor    %r15d,%r15d
mov    0x20(%rsp),%r14
mov    %rbp,0x18(%rsp)
mov    %r11,0x8(%rsp)
jmp    1341 <test_random+0x1b1>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
add    $0x1,%r15
add    $0x10,%rdi
add    $0x10,%rcx
add    $0x10,%r8
cmp    $0x10001,%r14
je     1290 <test_random+0x100>
mov    %r14,%rax
shl    $0x4,%rax
mov    (%r12,%rax,1),%r9
mov    0x48(%rsp),%rax
mov    (%rax),%rax
lea    0x8(%rax),%rdx
cmp    %rdx,%r9
jae    1320 <test_random+0x190>
lea    0x8(%r9),%rdx
cmp    %rax,%rdx
jbe    1320 <test_random+0x190>
mov    0x40(%rsp),%rdx
lea    (%rdx,%r15,2),%rdx
lea    (%r12,%rdx,8),%rsi
mov    %rax,%rbx
sub    %r9,%rbx
jbe    1440 <test_random+0x2b0>
cmp    $0x7,%ebx
jg     1320 <test_random+0x190>
movslq %ebx,%r10
sub    %rax,%r9
add    $0x8,%r9
mov    %r9d,%eax
cmp    $0x8,%rax
jb     13bc <test_random+0x22c>
lea    (%r10,%rax,1),%rdx
add    %rsi,%rdx
mov    0x30(%rsp),%rbx
cmp    %rbx,%rdx
jbe    148e <test_random+0x2fe>
lea    (%rbx,%rax,1),%rdx
add    %r10,%rsi
cmp    %rdx,%rsi
jae    148e <test_random+0x2fe>
xor    %esi,%esi
sub    %esi,%r9d
mov    %rsi,%rdx
not    %rdx
add    %rax,%rdx
and    $0x3,%r9
je     13e8 <test_random+0x258>
movzbl (%rcx,%r10,1),%ebx
mov    %bl,0x0(%r13,%rsi,1)
add    $0x1,%r10
add    $0x1,%rsi
add    $0xffffffffffffffff,%r9
jne    13d0 <test_random+0x240>
cmp    $0x3,%rdx
jb     1320 <test_random+0x190>
add    %r8,%r10
sub    %rsi,%rax
add    0x10(%rsp),%rsi
xor    %edx,%edx
nop
movzbl -0x3(%r10,%rdx,1),%ebx
mov    %bl,-0x3(%rsi,%rdx,1)
movzbl -0x2(%r10,%rdx,1),%ebx
mov    %bl,-0x2(%rsi,%rdx,1)
movzbl -0x1(%r10,%rdx,1),%ebx
mov    %bl,-0x1(%rsi,%rdx,1)
movzbl (%r10,%rdx,1),%ebx
mov    %bl,(%rsi,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%rax
jne    1400 <test_random+0x270>
jmp    1320 <test_random+0x190>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
sub    %rax,%r9
cmp    $0x7,%r9d
jg     1320 <test_random+0x190>
movslq %r9d,%rax
add    $0x8,%rbx
mov    %ebx,%r10d
cmp    $0x8,%r10
jae    1464 <test_random+0x2d4>
xor    %esi,%esi
jmp    15e1 <test_random+0x451>
mov    0x30(%rsp),%r11
lea    (%r11,%rax,1),%r9
lea    (%rsi,%r10,1),%rdx
cmp    %rdx,%r9
jae    1497 <test_random+0x307>
lea    (%rax,%r10,1),%rdx
add    %r11,%rdx
cmp    %rsi,%rdx
jbe    1497 <test_random+0x307>
xor    %esi,%esi
mov    0x8(%rsp),%r11
jmp    15e1 <test_random+0x451>
cmp    $0x20,%eax
jae    14ad <test_random+0x31d>
xor    %esi,%esi
jmp    1506 <test_random+0x376>
cmp    $0x20,%r10d
jae    154a <test_random+0x3ba>
xor    %esi,%esi
mov    0x8(%rsp),%r11
jmp    15a6 <test_random+0x416>
mov    %r9d,%edx
and    $0x1f,%edx
mov    %rax,%rsi
mov    %rdx,(%rsp)
sub    %rdx,%rsi
lea    (%rdi,%r10,1),%rbx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rbx,%rdx,1),%xmm0
movups (%rbx,%rdx,1),%xmm1
movups %xmm0,-0x10(%rbp,%rdx,1)
movups %xmm1,0x0(%rbp,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rsi
jne    14d0 <test_random+0x340>
mov    (%rsp),%rdx
test   %rdx,%rdx
je     1320 <test_random+0x190>
cmp    $0x8,%edx
jae    1506 <test_random+0x376>
add    %rsi,%r10
jmp    13be <test_random+0x22e>
mov    %rsi,%rdx
mov    %r9d,%esi
mov    %r9d,%ebx
and    $0x7,%ebx
mov    %rbx,%rbp
sub    %rbx,%rsi
lea    (%rcx,%r10,1),%rbx
add    %rsi,%r10
nop
mov    (%rbx,%rdx,1),%r11
mov    %r11,0x0(%r13,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rsi
jne    1520 <test_random+0x390>
test   %rbp,%rbp
mov    0x8(%rsp),%r11
mov    0x18(%rsp),%rbp
jne    13be <test_random+0x22e>
jmp    1320 <test_random+0x190>
mov    %ebx,%edx
and    $0x1f,%edx
mov    %r10,%rsi
mov    %rdx,(%rsp)
sub    %rdx,%rsi
lea    (%rax,%rbp,1),%rdx
xor    %r9d,%r9d
mov    0x8(%rsp),%r11
cs nopw 0x0(%rax,%rax,1)
nop
movups -0x10(%rdi,%r9,1),%xmm0
movups (%rdi,%r9,1),%xmm1
movups %xmm0,-0x10(%rdx,%r9,1)
movups %xmm1,(%rdx,%r9,1)
add    $0x20,%r9
cmp    %r9,%rsi
jne    1570 <test_random+0x3e0>
mov    (%rsp),%rdx
test   %rdx,%rdx
je     1320 <test_random+0x190>
cmp    $0x8,%edx
jae    15a6 <test_random+0x416>
add    %rsi,%rax
jmp    15e1 <test_random+0x451>
mov    %rsi,%rdx
mov    %ebx,%esi
mov    %ebx,%ebp
and    $0x7,%ebp
mov    %rbp,(%rsp)
sub    %rbp,%rsi
lea    (%rax,%r13,1),%r9
add    %rsi,%rax
xchg   %ax,%ax
mov    (%rcx,%rdx,1),%rbp
mov    %rbp,(%r9,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rsi
jne    15c0 <test_random+0x430>
cmpq   $0x0,(%rsp)
mov    0x18(%rsp),%rbp
je     1320 <test_random+0x190>
sub    %esi,%ebx
mov    %rsi,%r9
not    %r9
add    %r10,%r9
and    $0x3,%rbx
je     1617 <test_random+0x487>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rcx,%rsi,1),%edx
mov    %dl,0x0(%r13,%rax,1)
add    $0x1,%rax
add    $0x1,%rsi
add    $0xffffffffffffffff,%rbx
jne    1600 <test_random+0x470>
cmp    $0x3,%r9
jb     1320 <test_random+0x190>
add    0x10(%rsp),%rax
sub    %rsi,%r10
add    %r8,%rsi
xor    %edx,%edx
xchg   %ax,%ax
movzbl -0x3(%rsi,%rdx,1),%ebx
mov    %bl,-0x3(%rax,%rdx,1)
movzbl -0x2(%rsi,%rdx,1),%ebx
mov    %bl,-0x2(%rax,%rdx,1)
movzbl -0x1(%rsi,%rdx,1),%ebx
mov    %bl,-0x1(%rax,%rdx,1)
movzbl (%rsi,%rdx,1),%ebx
mov    %bl,(%rax,%rdx,1)
add    $0x4,%rdx
cmp    %rdx,%r10
jne    1630 <test_random+0x4a0>
jmp    1320 <test_random+0x190>
mov    0x2959(%rip),%rax
mov    (%rax),%edx
lea    0x9a0(%rip),%rdi
lea    0x989(%rip),%rsi
mov    $0xb7,%ecx
jmp    17f0 <test_random+0x660>
mov    (%r12,%rbx,1),%rsi
mov    0x2934(%rip),%rax
mov    (%rax),%ecx
lea    0x9ab(%rip),%rdi
mov    %rbp,%rdx
mov    $0xbe,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
jmp    17f7 <test_random+0x667>
mov    0x291f(%rip),%rax
mov    (%rax),%esi
mov    0x2926(%rip),%rax
mov    (%rax),%edx
lea    0x93d(%rip),%rdi
call   10a0 <open@plt>
test   %eax,%eax
js     1783 <test_random+0x5f3>
mov    %eax,%r14d
mov    $0x8,%ebx
lea    0x50(%rsp),%r15
nopl   (%rax)
mov    -0x8(%r12,%rbx,1),%rbp
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x8,%edx
mov    %rbp,%rcx
call   10b0 <pread@plt>
cmp    $0x8,%eax
jne    17a1 <test_random+0x611>
mov    0x50(%rsp),%rdx
mov    (%r12,%rbx,1),%rcx
cmp    %rcx,%rdx
jne    17bb <test_random+0x62b>
add    $0x10,%rbx
cmp    $0x100018,%rbx
jne    16e0 <test_random+0x550>
mov    %r14d,%edi
call   1060 <close@plt>
test   %eax,%eax
js     17d4 <test_random+0x644>
lea    0x8c9(%rip),%rdi
call   1040 <unlink@plt>
test   %eax,%eax
je     180b <test_random+0x67b>
mov    0x2875(%rip),%rax
mov    (%rax),%edx
lea    0x9da(%rip),%rdi
lea    0x8a5(%rip),%rsi
mov    $0xf7,%ecx
jmp    17f0 <test_random+0x660>
mov    0x2854(%rip),%rax
mov    (%rax),%edx
lea    0x8fd(%rip),%rdi
lea    0x884(%rip),%rsi
mov    $0xc4,%ecx
jmp    17f0 <test_random+0x660>
mov    0x2836(%rip),%rax
mov    (%rax),%edx
lea    0x90e(%rip),%rdi
lea    0x866(%rip),%rsi
mov    $0xe0,%ecx
jmp    17f0 <test_random+0x660>
mov    0x2818(%rip),%rax
mov    (%rax),%edx
lea    0x91e(%rip),%rdi
mov    %rbp,%rsi
mov    $0xe7,%ecx
jmp    17f0 <test_random+0x660>
lea    0x93a(%rip),%rdi
mov    %rbp,%rsi
mov    $0xec,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
jmp    17f7 <test_random+0x667>
mov    0x27e5(%rip),%rax
mov    (%rax),%edx
lea    0x88e(%rip),%rdi
lea    0x815(%rip),%rsi
mov    $0xf2,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    17fc <test_random+0x66c>

LLVM IR (-O0):
%struct.writes = type { i8*, %union.anon }
%union.anon = type { i64 }
%struct.writes.0 = type { i8* }
@.str = [16 x i8] c"test-random.dat\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRWXU = global i32 0
@.str.1 = [48 x i8] c"Fail to create file %s, errno = %d at line %d!\0A\00"
@errno = global i32 0
@.str.2 = [50 x i8] c"Fail to write (%lu: %lu), errno = %d at line %d!\0A\00"
@.str.3 = [47 x i8] c"Fail to close file %s, errno = %d at line %d!\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [46 x i8] c"Fail to open file %s, errno = %d at line %d!\0A\00"
@.str.5 = [45 x i8] c"Fail to read at %lu, errno = %d at line %d!\0A\00"
@.str.6 = [50 x i8] c"Fail to read at %lu (%lu versus %lu) at line %d!\0A\00"
@.str.7 = [48 x i8] c"Fail to remove file %s, errno = %d at line %d!\0A\00"
define i32 @test_random() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca %struct.writes*
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8** %11
%13 = call %struct.writes.0* @malloc(i32 1048592)
%14 = bitcast %struct.writes.0* %13 to %struct.writes*
store %struct.writes* %14, %struct.writes** %12
%15 = load %struct.writes*, %struct.writes** %12
%16 = getelementptr inbounds %struct.writes, %struct.writes* %15, i64 0
%17 = getelementptr inbounds %struct.writes, %struct.writes* %16, i32 0, i32 1
%18 = bitcast %union.anon* %17 to i64*
store i64 4660, i64* %18
%19 = load %struct.writes*, %struct.writes** %12
%20 = getelementptr inbounds %struct.writes, %struct.writes* %19, i64 0
%21 = getelementptr inbounds %struct.writes, %struct.writes* %20, i32 0, i32 1
%22 = bitcast %union.anon* %21 to [8 x i8]*
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %22, i64 0, i64 0
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = icmp ne i32 %25, 52
br i1 %26, label %27, label %31
27: ; preds = %0
%28 = load %struct.writes*, %struct.writes** %12
%29 = bitcast %struct.writes* %28 to %struct.writes.0*
%30 = call i32 @free(%struct.writes.0* %29)
store i32 2, i32* %1
br label %363
31: ; preds = %0
store i32 0, i32* %6
br label %32
32: ; preds = %50, %31
%33 = load i32, i32* %6
%34 = icmp slt i32 %33, 65537
br i1 %34, label %35, label %53
35: ; preds = %32
%36 = call i64 (...) @random()
%37 = inttoptr i64 %36 to i8*
%38 = load %struct.writes*, %struct.writes** %12
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds %struct.writes, %struct.writes* %38, i64 %40
%42 = getelementptr inbounds %struct.writes, %struct.writes* %41, i32 0, i32 0
store i8* %37, i8** %42
%43 = call i64 (...) @random()
%44 = load %struct.writes*, %struct.writes** %12
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds %struct.writes, %struct.writes* %44, i64 %46
%48 = getelementptr inbounds %struct.writes, %struct.writes* %47, i32 0, i32 1
%49 = bitcast %union.anon* %48 to i64*
store i64 %43, i64* %49
br label %50
50: ; preds = %35
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %32
53: ; preds = %32
%54 = load i8*, i8** %11
%55 = load i32, i32* @O_CREAT
%56 = load i32, i32* @O_RDWR
%57 = or i32 %55, %56
%58 = load i32, i32* @S_IRWXU
%59 = call i32 @open(i8* %54, i32 %57, i32 %58)
store i32 %59, i32* %3
%60 = load i32, i32* %3
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %53
%63 = load i8*, i8** %11
%64 = load i32, i32* @errno
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %63, i32 %64, i32 183)
store i32 1, i32* %1
br label %363
66: ; preds = %53
store i32 0, i32* %6
br label %67
67: ; preds = %105, %66
%68 = load i32, i32* %6
%69 = icmp slt i32 %68, 65537
br i1 %69, label %70, label %108
70: ; preds = %67
%71 = load i32, i32* %3
%72 = load %struct.writes*, %struct.writes** %12
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds %struct.writes, %struct.writes* %72, i64 %74
%76 = getelementptr inbounds %struct.writes, %struct.writes* %75, i32 0, i32 1
%77 = bitcast %union.anon* %76 to i64*
%78 = load %struct.writes*, %struct.writes** %12
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds %struct.writes, %struct.writes* %78, i64 %80
%82 = getelementptr inbounds %struct.writes, %struct.writes* %81, i32 0, i32 0
%83 = load i8*, i8** %82
%84 = call i32 @pwrite(i32 %71, i64* %77, i32 8, i8* %83)
store i32 %84, i32* %5
%85 = load i32, i32* %5
%86 = sext i32 %85 to i64
%87 = icmp ne i64 %86, 8
br i1 %87, label %88, label %104
88: ; preds = %70
%89 = load %struct.writes*, %struct.writes** %12
%90 = load i32, i32* %6
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds %struct.writes, %struct.writes* %89, i64 %91
%93 = getelementptr inbounds %struct.writes, %struct.writes* %92, i32 0, i32 1
%94 = bitcast %union.anon* %93 to i64*
%95 = load i64, i64* %94
%96 = load %struct.writes*, %struct.writes** %12
%97 = load i32, i32* %6
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds %struct.writes, %struct.writes* %96, i64 %98
%100 = getelementptr inbounds %struct.writes, %struct.writes* %99, i32 0, i32 0
%101 = load i8*, i8** %100
%102 = load i32, i32* @errno
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i64 %95, i8* %101, i32 %102, i32 190)
store i32 1, i32* %1
br label %363
104: ; preds = %70
br label %105
105: ; preds = %104
%106 = load i32, i32* %6
%107 = add nsw i32 %106, 1
store i32 %107, i32* %6
br label %67
108: ; preds = %67
%109 = load i32, i32* %3
%110 = call i32 @close(i32 %109)
store i32 %110, i32* %4
%111 = load i32, i32* %4
%112 = icmp slt i32 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %108
%114 = load i8*, i8** %11
%115 = load i32, i32* @errno
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %114, i32 %115, i32 196)
store i32 1, i32* %1
br label %363
117: ; preds = %108
store i32 0, i32* %6
br label %118
118: ; preds = %272, %117
%119 = load i32, i32* %6
%120 = icmp slt i32 %119, 65537
br i1 %120, label %121, label %275
121: ; preds = %118
%122 = load i32, i32* %6
%123 = add nsw i32 %122, 1
store i32 %123, i32* %7
br label %124
124: ; preds = %268, %121
%125 = load i32, i32* %7
%126 = icmp slt i32 %125, 65537
br i1 %126, label %127, label %271
127: ; preds = %124
%128 = load %struct.writes*, %struct.writes** %12
%129 = load i32, i32* %7
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds %struct.writes, %struct.writes* %128, i64 %130
%132 = getelementptr inbounds %struct.writes, %struct.writes* %131, i32 0, i32 0
%133 = load i8*, i8** %132
%134 = load %struct.writes*, %struct.writes** %12
%135 = load i32, i32* %6
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds %struct.writes, %struct.writes* %134, i64 %136
%138 = getelementptr inbounds %struct.writes, %struct.writes* %137, i32 0, i32 0
%139 = load i8*, i8** %138
%140 = getelementptr inbounds i8, i8* %139, i64 8
%141 = icmp uge i8* %133, %140
br i1 %141, label %142, label %143
142: ; preds = %127
br label %268
143: ; preds = %127
%144 = load %struct.writes*, %struct.writes** %12
%145 = load i32, i32* %7
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds %struct.writes, %struct.writes* %144, i64 %146
%148 = getelementptr inbounds %struct.writes, %struct.writes* %147, i32 0, i32 0
%149 = load i8*, i8** %148
%150 = getelementptr inbounds i8, i8* %149, i64 8
%151 = load %struct.writes*, %struct.writes** %12
%152 = load i32, i32* %6
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds %struct.writes, %struct.writes* %151, i64 %153
%155 = getelementptr inbounds %struct.writes, %struct.writes* %154, i32 0, i32 0
%156 = load i8*, i8** %155
%157 = icmp ule i8* %150, %156
br i1 %157, label %158, label %159
158: ; preds = %143
br label %268
159: ; preds = %143
%160 = load %struct.writes*, %struct.writes** %12
%161 = load i32, i32* %6
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds %struct.writes, %struct.writes* %160, i64 %162
%164 = getelementptr inbounds %struct.writes, %struct.writes* %163, i32 0, i32 0
%165 = load i8*, i8** %164
%166 = load %struct.writes*, %struct.writes** %12
%167 = load i32, i32* %7
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds %struct.writes, %struct.writes* %166, i64 %168
%170 = getelementptr inbounds %struct.writes, %struct.writes* %169, i32 0, i32 0
%171 = load i8*, i8** %170
%172 = icmp ugt i8* %165, %171
br i1 %172, label %173, label %220
173: ; preds = %159
store i32 0, i32* %9
%174 = load %struct.writes*, %struct.writes** %12
%175 = load i32, i32* %6
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds %struct.writes, %struct.writes* %174, i64 %176
%178 = getelementptr inbounds %struct.writes, %struct.writes* %177, i32 0, i32 0
%179 = load i8*, i8** %178
%180 = load %struct.writes*, %struct.writes** %12
%181 = load i32, i32* %7
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds %struct.writes, %struct.writes* %180, i64 %182
%184 = getelementptr inbounds %struct.writes, %struct.writes* %183, i32 0, i32 0
%185 = load i8*, i8** %184
%186 = ptrtoint i8* %179 to i64
%187 = ptrtoint i8* %185 to i64
%188 = sub i64 %186, %187
%189 = trunc i64 %188 to i32
store i32 %189, i32* %10
%190 = load i32, i32* %10
store i32 %190, i32* %8
br label %191
191: ; preds = %214, %173
%192 = load i32, i32* %8
%193 = icmp slt i32 %192, 8
br i1 %193, label %194, label %219
194: ; preds = %191
%195 = load %struct.writes*, %struct.writes** %12
%196 = load i32, i32* %7
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds %struct.writes, %struct.writes* %195, i64 %197
%199 = getelementptr inbounds %struct.writes, %struct.writes* %198, i32 0, i32 1
%200 = bitcast %union.anon* %199 to [8 x i8]*
%201 = load i32, i32* %8
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds [8 x i8], [8 x i8]* %200, i64 0, i64 %202
%204 = load i8, i8* %203
%205 = load %struct.writes*, %struct.writes** %12
%206 = load i32, i32* %6
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds %struct.writes, %struct.writes* %205, i64 %207
%209 = getelementptr inbounds %struct.writes, %struct.writes* %208, i32 0, i32 1
%210 = bitcast %union.anon* %209 to [8 x i8]*
%211 = load i32, i32* %9
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds [8 x i8], [8 x i8]* %210, i64 0, i64 %212
store i8 %204, i8* %213
br label %214
214: ; preds = %194
%215 = load i32, i32* %8
%216 = add nsw i32 %215, 1
store i32 %216, i32* %8
%217 = load i32, i32* %9
%218 = add nsw i32 %217, 1
store i32 %218, i32* %9
br label %191
219: ; preds = %191
br label %267
220: ; preds = %159
store i32 0, i32* %9
%221 = load %struct.writes*, %struct.writes** %12
%222 = load i32, i32* %7
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds %struct.writes, %struct.writes* %221, i64 %223
%225 = getelementptr inbounds %struct.writes, %struct.writes* %224, i32 0, i32 0
%226 = load i8*, i8** %225
%227 = load %struct.writes*, %struct.writes** %12
%228 = load i32, i32* %6
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds %struct.writes, %struct.writes* %227, i64 %229
%231 = getelementptr inbounds %struct.writes, %struct.writes* %230, i32 0, i32 0
%232 = load i8*, i8** %231
%233 = ptrtoint i8* %226 to i64
%234 = ptrtoint i8* %232 to i64
%235 = sub i64 %233, %234
%236 = trunc i64 %235 to i32
store i32 %236, i32* %10
%237 = load i32, i32* %10
store i32 %237, i32* %8
br label %238
238: ; preds = %261, %220
%239 = load i32, i32* %8
%240 = icmp slt i32 %239, 8
br i1 %240, label %241, label %266
241: ; preds = %238
%242 = load %struct.writes*, %struct.writes** %12
%243 = load i32, i32* %7
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds %struct.writes, %struct.writes* %242, i64 %244
%246 = getelementptr inbounds %struct.writes, %struct.writes* %245, i32 0, i32 1
%247 = bitcast %union.anon* %246 to [8 x i8]*
%248 = load i32, i32* %9
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds [8 x i8], [8 x i8]* %247, i64 0, i64 %249
%251 = load i8, i8* %250
%252 = load %struct.writes*, %struct.writes** %12
%253 = load i32, i32* %6
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds %struct.writes, %struct.writes* %252, i64 %254
%256 = getelementptr inbounds %struct.writes, %struct.writes* %255, i32 0, i32 1
%257 = bitcast %union.anon* %256 to [8 x i8]*
%258 = load i32, i32* %8
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [8 x i8], [8 x i8]* %257, i64 0, i64 %259
store i8 %251, i8* %260
br label %261
261: ; preds = %241
%262 = load i32, i32* %8
%263 = add nsw i32 %262, 1
store i32 %263, i32* %8
%264 = load i32, i32* %9
%265 = add nsw i32 %264, 1
store i32 %265, i32* %9
br label %238
266: ; preds = %238
br label %267
267: ; preds = %266, %219
br label %268
268: ; preds = %267, %158, %142
%269 = load i32, i32* %7
%270 = add nsw i32 %269, 1
store i32 %270, i32* %7
br label %124
271: ; preds = %124
br label %272
272: ; preds = %271
%273 = load i32, i32* %6
%274 = add nsw i32 %273, 1
store i32 %274, i32* %6
br label %118
275: ; preds = %118
%276 = load i8*, i8** %11
%277 = load i32, i32* @O_RDONLY
%278 = load i32, i32* @S_IRWXU
%279 = call i32 @open(i8* %276, i32 %277, i32 %278)
store i32 %279, i32* %3
%280 = load i32, i32* %3
%281 = icmp slt i32 %280, 0
br i1 %281, label %282, label %286
282: ; preds = %275
%283 = load i8*, i8** %11
%284 = load i32, i32* @errno
%285 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* %283, i32 %284, i32 224)
store i32 1, i32* %1
br label %363
286: ; preds = %275
store i32 0, i32* %6
br label %287
287: ; preds = %338, %286
%288 = load i32, i32* %6
%289 = icmp slt i32 %288, 65537
br i1 %289, label %290, label %341
290: ; preds = %287
%291 = load i32, i32* %3
%292 = load %struct.writes*, %struct.writes** %12
%293 = load i32, i32* %6
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds %struct.writes, %struct.writes* %292, i64 %294
%296 = getelementptr inbounds %struct.writes, %struct.writes* %295, i32 0, i32 0
%297 = load i8*, i8** %296
%298 = call i32 @pread(i32 %291, i64* %2, i32 8, i8* %297)
store i32 %298, i32* %5
%299 = load i32, i32* %5
%300 = sext i32 %299 to i64
%301 = icmp ne i64 %300, 8
br i1 %301, label %302, label %311
302: ; preds = %290
%303 = load %struct.writes*, %struct.writes** %12
%304 = load i32, i32* %6
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds %struct.writes, %struct.writes* %303, i64 %305
%307 = getelementptr inbounds %struct.writes, %struct.writes* %306, i32 0, i32 0
%308 = load i8*, i8** %307
%309 = load i32, i32* @errno
%310 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %308, i32 %309, i32 231)
store i32 1, i32* %1
br label %363
311: ; preds = %290
%312 = load i64, i64* %2
%313 = load %struct.writes*, %struct.writes** %12
%314 = load i32, i32* %6
%315 = sext i32 %314 to i64
%316 = getelementptr inbounds %struct.writes, %struct.writes* %313, i64 %315
%317 = getelementptr inbounds %struct.writes, %struct.writes* %316, i32 0, i32 1
%318 = bitcast %union.anon* %317 to i64*
%319 = load i64, i64* %318
%320 = icmp ne i64 %312, %319
br i1 %320, label %321, label %337
321: ; preds = %311
%322 = load %struct.writes*, %struct.writes** %12
%323 = load i32, i32* %6
%324 = sext i32 %323 to i64
%325 = getelementptr inbounds %struct.writes, %struct.writes* %322, i64 %324
%326 = getelementptr inbounds %struct.writes, %struct.writes* %325, i32 0, i32 0
%327 = load i8*, i8** %326
%328 = load i64, i64* %2
%329 = load %struct.writes*, %struct.writes** %12
%330 = load i32, i32* %6
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds %struct.writes, %struct.writes* %329, i64 %331
%333 = getelementptr inbounds %struct.writes, %struct.writes* %332, i32 0, i32 1
%334 = bitcast %union.anon* %333 to i64*
%335 = load i64, i64* %334
%336 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %327, i64 %328, i64 %335, i32 236)
store i32 1, i32* %1
br label %363
337: ; preds = %311
br label %338
338: ; preds = %337
%339 = load i32, i32* %6
%340 = add nsw i32 %339, 1
store i32 %340, i32* %6
br label %287
341: ; preds = %287
%342 = load i32, i32* %3
%343 = call i32 @close(i32 %342)
store i32 %343, i32* %4
%344 = load i32, i32* %4
%345 = icmp slt i32 %344, 0
br i1 %345, label %346, label %350
346: ; preds = %341
%347 = load i8*, i8** %11
%348 = load i32, i32* @errno
%349 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %347, i32 %348, i32 242)
store i32 1, i32* %1
br label %363
350: ; preds = %341
%351 = load i8*, i8** %11
%352 = call i32 @unlink(i8* %351)
store i32 %352, i32* %4
%353 = load i32, i32* %4
%354 = icmp ne i32 %353, 0
br i1 %354, label %355, label %359
355: ; preds = %350
%356 = load i8*, i8** %11
%357 = load i32, i32* @errno
%358 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i8* %356, i32 %357, i32 247)
store i32 1, i32* %1
br label %363
359: ; preds = %350
%360 = load %struct.writes*, %struct.writes** %12
%361 = bitcast %struct.writes* %360 to %struct.writes.0*
%362 = call i32 @free(%struct.writes.0* %361)
store i32 0, i32* %1
br label %363
363: ; preds = %359, %355, %346, %321, %302, %282, %113, %88, %62, %27
%364 = load i32, i32* %1
ret i32 %364
}

LLVM IR (-O2):
%struct.writes.0 = type { i8* }
%struct.writes = type { i8*, %union.anon }
%union.anon = type { i64 }
@.str = [16 x i8] c"test-random.dat\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRWXU = global i32 0
@.str.1 = [48 x i8] c"Fail to create file %s, errno = %d at line %d!\0A\00"
@errno = global i32 0
@.str.2 = [50 x i8] c"Fail to write (%lu: %lu), errno = %d at line %d!\0A\00"
@.str.3 = [47 x i8] c"Fail to close file %s, errno = %d at line %d!\0A\00"
@O_RDONLY = global i32 0
@.str.4 = [46 x i8] c"Fail to open file %s, errno = %d at line %d!\0A\00"
@.str.5 = [45 x i8] c"Fail to read at %lu, errno = %d at line %d!\0A\00"
@.str.6 = [50 x i8] c"Fail to read at %lu (%lu versus %lu) at line %d!\0A\00"
@.str.7 = [48 x i8] c"Fail to remove file %s, errno = %d at line %d!\0A\00"
define i32 @test_random() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call %struct.writes.0* @malloc(i32 1048592)
%4 = bitcast %struct.writes.0* %3 to %struct.writes*
%5 = getelementptr inbounds %struct.writes.0, %struct.writes.0* %3, i64 1
%6 = bitcast %struct.writes.0* %5 to i64*
store i64 4660, i64* %6
br label %7
7: ; preds = %0, %7
%8 = phi i64 [ 0, %0 ], [ %14, %7 ]
%9 = tail call i64 (...) @random()
%10 = inttoptr i64 %9 to i8*
%11 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %8, i32 0
store i8* %10, i8** %11
%12 = tail call i64 (...) @random()
%13 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %8, i32 1, i32 0
store i64 %12, i64* %13
%14 = add nuw nsw i64 %8, 1
%15 = icmp eq i64 %14, 65537
br i1 %15, label %16, label %7
16: ; preds = %7
%17 = load i32, i32* @O_CREAT
%18 = load i32, i32* @O_RDWR
%19 = or i32 %18, %17
%20 = load i32, i32* @S_IRWXU
%21 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20)
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %16
%24 = load i32, i32* @errno
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %24, i32 183)
br label %366
26: ; preds = %29
%27 = add nuw nsw i64 %30, 1
%28 = icmp eq i64 %27, 65537
br i1 %28, label %40, label %29
29: ; preds = %16, %26
%30 = phi i64 [ %27, %26 ], [ 0, %16 ]
%31 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %30, i32 1, i32 0
%32 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %30, i32 0
%33 = load i8*, i8** %32
%34 = tail call i32 @pwrite(i32 %21, i64* %31, i32 8, i8* %33)
%35 = icmp eq i32 %34, 8
br i1 %35, label %26, label %36
36: ; preds = %29
%37 = load i64, i64* %31
%38 = load i32, i32* @errno
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i64 %37, i8* %33, i32 %38, i32 190)
br label %366
40: ; preds = %26
%41 = tail call i32 @close(i32 %21)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i32, i32* @errno
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %44, i32 196)
br label %366
46: ; preds = %321, %49
%47 = add nuw nsw i64 %51, 1
%48 = icmp eq i64 %62, 65537
br i1 %48, label %325, label %49
49: ; preds = %40, %46
%50 = phi i64 [ %62, %46 ], [ 0, %40 ]
%51 = phi i64 [ %47, %46 ], [ 1, %40 ]
%52 = shl nuw nsw i64 %50, 1
%53 = or i64 %52, 1
%54 = getelementptr %struct.writes.0, %struct.writes.0* %3, i64 %53
%55 = bitcast %struct.writes.0* %54 to i8*
%56 = add nuw i64 %52, 3
%57 = shl nuw nsw i64 %50, 1
%58 = or i64 %57, 1
%59 = getelementptr %struct.writes.0, %struct.writes.0* %3, i64 %58
%60 = bitcast %struct.writes.0* %59 to i8*
%61 = add nuw i64 %57, 3
%62 = add nuw nsw i64 %50, 1
%63 = icmp ult i64 %50, 65536
br i1 %63, label %64, label %46
64: ; preds = %49
%65 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %50, i32 0
%66 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %50, i32 1
%67 = bitcast %union.anon* %66 to [8 x i8]*
br label %68
68: ; preds = %64, %321
%69 = phi i64 [ 0, %64 ], [ %324, %321 ]
%70 = phi i64 [ %51, %64 ], [ %322, %321 ]
%71 = shl i64 %69, 1
%72 = add i64 %56, %71
%73 = getelementptr %struct.writes.0, %struct.writes.0* %3, i64 %72
%74 = bitcast %struct.writes.0* %73 to i8*
%75 = shl i64 %69, 1
%76 = add i64 %61, %75
%77 = getelementptr %struct.writes.0, %struct.writes.0* %3, i64 %76
%78 = bitcast %struct.writes.0* %77 to i8*
%79 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %70, i32 0
%80 = load i8*, i8** %79
%81 = ptrtoint i8* %80 to i64
%82 = load i8*, i8** %65
%83 = ptrtoint i8* %82 to i64
%84 = getelementptr inbounds i8, i8* %82, i64 8
%85 = icmp ult i8* %80, %84
%86 = getelementptr inbounds i8, i8* %80, i64 8
%87 = icmp ugt i8* %86, %82
%88 = select i1 %85, i1 %87, i1 false
br i1 %88, label %89, label %321
89: ; preds = %68
%90 = icmp ugt i8* %82, %80
br i1 %90, label %91, label %206
91: ; preds = %89
%92 = ptrtoint i8* %82 to i64
%93 = ptrtoint i8* %80 to i64
%94 = sub i64 %92, %93
%95 = trunc i64 %94 to i32
%96 = icmp slt i32 %95, 8
br i1 %96, label %97, label %321
97: ; preds = %91
%98 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %70, i32 1
%99 = bitcast %union.anon* %98 to [8 x i8]*
%100 = shl i64 %94, 32
%101 = ashr exact i64 %100, 32
%102 = add i64 %93, 8
%103 = sub i64 %102, %92
%104 = and i64 %103, 4294967295
%105 = icmp ult i64 %104, 8
br i1 %105, label %159, label %106
106: ; preds = %97
%107 = getelementptr i8, i8* %60, i64 %104
%108 = getelementptr i8, i8* %78, i64 %101
%109 = add nsw i64 %101, %104
%110 = getelementptr i8, i8* %78, i64 %109
%111 = icmp ugt i8* %110, %60
%112 = icmp ult i8* %108, %107
%113 = and i1 %111, %112
br i1 %113, label %159, label %114
114: ; preds = %106
%115 = icmp ult i64 %104, 32
br i1 %115, label %139, label %116
116: ; preds = %114
%117 = and i64 %103, 31
%118 = sub nsw i64 %104, %117
br label %119
119: ; preds = %119, %116
%120 = phi i64 [ 0, %116 ], [ %132, %119 ]
%121 = add i64 %101, %120
%122 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %121
%123 = bitcast i8* %122 to <16 x i8>*
%124 = load <16 x i8>, <16 x i8>* %123
%125 = getelementptr inbounds i8, i8* %122, i64 16
%126 = bitcast i8* %125 to <16 x i8>*
%127 = load <16 x i8>, <16 x i8>* %126
%128 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %120
%129 = bitcast i8* %128 to <16 x i8>*
store <16 x i8> %124, <16 x i8>* %129
%130 = getelementptr inbounds i8, i8* %128, i64 16
%131 = bitcast i8* %130 to <16 x i8>*
store <16 x i8> %127, <16 x i8>* %131
%132 = add nuw i64 %120, 32
%133 = icmp eq i64 %132, %118
br i1 %133, label %134, label %119
134: ; preds = %119
%135 = icmp eq i64 %117, 0
br i1 %135, label %321, label %136
136: ; preds = %134
%137 = add nsw i64 %101, %118
%138 = icmp ult i64 %117, 8
br i1 %138, label %159, label %139
139: ; preds = %114, %136
%140 = phi i64 [ %118, %136 ], [ 0, %114 ]
%141 = add i64 %81, 8
%142 = sub i64 %141, %83
%143 = and i64 %142, 4294967295
%144 = and i64 %142, 7
%145 = sub nsw i64 %143, %144
%146 = add nsw i64 %101, %145
br label %147
147: ; preds = %147, %139
%148 = phi i64 [ %140, %139 ], [ %155, %147 ]
%149 = add i64 %101, %148
%150 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %149
%151 = bitcast i8* %150 to <8 x i8>*
%152 = load <8 x i8>, <8 x i8>* %151
%153 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %148
%154 = bitcast i8* %153 to <8 x i8>*
store <8 x i8> %152, <8 x i8>* %154
%155 = add nuw i64 %148, 8
%156 = icmp eq i64 %155, %145
br i1 %156, label %157, label %147
157: ; preds = %147
%158 = icmp eq i64 %144, 0
br i1 %158, label %321, label %159
159: ; preds = %106, %97, %136, %157
%160 = phi i64 [ %101, %97 ], [ %101, %106 ], [ %137, %136 ], [ %146, %157 ]
%161 = phi i64 [ 0, %97 ], [ 0, %106 ], [ %118, %136 ], [ %145, %157 ]
%162 = sub i64 %103, %161
%163 = xor i64 %161, -1
%164 = add nsw i64 %104, %163
%165 = and i64 %162, 3
%166 = icmp eq i64 %165, 0
br i1 %166, label %178, label %167
167: ; preds = %159, %167
%168 = phi i64 [ %174, %167 ], [ %160, %159 ]
%169 = phi i64 [ %175, %167 ], [ %161, %159 ]
%170 = phi i64 [ %176, %167 ], [ 0, %159 ]
%171 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %168
%172 = load i8, i8* %171
%173 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %169
store i8 %172, i8* %173
%174 = add nsw i64 %168, 1
%175 = add nuw nsw i64 %169, 1
%176 = add i64 %170, 1
%177 = icmp eq i64 %176, %165
br i1 %177, label %178, label %167
178: ; preds = %167, %159
%179 = phi i64 [ %160, %159 ], [ %174, %167 ]
%180 = phi i64 [ %161, %159 ], [ %175, %167 ]
%181 = icmp ult i64 %164, 3
br i1 %181, label %321, label %182
182: ; preds = %178, %182
%183 = phi i64 [ %203, %182 ], [ %179, %178 ]
%184 = phi i64 [ %204, %182 ], [ %180, %178 ]
%185 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %183
%186 = load i8, i8* %185
%187 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %184
store i8 %186, i8* %187
%188 = add nsw i64 %183, 1
%189 = add nuw nsw i64 %184, 1
%190 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %188
%191 = load i8, i8* %190
%192 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %189
store i8 %191, i8* %192
%193 = add nsw i64 %183, 2
%194 = add nuw nsw i64 %184, 2
%195 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %193
%196 = load i8, i8* %195
%197 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %194
store i8 %196, i8* %197
%198 = add nsw i64 %183, 3
%199 = add nuw nsw i64 %184, 3
%200 = getelementptr inbounds [8 x i8], [8 x i8]* %99, i64 0, i64 %198
%201 = load i8, i8* %200
%202 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %199
store i8 %201, i8* %202
%203 = add nsw i64 %183, 4
%204 = add nuw nsw i64 %184, 4
%205 = icmp eq i64 %204, %104
br i1 %205, label %321, label %182
206: ; preds = %89
%207 = ptrtoint i8* %80 to i64
%208 = ptrtoint i8* %82 to i64
%209 = sub i64 %207, %208
%210 = trunc i64 %209 to i32
%211 = icmp slt i32 %210, 8
br i1 %211, label %212, label %321
212: ; preds = %206
%213 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %70, i32 1
%214 = bitcast %union.anon* %213 to [8 x i8]*
%215 = shl i64 %209, 32
%216 = ashr exact i64 %215, 32
%217 = add i64 %208, 8
%218 = sub i64 %217, %207
%219 = and i64 %218, 4294967295
%220 = icmp ult i64 %219, 8
br i1 %220, label %274, label %221
221: ; preds = %212
%222 = getelementptr i8, i8* %55, i64 %216
%223 = add nsw i64 %216, %219
%224 = getelementptr i8, i8* %55, i64 %223
%225 = getelementptr i8, i8* %74, i64 %219
%226 = icmp ult i8* %222, %225
%227 = icmp ugt i8* %224, %74
%228 = and i1 %226, %227
br i1 %228, label %274, label %229
229: ; preds = %221
%230 = icmp ult i64 %219, 32
br i1 %230, label %254, label %231
231: ; preds = %229
%232 = and i64 %218, 31
%233 = sub nsw i64 %219, %232
br label %234
234: ; preds = %234, %231
%235 = phi i64 [ 0, %231 ], [ %247, %234 ]
%236 = add i64 %216, %235
%237 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %235
%238 = bitcast i8* %237 to <16 x i8>*
%239 = load <16 x i8>, <16 x i8>* %238
%240 = getelementptr inbounds i8, i8* %237, i64 16
%241 = bitcast i8* %240 to <16 x i8>*
%242 = load <16 x i8>, <16 x i8>* %241
%243 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %236
%244 = bitcast i8* %243 to <16 x i8>*
store <16 x i8> %239, <16 x i8>* %244
%245 = getelementptr inbounds i8, i8* %243, i64 16
%246 = bitcast i8* %245 to <16 x i8>*
store <16 x i8> %242, <16 x i8>* %246
%247 = add nuw i64 %235, 32
%248 = icmp eq i64 %247, %233
br i1 %248, label %249, label %234
249: ; preds = %234
%250 = icmp eq i64 %232, 0
br i1 %250, label %321, label %251
251: ; preds = %249
%252 = add nsw i64 %216, %233
%253 = icmp ult i64 %232, 8
br i1 %253, label %274, label %254
254: ; preds = %229, %251
%255 = phi i64 [ %233, %251 ], [ 0, %229 ]
%256 = add i64 %83, 8
%257 = sub i64 %256, %81
%258 = and i64 %257, 4294967295
%259 = and i64 %257, 7
%260 = sub nsw i64 %258, %259
%261 = add nsw i64 %216, %260
br label %262
262: ; preds = %262, %254
%263 = phi i64 [ %255, %254 ], [ %270, %262 ]
%264 = add i64 %216, %263
%265 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %263
%266 = bitcast i8* %265 to <8 x i8>*
%267 = load <8 x i8>, <8 x i8>* %266
%268 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %264
%269 = bitcast i8* %268 to <8 x i8>*
store <8 x i8> %267, <8 x i8>* %269
%270 = add nuw i64 %263, 8
%271 = icmp eq i64 %270, %260
br i1 %271, label %272, label %262
272: ; preds = %262
%273 = icmp eq i64 %259, 0
br i1 %273, label %321, label %274
274: ; preds = %221, %212, %251, %272
%275 = phi i64 [ %216, %212 ], [ %216, %221 ], [ %252, %251 ], [ %261, %272 ]
%276 = phi i64 [ 0, %212 ], [ 0, %221 ], [ %233, %251 ], [ %260, %272 ]
%277 = sub i64 %218, %276
%278 = xor i64 %276, -1
%279 = add nsw i64 %219, %278
%280 = and i64 %277, 3
%281 = icmp eq i64 %280, 0
br i1 %281, label %293, label %282
282: ; preds = %274, %282
%283 = phi i64 [ %289, %282 ], [ %275, %274 ]
%284 = phi i64 [ %290, %282 ], [ %276, %274 ]
%285 = phi i64 [ %291, %282 ], [ 0, %274 ]
%286 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %284
%287 = load i8, i8* %286
%288 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %283
store i8 %287, i8* %288
%289 = add nsw i64 %283, 1
%290 = add nuw nsw i64 %284, 1
%291 = add i64 %285, 1
%292 = icmp eq i64 %291, %280
br i1 %292, label %293, label %282
293: ; preds = %282, %274
%294 = phi i64 [ %275, %274 ], [ %289, %282 ]
%295 = phi i64 [ %276, %274 ], [ %290, %282 ]
%296 = icmp ult i64 %279, 3
br i1 %296, label %321, label %297
297: ; preds = %293, %297
%298 = phi i64 [ %318, %297 ], [ %294, %293 ]
%299 = phi i64 [ %319, %297 ], [ %295, %293 ]
%300 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %299
%301 = load i8, i8* %300
%302 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %298
store i8 %301, i8* %302
%303 = add nsw i64 %298, 1
%304 = add nuw nsw i64 %299, 1
%305 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %304
%306 = load i8, i8* %305
%307 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %303
store i8 %306, i8* %307
%308 = add nsw i64 %298, 2
%309 = add nuw nsw i64 %299, 2
%310 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %309
%311 = load i8, i8* %310
%312 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %308
store i8 %311, i8* %312
%313 = add nsw i64 %298, 3
%314 = add nuw nsw i64 %299, 3
%315 = getelementptr inbounds [8 x i8], [8 x i8]* %214, i64 0, i64 %314
%316 = load i8, i8* %315
%317 = getelementptr inbounds [8 x i8], [8 x i8]* %67, i64 0, i64 %313
store i8 %316, i8* %317
%318 = add nsw i64 %298, 4
%319 = add nuw nsw i64 %299, 4
%320 = icmp eq i64 %319, %219
br i1 %320, label %321, label %297
321: ; preds = %293, %297, %178, %182, %249, %272, %134, %157, %206, %91, %68
%322 = add nuw nsw i64 %70, 1
%323 = icmp eq i64 %322, 65537
%324 = add i64 %69, 1
br i1 %323, label %46, label %68
325: ; preds = %46
%326 = load i32, i32* @O_RDONLY
%327 = load i32, i32* @S_IRWXU
%328 = tail call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %326, i32 %327)
%329 = icmp slt i32 %328, 0
br i1 %329, label %330, label %336
330: ; preds = %325
%331 = load i32, i32* @errno
%332 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %331, i32 224)
br label %366
333: ; preds = %345
%334 = add nuw nsw i64 %337, 1
%335 = icmp eq i64 %334, 65537
br i1 %335, label %352, label %336
336: ; preds = %325, %333
%337 = phi i64 [ %334, %333 ], [ 0, %325 ]
%338 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %337, i32 0
%339 = load i8*, i8** %338
%340 = call i32 @pread(i32 %328, i64* %1, i32 8, i8* %339)
%341 = icmp eq i32 %340, 8
br i1 %341, label %345, label %342
342: ; preds = %336
%343 = load i32, i32* @errno
%344 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i8* %339, i32 %343, i32 231)
br label %366
345: ; preds = %336
%346 = load i64, i64* %1
%347 = getelementptr inbounds %struct.writes, %struct.writes* %4, i64 %337, i32 1, i32 0
%348 = load i64, i64* %347
%349 = icmp eq i64 %346, %348
br i1 %349, label %333, label %350
350: ; preds = %345
%351 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* %339, i64 %346, i64 %348, i32 236)
br label %366
352: ; preds = %333
%353 = tail call i32 @close(i32 %328)
%354 = icmp slt i32 %353, 0
br i1 %354, label %355, label %358
355: ; preds = %352
%356 = load i32, i32* @errno
%357 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %356, i32 242)
br label %366
358: ; preds = %352
%359 = tail call i32 @unlink(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%360 = icmp eq i32 %359, 0
br i1 %360, label %364, label %361
361: ; preds = %358
%362 = load i32, i32* @errno
%363 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %362, i32 247)
br label %366
364: ; preds = %358
%365 = tail call i32 @free(%struct.writes.0* %3)
br label %366
366: ; preds = %364, %361, %355, %350, %342, %330, %43, %36, %23
%367 = phi i32 [ 1, %23 ], [ 1, %36 ], [ 1, %43 ], [ 1, %330 ], [ 1, %342 ], [ 1, %350 ], [ 1, %355 ], [ 1, %361 ], [ 0, %364 ]
ret i32 %367
}