#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ clearerr(int /*<<< orphan*/ *);
int /*<<< orphan*/ fail(char *);
scalar_t__ fclose(int /*<<< orphan*/ *);
scalar_t__ fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ pr(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ unlink(char *);
void test_sio3(void) {
  FILE *f;
  static char buf[1024];
  int i, j;
  if ((f = fopen("stdio.tmp", "w+")) == NULL) {
    fail("fopen-5");
    return;
  }
  pr("fwrite");
  for (i = 31; i <= 527; i += 31) {
    memset(buf, i, i);
    if (fwrite(buf, 1, i, f) != i)
      fail("fwrite-1");
  }
  rewind(f);
  pr("fread");
  for (i = 31; i <= 527; i += 31) {
    memset(buf, i, i);
    if (fread(buf, 1, i, f) != i)
      fail("fread-1");
    for (j = 0; j < i; j++) {
      if ((buf[j] & 0xFF) != i % 256)
        break;
    }
    if (j < i) {
      fail("fread-2");
      break;
    }
  }
  if (fclose(f))
    fail("fclose-5");
  if ((f = fopen("stdio.tmp", "w+")) == NULL) {
    fail("fopen-5");
    return;
  }
  for (i = 0; i < 1024; i++)
    buf[i] = '5';
  for (i = 0; i < 16; i++) {
    if (fwrite(buf, 1, 1024, f) != 1024) {
      fail("fwrite-2");
      break;
    }
  }
  rewind(f);
  for (i = 0; i < 16; i++) {
    if (fread(buf, 1, 1024, f) != 1024) {
      fail("fread-3");
      break;
    }
  }
  if (fgetc(f) != EOF)
    fail("fread-4");
  clearerr(f);
  rewind(f);
  pr("fseek/ftell");
  if (fseek(f, 0, SEEK_END))
    fail("fseek-1");
  if (ftell(f) != 16384)
    fail("ftell-1");
  if (fseek(f, 8100, SEEK_SET))
    fail("fseek-2");
  if (ftell(f) != 8100)
    fail("fseek-3");
  if (fseek(f, 1900, SEEK_CUR))
    fail("fseek-4");
  if (ftell(f) != 10000)
    fail("fseek-5");
  fclose(f);
  unlink("stdio.tmp");
}


x86 assembly (clang, -O0):
<test_sio3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe21(%rip),%rdi
lea    0xe24(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    120a <test_sio3+0x3a>
lea    0xe0d(%rip),%rdi
call   1050 <fail@plt>
jmp    15e7 <test_sio3+0x417>
lea    0xe04(%rip),%rdi
call   1080 <pr@plt>
movl   $0x1f,-0xc(%rbp)
cmpl   $0x20f,-0xc(%rbp)
jg     127c <test_sio3+0xac>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0x2e69(%rip),%rdi
call   1090 <memset@plt>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0x2e56(%rip),%rdi
mov    $0x1,%esi
call   10f0 <fwrite@plt>
cmp    -0xc(%rbp),%eax
je     1269 <test_sio3+0x99>
lea    0xdb8(%rip),%rdi
call   1050 <fail@plt>
jmp    126e <test_sio3+0x9e>
mov    -0xc(%rbp),%eax
add    $0x1f,%eax
mov    %eax,-0xc(%rbp)
jmp    121d <test_sio3+0x4d>
mov    -0x8(%rbp),%rdi
call   1070 <rewind@plt>
lea    0xd99(%rip),%rdi
call   1080 <pr@plt>
movl   $0x1f,-0xc(%rbp)
cmpl   $0x20f,-0xc(%rbp)
jg     136c <test_sio3+0x19c>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0x2dee(%rip),%rdi
call   1090 <memset@plt>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0x2ddb(%rip),%rdi
mov    $0x1,%esi
call   1040 <fread@plt>
cmp    -0xc(%rbp),%eax
je     12e4 <test_sio3+0x114>
lea    0xd4c(%rip),%rdi
call   1050 <fail@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    133c <test_sio3+0x16c>
movslq -0x10(%rbp),%rcx
lea    0x2d9e(%rip),%rax
movsbl (%rax,%rcx,1),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
cmp    %edx,%eax
je     1329 <test_sio3+0x159>
jmp    133c <test_sio3+0x16c>
jmp    132e <test_sio3+0x15e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12eb <test_sio3+0x11b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1359 <test_sio3+0x189>
lea    0xce4(%rip),%rdi
call   1050 <fail@plt>
jmp    136c <test_sio3+0x19c>
jmp    135e <test_sio3+0x18e>
mov    -0xc(%rbp),%eax
add    $0x1f,%eax
mov    %eax,-0xc(%rbp)
jmp    1298 <test_sio3+0xc8>
mov    -0x8(%rbp),%rdi
call   1060 <fclose@plt>
cmp    $0x0,%rax
je     138b <test_sio3+0x1bb>
lea    0xcb5(%rip),%rdi
call   1050 <fail@plt>
lea    0xc6e(%rip),%rdi
lea    0xc71(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    13bd <test_sio3+0x1ed>
lea    0xc5a(%rip),%rdi
call   1050 <fail@plt>
jmp    15e7 <test_sio3+0x417>
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    13ee <test_sio3+0x21e>
movslq -0xc(%rbp),%rcx
lea    0x2cc4(%rip),%rax
movb   $0x35,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13c4 <test_sio3+0x1f4>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1448 <test_sio3+0x278>
mov    -0x8(%rbp),%rcx
lea    0x2c96(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
je     1435 <test_sio3+0x265>
lea    0xc19(%rip),%rdi
call   1050 <fail@plt>
jmp    1448 <test_sio3+0x278>
jmp    143a <test_sio3+0x26a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13f5 <test_sio3+0x225>
mov    -0x8(%rbp),%rdi
call   1070 <rewind@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    14ab <test_sio3+0x2db>
mov    -0x8(%rbp),%rcx
lea    0x2c33(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
cmp    $0x400,%eax
je     1498 <test_sio3+0x2c8>
lea    0xbbf(%rip),%rdi
call   1050 <fail@plt>
jmp    14ab <test_sio3+0x2db>
jmp    149d <test_sio3+0x2cd>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1458 <test_sio3+0x288>
mov    -0x8(%rbp),%rdi
call   10a0 <fgetc@plt>
mov    0x2b1d(%rip),%rcx
cmp    (%rcx),%rax
je     14d0 <test_sio3+0x300>
lea    0xb8a(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   10c0 <clearerr@plt>
mov    -0x8(%rbp),%rdi
call   1070 <rewind@plt>
lea    0xb74(%rip),%rdi
call   1080 <pr@plt>
mov    -0x8(%rbp),%rdi
mov    0x2aef(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10d0 <fseek@plt>
cmp    $0x0,%rax
je     1518 <test_sio3+0x348>
lea    0xb56(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <ftell@plt>
cmp    $0x4000,%eax
je     1538 <test_sio3+0x368>
lea    0xb3e(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
mov    0x2a85(%rip),%rax
mov    (%rax),%edx
mov    $0x1fa4,%esi
call   10d0 <fseek@plt>
cmp    $0x0,%rax
je     1565 <test_sio3+0x395>
lea    0xb19(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <ftell@plt>
cmp    $0x1fa4,%eax
je     1585 <test_sio3+0x3b5>
lea    0xb01(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
mov    0x2a50(%rip),%rax
mov    (%rax),%edx
mov    $0x76c,%esi
call   10d0 <fseek@plt>
cmp    $0x0,%rax
je     15b2 <test_sio3+0x3e2>
lea    0xadc(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   10b0 <ftell@plt>
cmp    $0x2710,%eax
je     15d2 <test_sio3+0x402>
lea    0xac4(%rip),%rdi
call   1050 <fail@plt>
mov    -0x8(%rbp),%rdi
call   1060 <fclose@plt>
lea    0xa1e(%rip),%rdi
call   1030 <unlink@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sio3>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xe21(%rip),%rdi
lea    0xe24(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     18c8 <test_sio3+0x6f8>
mov    %rax,%r14
lea    0xe17(%rip),%rdi
call   1080 <pr@plt>
xor    %ebx,%ebx
lea    0x2e94(%rip),%r15
lea    0xe09(%rip),%r12
jmp    1228 <test_sio3+0x58>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x1f1,%ebx
jae    1257 <test_sio3+0x87>
add    $0x1f,%ebx
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1090 <memset@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    %eax,%ebx
je     1220 <test_sio3+0x50>
mov    %r12,%rdi
call   1050 <fail@plt>
jmp    1220 <test_sio3+0x50>
mov    %r14,%rdi
call   1070 <rewind@plt>
lea    0xdbf(%rip),%rdi
call   1080 <pr@plt>
mov    $0x1f,%ebx
lea    0xdb4(%rip),%r12
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1090 <memset@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
mov    %eax,%eax
cmp    %rax,%rbx
je     12a4 <test_sio3+0xd4>
mov    %r12,%rdi
call   1050 <fail@plt>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
cmp    %bl,(%rax,%r15,1)
jne    12d1 <test_sio3+0x101>
add    $0x1,%rax
cmp    %rax,%rbx
jne    12b0 <test_sio3+0xe0>
lea    0x1f(%rbx),%rax
cmp    $0x1f1,%rbx
mov    %rax,%rbx
jb     1277 <test_sio3+0xa7>
jmp    12dd <test_sio3+0x10d>
lea    0xd5b(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
test   %rax,%rax
je     12f6 <test_sio3+0x126>
lea    0xd4a(%rip),%rdi
call   1050 <fail@plt>
lea    0xd03(%rip),%rdi
lea    0xd06(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     18c8 <test_sio3+0x6f8>
mov    %rax,%r14
lea    0x2d84(%rip),%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
mov    $0x35,%esi
call   1090 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2d4b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2d27(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2d03(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2cdf(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2cbb(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2c97(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2c73(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2c4f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2c2b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2c07(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2be3(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2bbf(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2b9f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2b7f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
jne    155a <test_sio3+0x38a>
lea    0x2b5f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   10f0 <fwrite@plt>
cmp    $0x400,%eax
je     1566 <test_sio3+0x396>
lea    0xae3(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   1070 <rewind@plt>
lea    0x2b2b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2b07(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2ae3(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2abf(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2a9b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2a77(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2a53(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2a2f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x2a0b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x29e7(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x29c3(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x299f(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x297b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x295b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x293b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
jne    179e <test_sio3+0x5ce>
lea    0x291b(%rip),%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r14,%rcx
call   1040 <fread@plt>
cmp    $0x400,%eax
je     17aa <test_sio3+0x5da>
lea    0x8a8(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   10a0 <fgetc@plt>
mov    0x281f(%rip),%rcx
cmp    (%rcx),%rax
je     17ca <test_sio3+0x5fa>
lea    0x890(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   10c0 <clearerr@plt>
mov    %r14,%rdi
call   1070 <rewind@plt>
lea    0x87c(%rip),%rdi
call   1080 <pr@plt>
mov    0x27fb(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
test   %rax,%rax
je     180a <test_sio3+0x63a>
lea    0x864(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
cmp    $0x4000,%eax
je     1825 <test_sio3+0x655>
lea    0x851(%rip),%rdi
call   1050 <fail@plt>
mov    0x279c(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x1fa4,%esi
call   10d0 <fseek@plt>
test   %rax,%rax
je     184c <test_sio3+0x67c>
lea    0x832(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
cmp    $0x1fa4,%eax
je     1867 <test_sio3+0x697>
lea    0x81f(%rip),%rdi
call   1050 <fail@plt>
mov    0x2772(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x76c,%esi
call   10d0 <fseek@plt>
test   %rax,%rax
je     188e <test_sio3+0x6be>
lea    0x800(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   10b0 <ftell@plt>
cmp    $0x2710,%eax
je     18a9 <test_sio3+0x6d9>
lea    0x7ed(%rip),%rdi
call   1050 <fail@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
lea    0x748(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <unlink@plt>
lea    0x73e(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <fail@plt>

LLVM IR (-O0):
@test_sio3.buf = internal global [1024 x i8] zeroinitializer
@.str = [10 x i8] c"stdio.tmp\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [8 x i8] c"fopen-5\00"
@.str.3 = [7 x i8] c"fwrite\00"
@.str.4 = [9 x i8] c"fwrite-1\00"
@.str.5 = [6 x i8] c"fread\00"
@.str.6 = [8 x i8] c"fread-1\00"
@.str.7 = [8 x i8] c"fread-2\00"
@.str.8 = [9 x i8] c"fclose-5\00"
@.str.9 = [9 x i8] c"fwrite-2\00"
@.str.10 = [8 x i8] c"fread-3\00"
@EOF = global i64 0
@.str.11 = [8 x i8] c"fread-4\00"
@.str.12 = [12 x i8] c"fseek/ftell\00"
@SEEK_END = global i32 0
@.str.13 = [8 x i8] c"fseek-1\00"
@.str.14 = [8 x i8] c"ftell-1\00"
@SEEK_SET = global i32 0
@.str.15 = [8 x i8] c"fseek-2\00"
@.str.16 = [8 x i8] c"fseek-3\00"
@SEEK_CUR = global i32 0
@.str.17 = [8 x i8] c"fseek-4\00"
@.str.18 = [8 x i8] c"fseek-5\00"
define void @test_sio3() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %183
8: ; preds = %0
%9 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 31, i32* %2
br label %10
10: ; preds = %25, %8
%11 = load i32, i32* %2
%12 = icmp sle i32 %11, 527
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 %14, i32 %15)
%17 = load i32, i32* %2
%18 = load i32*, i32** %1
%19 = call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 %17, i32* %18)
%20 = load i32, i32* %2
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 31
store i32 %27, i32* %2
br label %10
28: ; preds = %10
%29 = load i32*, i32** %1
%30 = call i32 @rewind(i32* %29)
%31 = call i32 @pr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 31, i32* %2
br label %32
32: ; preds = %73, %28
%33 = load i32, i32* %2
%34 = icmp sle i32 %33, 527
br i1 %34, label %35, label %76
35: ; preds = %32
%36 = load i32, i32* %2
%37 = load i32, i32* %2
%38 = call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 %36, i32 %37)
%39 = load i32, i32* %2
%40 = load i32*, i32** %1
%41 = call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 %39, i32* %40)
%42 = load i32, i32* %2
%43 = icmp ne i32 %41, %42
br i1 %43, label %44, label %46
44: ; preds = %35
%45 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %46
46: ; preds = %44, %35
store i32 0, i32* %3
br label %47
47: ; preds = %63, %46
%48 = load i32, i32* %3
%49 = load i32, i32* %2
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %66
51: ; preds = %47
%52 = load i32, i32* %3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = and i32 %56, 255
%58 = load i32, i32* %2
%59 = srem i32 %58, 256
%60 = icmp ne i32 %57, %59
br i1 %60, label %61, label %62
61: ; preds = %51
br label %66
62: ; preds = %51
br label %63
63: ; preds = %62
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1
store i32 %65, i32* %3
br label %47
66: ; preds = %61, %47
%67 = load i32, i32* %3
%68 = load i32, i32* %2
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %72
70: ; preds = %66
%71 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %76
72: ; preds = %66
br label %73
73: ; preds = %72
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 31
store i32 %75, i32* %2
br label %32
76: ; preds = %70, %32
%77 = load i32*, i32** %1
%78 = call i64 @fclose(i32* %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %82
82: ; preds = %80, %76
%83 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %83, i32** %1
%84 = icmp eq i32* %83, null
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %183
87: ; preds = %82
store i32 0, i32* %2
br label %88
88: ; preds = %95, %87
%89 = load i32, i32* %2
%90 = icmp slt i32 %89, 1024
br i1 %90, label %91, label %98
91: ; preds = %88
%92 = load i32, i32* %2
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 %93
store i8 53, i8* %94
br label %95
95: ; preds = %91
%96 = load i32, i32* %2
%97 = add nsw i32 %96, 1
store i32 %97, i32* %2
br label %88
98: ; preds = %88
store i32 0, i32* %2
br label %99
99: ; preds = %109, %98
%100 = load i32, i32* %2
%101 = icmp slt i32 %100, 16
br i1 %101, label %102, label %112
102: ; preds = %99
%103 = load i32*, i32** %1
%104 = call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %103)
%105 = icmp ne i32 %104, 1024
br i1 %105, label %106, label %108
106: ; preds = %102
%107 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %112
108: ; preds = %102
br label %109
109: ; preds = %108
%110 = load i32, i32* %2
%111 = add nsw i32 %110, 1
store i32 %111, i32* %2
br label %99
112: ; preds = %106, %99
%113 = load i32*, i32** %1
%114 = call i32 @rewind(i32* %113)
store i32 0, i32* %2
br label %115
115: ; preds = %125, %112
%116 = load i32, i32* %2
%117 = icmp slt i32 %116, 16
br i1 %117, label %118, label %128
118: ; preds = %115
%119 = load i32*, i32** %1
%120 = call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %119)
%121 = icmp ne i32 %120, 1024
br i1 %121, label %122, label %124
122: ; preds = %118
%123 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %128
124: ; preds = %118
br label %125
125: ; preds = %124
%126 = load i32, i32* %2
%127 = add nsw i32 %126, 1
store i32 %127, i32* %2
br label %115
128: ; preds = %122, %115
%129 = load i32*, i32** %1
%130 = call i64 @fgetc(i32* %129)
%131 = load i64, i64* @EOF
%132 = icmp ne i64 %130, %131
br i1 %132, label %133, label %135
133: ; preds = %128
%134 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %135
135: ; preds = %133, %128
%136 = load i32*, i32** %1
%137 = call i32 @clearerr(i32* %136)
%138 = load i32*, i32** %1
%139 = call i32 @rewind(i32* %138)
%140 = call i32 @pr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%141 = load i32*, i32** %1
%142 = load i32, i32* @SEEK_END
%143 = call i64 @fseek(i32* %141, i32 0, i32 %142)
%144 = icmp ne i64 %143, 0
br i1 %144, label %145, label %147
145: ; preds = %135
%146 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %147
147: ; preds = %145, %135
%148 = load i32*, i32** %1
%149 = call i32 @ftell(i32* %148)
%150 = icmp ne i32 %149, 16384
br i1 %150, label %151, label %153
151: ; preds = %147
%152 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %153
153: ; preds = %151, %147
%154 = load i32*, i32** %1
%155 = load i32, i32* @SEEK_SET
%156 = call i64 @fseek(i32* %154, i32 8100, i32 %155)
%157 = icmp ne i64 %156, 0
br i1 %157, label %158, label %160
158: ; preds = %153
%159 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
br label %160
160: ; preds = %158, %153
%161 = load i32*, i32** %1
%162 = call i32 @ftell(i32* %161)
%163 = icmp ne i32 %162, 8100
br i1 %163, label %164, label %166
164: ; preds = %160
%165 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
br label %166
166: ; preds = %164, %160
%167 = load i32*, i32** %1
%168 = load i32, i32* @SEEK_CUR
%169 = call i64 @fseek(i32* %167, i32 1900, i32 %168)
%170 = icmp ne i64 %169, 0
br i1 %170, label %171, label %173
171: ; preds = %166
%172 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
br label %173
173: ; preds = %171, %166
%174 = load i32*, i32** %1
%175 = call i32 @ftell(i32* %174)
%176 = icmp ne i32 %175, 10000
br i1 %176, label %177, label %179
177: ; preds = %173
%178 = call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
br label %179
179: ; preds = %177, %173
%180 = load i32*, i32** %1
%181 = call i64 @fclose(i32* %180)
%182 = call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %183
183: ; preds = %179, %85, %6
ret void
}

LLVM IR (-O2):
@test_sio3.buf = internal global [1024 x i8] zeroinitializer
@.str = [10 x i8] c"stdio.tmp\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [8 x i8] c"fopen-5\00"
@.str.3 = [7 x i8] c"fwrite\00"
@.str.4 = [9 x i8] c"fwrite-1\00"
@.str.5 = [6 x i8] c"fread\00"
@.str.6 = [8 x i8] c"fread-1\00"
@.str.7 = [8 x i8] c"fread-2\00"
@.str.8 = [9 x i8] c"fclose-5\00"
@.str.9 = [9 x i8] c"fwrite-2\00"
@.str.10 = [8 x i8] c"fread-3\00"
@EOF = global i64 0
@.str.11 = [8 x i8] c"fread-4\00"
@.str.12 = [12 x i8] c"fseek/ftell\00"
@SEEK_END = global i32 0
@.str.13 = [8 x i8] c"fseek-1\00"
@.str.14 = [8 x i8] c"ftell-1\00"
@SEEK_SET = global i32 0
@.str.15 = [8 x i8] c"fseek-2\00"
@.str.16 = [8 x i8] c"fseek-3\00"
@SEEK_CUR = global i32 0
@.str.17 = [8 x i8] c"fseek-4\00"
@.str.18 = [8 x i8] c"fseek-5\00"
define void @test_sio3() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %200
5: ; preds = %0
%6 = tail call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %7
7: ; preds = %5, %14
%8 = phi i32 [ 31, %5 ], [ %15, %14 ]
%9 = tail call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 %8, i32 %8)
%10 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 %8, i32* %1)
%11 = icmp eq i32 %10, %8
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %7, %12
%15 = add nuw nsw i32 %8, 31
%16 = icmp ult i32 %8, 497
br i1 %16, label %7, label %17
17: ; preds = %14
%18 = tail call i32 @rewind(i32* %1)
%19 = tail call i32 @pr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %20
20: ; preds = %17, %41
%21 = phi i64 [ 31, %17 ], [ %42, %41 ]
%22 = trunc i64 %21 to i32
%23 = tail call i32 @memset(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 %22, i32 %22)
%24 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 %22, i32* %1)
%25 = zext i32 %24 to i64
%26 = icmp eq i64 %21, %25
br i1 %26, label %29, label %27
27: ; preds = %20
%28 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
br label %29
29: ; preds = %27, %20
%30 = trunc i64 %21 to i8
br label %33
31: ; preds = %33
%32 = icmp eq i64 %38, %21
br i1 %32, label %41, label %33
33: ; preds = %29, %31
%34 = phi i64 [ 0, %29 ], [ %38, %31 ]
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, %30
%38 = add nuw nsw i64 %34, 1
br i1 %37, label %31, label %39
39: ; preds = %33
%40 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
br label %44
41: ; preds = %31
%42 = add nuw nsw i64 %21, 31
%43 = icmp ult i64 %21, 497
br i1 %43, label %20, label %44
44: ; preds = %41, %39
%45 = tail call i64 @fclose(i32* %1)
%46 = icmp eq i64 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %44
%48 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %49
49: ; preds = %47, %44
%50 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%51 = icmp eq i32* %50, null
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%54 = icmp eq i32 %53, 1024
br i1 %54, label %57, label %102
55: ; preds = %49
%56 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %200
57: ; preds = %52
%58 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%59 = icmp eq i32 %58, 1024
br i1 %59, label %60, label %102
60: ; preds = %57
%61 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%62 = icmp eq i32 %61, 1024
br i1 %62, label %63, label %102
63: ; preds = %60
%64 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%65 = icmp eq i32 %64, 1024
br i1 %65, label %66, label %102
66: ; preds = %63
%67 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%68 = icmp eq i32 %67, 1024
br i1 %68, label %69, label %102
69: ; preds = %66
%70 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%71 = icmp eq i32 %70, 1024
br i1 %71, label %72, label %102
72: ; preds = %69
%73 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%74 = icmp eq i32 %73, 1024
br i1 %74, label %75, label %102
75: ; preds = %72
%76 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%77 = icmp eq i32 %76, 1024
br i1 %77, label %78, label %102
78: ; preds = %75
%79 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%80 = icmp eq i32 %79, 1024
br i1 %80, label %81, label %102
81: ; preds = %78
%82 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%83 = icmp eq i32 %82, 1024
br i1 %83, label %84, label %102
84: ; preds = %81
%85 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%86 = icmp eq i32 %85, 1024
br i1 %86, label %87, label %102
87: ; preds = %84
%88 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%89 = icmp eq i32 %88, 1024
br i1 %89, label %90, label %102
90: ; preds = %87
%91 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%92 = icmp eq i32 %91, 1024
br i1 %92, label %93, label %102
93: ; preds = %90
%94 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%95 = icmp eq i32 %94, 1024
br i1 %95, label %96, label %102
96: ; preds = %93
%97 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%98 = icmp eq i32 %97, 1024
br i1 %98, label %99, label %102
99: ; preds = %96
%100 = tail call i32 @fwrite(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%101 = icmp eq i32 %100, 1024
br i1 %101, label %104, label %102
102: ; preds = %99, %96, %93, %90, %87, %84, %81, %78, %75, %72, %69, %66, %63, %60, %57, %52
%103 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %104
104: ; preds = %99, %102
%105 = tail call i32 @rewind(i32* %50)
%106 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%107 = icmp eq i32 %106, 1024
br i1 %107, label %108, label %153
108: ; preds = %104
%109 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%110 = icmp eq i32 %109, 1024
br i1 %110, label %111, label %153
111: ; preds = %108
%112 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%113 = icmp eq i32 %112, 1024
br i1 %113, label %114, label %153
114: ; preds = %111
%115 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%116 = icmp eq i32 %115, 1024
br i1 %116, label %117, label %153
117: ; preds = %114
%118 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%119 = icmp eq i32 %118, 1024
br i1 %119, label %120, label %153
120: ; preds = %117
%121 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%122 = icmp eq i32 %121, 1024
br i1 %122, label %123, label %153
123: ; preds = %120
%124 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%125 = icmp eq i32 %124, 1024
br i1 %125, label %126, label %153
126: ; preds = %123
%127 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%128 = icmp eq i32 %127, 1024
br i1 %128, label %129, label %153
129: ; preds = %126
%130 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%131 = icmp eq i32 %130, 1024
br i1 %131, label %132, label %153
132: ; preds = %129
%133 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%134 = icmp eq i32 %133, 1024
br i1 %134, label %135, label %153
135: ; preds = %132
%136 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%137 = icmp eq i32 %136, 1024
br i1 %137, label %138, label %153
138: ; preds = %135
%139 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%140 = icmp eq i32 %139, 1024
br i1 %140, label %141, label %153
141: ; preds = %138
%142 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%143 = icmp eq i32 %142, 1024
br i1 %143, label %144, label %153
144: ; preds = %141
%145 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%146 = icmp eq i32 %145, 1024
br i1 %146, label %147, label %153
147: ; preds = %144
%148 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%149 = icmp eq i32 %148, 1024
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = tail call i32 @fread(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @test_sio3.buf, i64 0, i64 0), i32 1, i32 1024, i32* %50)
%152 = icmp eq i32 %151, 1024
br i1 %152, label %155, label %153
153: ; preds = %150, %147, %144, %141, %138, %135, %132, %129, %126, %123, %120, %117, %114, %111, %108, %104
%154 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %155
155: ; preds = %150, %153
%156 = tail call i64 @fgetc(i32* %50)
%157 = load i64, i64* @EOF
%158 = icmp eq i64 %156, %157
br i1 %158, label %161, label %159
159: ; preds = %155
%160 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %161
161: ; preds = %159, %155
%162 = tail call i32 @clearerr(i32* %50)
%163 = tail call i32 @rewind(i32* %50)
%164 = tail call i32 @pr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%165 = load i32, i32* @SEEK_END
%166 = tail call i64 @fseek(i32* %50, i32 0, i32 %165)
%167 = icmp eq i64 %166, 0
br i1 %167, label %170, label %168
168: ; preds = %161
%169 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
br label %170
170: ; preds = %168, %161
%171 = tail call i32 @ftell(i32* %50)
%172 = icmp eq i32 %171, 16384
br i1 %172, label %175, label %173
173: ; preds = %170
%174 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %175
175: ; preds = %173, %170
%176 = load i32, i32* @SEEK_SET
%177 = tail call i64 @fseek(i32* %50, i32 8100, i32 %176)
%178 = icmp eq i64 %177, 0
br i1 %178, label %181, label %179
179: ; preds = %175
%180 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.15, i64 0, i64 0))
br label %181
181: ; preds = %179, %175
%182 = tail call i32 @ftell(i32* %50)
%183 = icmp eq i32 %182, 8100
br i1 %183, label %186, label %184
184: ; preds = %181
%185 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0))
br label %186
186: ; preds = %184, %181
%187 = load i32, i32* @SEEK_CUR
%188 = tail call i64 @fseek(i32* %50, i32 1900, i32 %187)
%189 = icmp eq i64 %188, 0
br i1 %189, label %192, label %190
190: ; preds = %186
%191 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
br label %192
192: ; preds = %190, %186
%193 = tail call i32 @ftell(i32* %50)
%194 = icmp eq i32 %193, 10000
br i1 %194, label %197, label %195
195: ; preds = %192
%196 = tail call i32 @fail(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0))
br label %197
197: ; preds = %195, %192
%198 = tail call i64 @fclose(i32* %50)
%199 = tail call i32 @unlink(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %200
200: ; preds = %197, %55, %3
ret void
}