#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 */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
scalar_t__ malloc_usable_size(char *);
int ofc_getCount();
scalar_t__ realloc(char *, int);
int /*<<< orphan*/ stdout;
void test_realloc(void) {
  char *ptr;
  int i;
  do {
    fprintf(stdout, "#### realloc ####\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_01 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(3);
  ptr = (char *)realloc(ptr, 8);
  for (i = 0; i < 16; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 8);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_02 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(256);
  ptr = (char *)realloc(ptr, 1024);
  for (i = 0; i < 1032; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 8);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_03 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(128 * 1024);
  ptr = (char *)realloc(ptr, 256 * 1024);
  for (i = 0; i < (256 * 1024) + 8; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 8);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_04 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(8);
  ptr = (char *)realloc(ptr, 11);
  for (i = 0; i < 16; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 5);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_05 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(32);
  ptr = (char *)realloc(ptr, 11);
  for (i = 0; i < 20; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 9);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_06 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(8);
  ptr = (char *)realloc(ptr, 0);
  if (ptr != NULL) {
    for (i = 0; i < 8; i++) {
      ptr[i] = 'z';
    }
  }
  free(ptr);
  if (ptr != NULL) {
    assert(ofc_getCount() == 8);
  }
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_07 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(108);
  ptr = (char *)realloc(ptr, 24);
  for (i = 0; i < 32; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 8);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_08 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(1);
  ptr = (char *)realloc(ptr, 8);
  for (i = 0; i < 8; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 0);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_09 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(16);
  ptr = (char *)realloc(ptr, 1024);
  for (i = 0; i < 1024; i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 0);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_10 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(1024);
  ptr = (char *)realloc(ptr, 256 * 1024);
  for (i = 0; i < (256 * 1024); i++) {
    ptr[i] = 'z';
  }
  free(ptr);
  assert(ofc_getCount() == 0);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_11 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)realloc(NULL, 0);
  assert(malloc_usable_size(ptr) == 0);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  do {
    fprintf(stdout, "[TEST] realloc_12 ...\n");
    fflush(stdout);
  } while (0);
  ptr = (char *)malloc(3);
  for (i = 0; i < 8; i++) {
    ptr[i] = 'z';
  }
  ptr = (char *)realloc(ptr, 0);
  assert(ofc_getCount() == 5);
  do {
    fprintf(stdout, "passed\n");
    fflush(stdout);
  } while (0);
  return;
}


x86 assembly (clang, -O0):
<test_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    11b0 <test_realloc+0x30>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe53(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    121e <test_realloc+0x9e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11fa <test_realloc+0x7a>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xddc(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1266 <test_realloc+0xe6>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xdbc(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x400,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x408,-0xc(%rbp)
jge    12d7 <test_realloc+0x157>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12b0 <test_realloc+0x130>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2ce2(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    131f <test_realloc+0x19f>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
lea    0xd1a(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x20000,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x40000,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40008,-0xc(%rbp)
jge    1390 <test_realloc+0x210>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1369 <test_realloc+0x1e9>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2c29(%rip),%rax
mov    (%rax),%edi
lea    0xc6a(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    13d8 <test_realloc+0x258>
mov    0x2c01(%rip),%rax
mov    (%rax),%edi
lea    0xc78(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xb,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    1446 <test_realloc+0x2c6>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1422 <test_realloc+0x2a2>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2b73(%rip),%rax
mov    (%rax),%edi
lea    0xbb4(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2b5e(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    148e <test_realloc+0x30e>
mov    0x2b4b(%rip),%rax
mov    (%rax),%edi
lea    0xbd9(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2b36(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x20,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xb,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    14fc <test_realloc+0x37c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    14d8 <test_realloc+0x358>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x9,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2abd(%rip),%rax
mov    (%rax),%edi
lea    0xafe(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2aa8(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1544 <test_realloc+0x3c4>
mov    0x2a95(%rip),%rax
mov    (%rax),%edi
lea    0xb3a(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2a80(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x8,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     15bf <test_realloc+0x43f>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    15ba <test_realloc+0x43a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1596 <test_realloc+0x416>
jmp    15bf <test_realloc+0x43f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x8(%rbp)
je     15ea <test_realloc+0x46a>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
jmp    15ef <test_realloc+0x46f>
mov    0x29ea(%rip),%rax
mov    (%rax),%edi
lea    0xa2b(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x29d5(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1617 <test_realloc+0x497>
mov    0x29c2(%rip),%rax
mov    (%rax),%edi
lea    0xa7e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x29ad(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x6c,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x18,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1685 <test_realloc+0x505>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1661 <test_realloc+0x4e1>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2934(%rip),%rax
mov    (%rax),%edi
lea    0x975(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x291f(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    16cd <test_realloc+0x54d>
mov    0x290c(%rip),%rax
mov    (%rax),%edi
lea    0x9df(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x28f7(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    173b <test_realloc+0x5bb>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1717 <test_realloc+0x597>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x287e(%rip),%rax
mov    (%rax),%edi
lea    0x8bf(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2869(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1783 <test_realloc+0x603>
mov    0x2856(%rip),%rax
mov    (%rax),%edi
lea    0x940(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2841(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x400,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    17f4 <test_realloc+0x674>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    17cd <test_realloc+0x64d>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x27c5(%rip),%rax
mov    (%rax),%edi
lea    0x806(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x27b0(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    183c <test_realloc+0x6bc>
mov    0x279d(%rip),%rax
mov    (%rax),%edi
lea    0x89e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2788(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x400,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x40000,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x40000,-0xc(%rbp)
jge    18ad <test_realloc+0x72d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1886 <test_realloc+0x706>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x270c(%rip),%rax
mov    (%rax),%edi
lea    0x74d(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x26f7(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    18f5 <test_realloc+0x775>
mov    0x26e4(%rip),%rax
mov    (%rax),%edi
lea    0x7fc(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x26cf(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc_usable_size@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x2698(%rip),%rax
mov    (%rax),%edi
lea    0x6d9(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2683(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    1969 <test_realloc+0x7e9>
mov    0x2670(%rip),%rax
mov    (%rax),%edi
lea    0x79f(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x265b(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    19c5 <test_realloc+0x845>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7a,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    19a1 <test_realloc+0x821>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1090 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   10a0 <ofc_getCount@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    0x25ee(%rip),%rax
mov    (%rax),%edi
lea    0x62f(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x25d9(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_realloc>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movabs $0x7a7a7a7a7a7a7a7a,%r12
7a 7a 7a
mov    0x2e37(%rip),%r15
mov    (%r15),%edi
lea    0xe5d(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xe59(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x8,%esi
call   10a0 <realloc@plt>
movaps 0xe0b(%rip),%xmm0
movups %xmm0,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
lea    0xe1b(%rip),%r14
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xe09(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x100,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x400,%esi
call   10a0 <realloc@plt>
mov    %rax,%rbx
mov    $0x408,%edx
mov    %rax,%rdi
mov    $0x7a,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xdad(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x20000,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x40000,%esi
call   10a0 <realloc@plt>
mov    %rax,%rbx
mov    $0x40008,%edx
mov    %rax,%rdi
mov    $0x7a,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xd51(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0xb,%esi
call   10a0 <realloc@plt>
movaps 0xcb6(%rip),%xmm0
movups %xmm0,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xd00(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x20,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0xb,%esi
call   10a0 <realloc@plt>
movaps 0xc4e(%rip),%xmm0
movups %xmm0,(%rax)
movl   $0x7a7a7a7a,0x10(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xca8(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x8,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
call   10a0 <realloc@plt>
test   %rax,%rax
je     143e <test_realloc+0x2ae>
mov    %r12,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
jmp    1446 <test_realloc+0x2b6>
mov    %rax,%rdi
call   1030 <free@plt>
mov    (%r15),%edi
lea    0xbea(%rip),%r14
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xc4b(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x6c,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x18,%esi
call   10a0 <realloc@plt>
movaps 0xb6b(%rip),%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xbf6(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x1,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x8,%esi
call   10a0 <realloc@plt>
mov    %r12,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xbad(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x10,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x400,%esi
call   10a0 <realloc@plt>
mov    %rax,%rbx
mov    $0x400,%edx
mov    %rax,%rdi
mov    $0x7a,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xb52(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x400,%edi
call   1080 <malloc@plt>
mov    %rax,%rdi
mov    $0x40000,%esi
call   10a0 <realloc@plt>
mov    %rax,%rbx
mov    $0x40000,%edx
mov    %rax,%rdi
mov    $0x7a,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xaf7(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <realloc@plt>
mov    %rax,%rdi
call   1050 <malloc_usable_size@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    (%r15),%edi
lea    0xac5(%rip),%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
call   1090 <fflush@plt>
mov    $0x3,%edi
call   1080 <malloc@plt>
mov    %r12,(%rax)
mov    %rax,%rdi
xor    %esi,%esi
call   10a0 <realloc@plt>
xor    %eax,%eax
call   10b0 <ofc_getCount@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1060 <assert@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1070 <fprintf@plt>
mov    (%r15),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1090 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [19 x i8] c"#### realloc ####\0A\00"
@.str.1 = [23 x i8] c"[TEST] realloc_01 ...\0A\00"
@.str.2 = [8 x i8] c"passed\0A\00"
@.str.3 = [23 x i8] c"[TEST] realloc_02 ...\0A\00"
@.str.4 = [23 x i8] c"[TEST] realloc_03 ...\0A\00"
@.str.5 = [23 x i8] c"[TEST] realloc_04 ...\0A\00"
@.str.6 = [23 x i8] c"[TEST] realloc_05 ...\0A\00"
@.str.7 = [23 x i8] c"[TEST] realloc_06 ...\0A\00"
@.str.8 = [23 x i8] c"[TEST] realloc_07 ...\0A\00"
@.str.9 = [23 x i8] c"[TEST] realloc_08 ...\0A\00"
@.str.10 = [23 x i8] c"[TEST] realloc_09 ...\0A\00"
@.str.11 = [23 x i8] c"[TEST] realloc_10 ...\0A\00"
@.str.12 = [23 x i8] c"[TEST] realloc_11 ...\0A\00"
@.str.13 = [23 x i8] c"[TEST] realloc_12 ...\0A\00"
define void @test_realloc() {
%1 = alloca i8*
%2 = alloca i32
br label %3
3: ; preds = %0
%4 = load i32, i32* @stdout
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
br label %8
8: ; preds = %3
br label %9
9: ; preds = %8
%10 = load i32, i32* @stdout
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @stdout
%13 = call i32 @fflush(i32 %12)
br label %14
14: ; preds = %9
%15 = call i64 @malloc(i32 3)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %1
%17 = load i8*, i8** %1
%18 = call i64 @realloc(i8* %17, i32 8)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %1
store i32 0, i32* %2
br label %20
20: ; preds = %28, %14
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 16
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i8*, i8** %1
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 122, i8* %27
br label %28
28: ; preds = %23
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %20
31: ; preds = %20
%32 = load i8*, i8** %1
%33 = call i32 @free(i8* %32)
%34 = call i32 (...) @ofc_getCount()
%35 = icmp eq i32 %34, 8
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
br label %38
38: ; preds = %31
%39 = load i32, i32* @stdout
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%41 = load i32, i32* @stdout
%42 = call i32 @fflush(i32 %41)
br label %43
43: ; preds = %38
br label %44
44: ; preds = %43
%45 = load i32, i32* @stdout
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* @stdout
%48 = call i32 @fflush(i32 %47)
br label %49
49: ; preds = %44
%50 = call i64 @malloc(i32 256)
%51 = inttoptr i64 %50 to i8*
store i8* %51, i8** %1
%52 = load i8*, i8** %1
%53 = call i64 @realloc(i8* %52, i32 1024)
%54 = inttoptr i64 %53 to i8*
store i8* %54, i8** %1
store i32 0, i32* %2
br label %55
55: ; preds = %63, %49
%56 = load i32, i32* %2
%57 = icmp slt i32 %56, 1032
br i1 %57, label %58, label %66
58: ; preds = %55
%59 = load i8*, i8** %1
%60 = load i32, i32* %2
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
store i8 122, i8* %62
br label %63
63: ; preds = %58
%64 = load i32, i32* %2
%65 = add nsw i32 %64, 1
store i32 %65, i32* %2
br label %55
66: ; preds = %55
%67 = load i8*, i8** %1
%68 = call i32 @free(i8* %67)
%69 = call i32 (...) @ofc_getCount()
%70 = icmp eq i32 %69, 8
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
br label %73
73: ; preds = %66
%74 = load i32, i32* @stdout
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%76 = load i32, i32* @stdout
%77 = call i32 @fflush(i32 %76)
br label %78
78: ; preds = %73
br label %79
79: ; preds = %78
%80 = load i32, i32* @stdout
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%82 = load i32, i32* @stdout
%83 = call i32 @fflush(i32 %82)
br label %84
84: ; preds = %79
%85 = call i64 @malloc(i32 131072)
%86 = inttoptr i64 %85 to i8*
store i8* %86, i8** %1
%87 = load i8*, i8** %1
%88 = call i64 @realloc(i8* %87, i32 262144)
%89 = inttoptr i64 %88 to i8*
store i8* %89, i8** %1
store i32 0, i32* %2
br label %90
90: ; preds = %98, %84
%91 = load i32, i32* %2
%92 = icmp slt i32 %91, 262152
br i1 %92, label %93, label %101
93: ; preds = %90
%94 = load i8*, i8** %1
%95 = load i32, i32* %2
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
store i8 122, i8* %97
br label %98
98: ; preds = %93
%99 = load i32, i32* %2
%100 = add nsw i32 %99, 1
store i32 %100, i32* %2
br label %90
101: ; preds = %90
%102 = load i8*, i8** %1
%103 = call i32 @free(i8* %102)
%104 = call i32 (...) @ofc_getCount()
%105 = icmp eq i32 %104, 8
%106 = zext i1 %105 to i32
%107 = call i32 @assert(i32 %106)
br label %108
108: ; preds = %101
%109 = load i32, i32* @stdout
%110 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%111 = load i32, i32* @stdout
%112 = call i32 @fflush(i32 %111)
br label %113
113: ; preds = %108
br label %114
114: ; preds = %113
%115 = load i32, i32* @stdout
%116 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%117 = load i32, i32* @stdout
%118 = call i32 @fflush(i32 %117)
br label %119
119: ; preds = %114
%120 = call i64 @malloc(i32 8)
%121 = inttoptr i64 %120 to i8*
store i8* %121, i8** %1
%122 = load i8*, i8** %1
%123 = call i64 @realloc(i8* %122, i32 11)
%124 = inttoptr i64 %123 to i8*
store i8* %124, i8** %1
store i32 0, i32* %2
br label %125
125: ; preds = %133, %119
%126 = load i32, i32* %2
%127 = icmp slt i32 %126, 16
br i1 %127, label %128, label %136
128: ; preds = %125
%129 = load i8*, i8** %1
%130 = load i32, i32* %2
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %129, i64 %131
store i8 122, i8* %132
br label %133
133: ; preds = %128
%134 = load i32, i32* %2
%135 = add nsw i32 %134, 1
store i32 %135, i32* %2
br label %125
136: ; preds = %125
%137 = load i8*, i8** %1
%138 = call i32 @free(i8* %137)
%139 = call i32 (...) @ofc_getCount()
%140 = icmp eq i32 %139, 5
%141 = zext i1 %140 to i32
%142 = call i32 @assert(i32 %141)
br label %143
143: ; preds = %136
%144 = load i32, i32* @stdout
%145 = call i32 @fprintf(i32 %144, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%146 = load i32, i32* @stdout
%147 = call i32 @fflush(i32 %146)
br label %148
148: ; preds = %143
br label %149
149: ; preds = %148
%150 = load i32, i32* @stdout
%151 = call i32 @fprintf(i32 %150, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%152 = load i32, i32* @stdout
%153 = call i32 @fflush(i32 %152)
br label %154
154: ; preds = %149
%155 = call i64 @malloc(i32 32)
%156 = inttoptr i64 %155 to i8*
store i8* %156, i8** %1
%157 = load i8*, i8** %1
%158 = call i64 @realloc(i8* %157, i32 11)
%159 = inttoptr i64 %158 to i8*
store i8* %159, i8** %1
store i32 0, i32* %2
br label %160
160: ; preds = %168, %154
%161 = load i32, i32* %2
%162 = icmp slt i32 %161, 20
br i1 %162, label %163, label %171
163: ; preds = %160
%164 = load i8*, i8** %1
%165 = load i32, i32* %2
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %164, i64 %166
store i8 122, i8* %167
br label %168
168: ; preds = %163
%169 = load i32, i32* %2
%170 = add nsw i32 %169, 1
store i32 %170, i32* %2
br label %160
171: ; preds = %160
%172 = load i8*, i8** %1
%173 = call i32 @free(i8* %172)
%174 = call i32 (...) @ofc_getCount()
%175 = icmp eq i32 %174, 9
%176 = zext i1 %175 to i32
%177 = call i32 @assert(i32 %176)
br label %178
178: ; preds = %171
%179 = load i32, i32* @stdout
%180 = call i32 @fprintf(i32 %179, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%181 = load i32, i32* @stdout
%182 = call i32 @fflush(i32 %181)
br label %183
183: ; preds = %178
br label %184
184: ; preds = %183
%185 = load i32, i32* @stdout
%186 = call i32 @fprintf(i32 %185, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%187 = load i32, i32* @stdout
%188 = call i32 @fflush(i32 %187)
br label %189
189: ; preds = %184
%190 = call i64 @malloc(i32 8)
%191 = inttoptr i64 %190 to i8*
store i8* %191, i8** %1
%192 = load i8*, i8** %1
%193 = call i64 @realloc(i8* %192, i32 0)
%194 = inttoptr i64 %193 to i8*
store i8* %194, i8** %1
%195 = load i8*, i8** %1
%196 = icmp ne i8* %195, null
br i1 %196, label %197, label %210
197: ; preds = %189
store i32 0, i32* %2
br label %198
198: ; preds = %206, %197
%199 = load i32, i32* %2
%200 = icmp slt i32 %199, 8
br i1 %200, label %201, label %209
201: ; preds = %198
%202 = load i8*, i8** %1
%203 = load i32, i32* %2
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8, i8* %202, i64 %204
store i8 122, i8* %205
br label %206
206: ; preds = %201
%207 = load i32, i32* %2
%208 = add nsw i32 %207, 1
store i32 %208, i32* %2
br label %198
209: ; preds = %198
br label %210
210: ; preds = %209, %189
%211 = load i8*, i8** %1
%212 = call i32 @free(i8* %211)
%213 = load i8*, i8** %1
%214 = icmp ne i8* %213, null
br i1 %214, label %215, label %220
215: ; preds = %210
%216 = call i32 (...) @ofc_getCount()
%217 = icmp eq i32 %216, 8
%218 = zext i1 %217 to i32
%219 = call i32 @assert(i32 %218)
br label %220
220: ; preds = %215, %210
br label %221
221: ; preds = %220
%222 = load i32, i32* @stdout
%223 = call i32 @fprintf(i32 %222, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%224 = load i32, i32* @stdout
%225 = call i32 @fflush(i32 %224)
br label %226
226: ; preds = %221
br label %227
227: ; preds = %226
%228 = load i32, i32* @stdout
%229 = call i32 @fprintf(i32 %228, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%230 = load i32, i32* @stdout
%231 = call i32 @fflush(i32 %230)
br label %232
232: ; preds = %227
%233 = call i64 @malloc(i32 108)
%234 = inttoptr i64 %233 to i8*
store i8* %234, i8** %1
%235 = load i8*, i8** %1
%236 = call i64 @realloc(i8* %235, i32 24)
%237 = inttoptr i64 %236 to i8*
store i8* %237, i8** %1
store i32 0, i32* %2
br label %238
238: ; preds = %246, %232
%239 = load i32, i32* %2
%240 = icmp slt i32 %239, 32
br i1 %240, label %241, label %249
241: ; preds = %238
%242 = load i8*, i8** %1
%243 = load i32, i32* %2
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %242, i64 %244
store i8 122, i8* %245
br label %246
246: ; preds = %241
%247 = load i32, i32* %2
%248 = add nsw i32 %247, 1
store i32 %248, i32* %2
br label %238
249: ; preds = %238
%250 = load i8*, i8** %1
%251 = call i32 @free(i8* %250)
%252 = call i32 (...) @ofc_getCount()
%253 = icmp eq i32 %252, 8
%254 = zext i1 %253 to i32
%255 = call i32 @assert(i32 %254)
br label %256
256: ; preds = %249
%257 = load i32, i32* @stdout
%258 = call i32 @fprintf(i32 %257, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%259 = load i32, i32* @stdout
%260 = call i32 @fflush(i32 %259)
br label %261
261: ; preds = %256
br label %262
262: ; preds = %261
%263 = load i32, i32* @stdout
%264 = call i32 @fprintf(i32 %263, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%265 = load i32, i32* @stdout
%266 = call i32 @fflush(i32 %265)
br label %267
267: ; preds = %262
%268 = call i64 @malloc(i32 1)
%269 = inttoptr i64 %268 to i8*
store i8* %269, i8** %1
%270 = load i8*, i8** %1
%271 = call i64 @realloc(i8* %270, i32 8)
%272 = inttoptr i64 %271 to i8*
store i8* %272, i8** %1
store i32 0, i32* %2
br label %273
273: ; preds = %281, %267
%274 = load i32, i32* %2
%275 = icmp slt i32 %274, 8
br i1 %275, label %276, label %284
276: ; preds = %273
%277 = load i8*, i8** %1
%278 = load i32, i32* %2
%279 = sext i32 %278 to i64
%280 = getelementptr inbounds i8, i8* %277, i64 %279
store i8 122, i8* %280
br label %281
281: ; preds = %276
%282 = load i32, i32* %2
%283 = add nsw i32 %282, 1
store i32 %283, i32* %2
br label %273
284: ; preds = %273
%285 = load i8*, i8** %1
%286 = call i32 @free(i8* %285)
%287 = call i32 (...) @ofc_getCount()
%288 = icmp eq i32 %287, 0
%289 = zext i1 %288 to i32
%290 = call i32 @assert(i32 %289)
br label %291
291: ; preds = %284
%292 = load i32, i32* @stdout
%293 = call i32 @fprintf(i32 %292, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%294 = load i32, i32* @stdout
%295 = call i32 @fflush(i32 %294)
br label %296
296: ; preds = %291
br label %297
297: ; preds = %296
%298 = load i32, i32* @stdout
%299 = call i32 @fprintf(i32 %298, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%300 = load i32, i32* @stdout
%301 = call i32 @fflush(i32 %300)
br label %302
302: ; preds = %297
%303 = call i64 @malloc(i32 16)
%304 = inttoptr i64 %303 to i8*
store i8* %304, i8** %1
%305 = load i8*, i8** %1
%306 = call i64 @realloc(i8* %305, i32 1024)
%307 = inttoptr i64 %306 to i8*
store i8* %307, i8** %1
store i32 0, i32* %2
br label %308
308: ; preds = %316, %302
%309 = load i32, i32* %2
%310 = icmp slt i32 %309, 1024
br i1 %310, label %311, label %319
311: ; preds = %308
%312 = load i8*, i8** %1
%313 = load i32, i32* %2
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds i8, i8* %312, i64 %314
store i8 122, i8* %315
br label %316
316: ; preds = %311
%317 = load i32, i32* %2
%318 = add nsw i32 %317, 1
store i32 %318, i32* %2
br label %308
319: ; preds = %308
%320 = load i8*, i8** %1
%321 = call i32 @free(i8* %320)
%322 = call i32 (...) @ofc_getCount()
%323 = icmp eq i32 %322, 0
%324 = zext i1 %323 to i32
%325 = call i32 @assert(i32 %324)
br label %326
326: ; preds = %319
%327 = load i32, i32* @stdout
%328 = call i32 @fprintf(i32 %327, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%329 = load i32, i32* @stdout
%330 = call i32 @fflush(i32 %329)
br label %331
331: ; preds = %326
br label %332
332: ; preds = %331
%333 = load i32, i32* @stdout
%334 = call i32 @fprintf(i32 %333, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%335 = load i32, i32* @stdout
%336 = call i32 @fflush(i32 %335)
br label %337
337: ; preds = %332
%338 = call i64 @malloc(i32 1024)
%339 = inttoptr i64 %338 to i8*
store i8* %339, i8** %1
%340 = load i8*, i8** %1
%341 = call i64 @realloc(i8* %340, i32 262144)
%342 = inttoptr i64 %341 to i8*
store i8* %342, i8** %1
store i32 0, i32* %2
br label %343
343: ; preds = %351, %337
%344 = load i32, i32* %2
%345 = icmp slt i32 %344, 262144
br i1 %345, label %346, label %354
346: ; preds = %343
%347 = load i8*, i8** %1
%348 = load i32, i32* %2
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds i8, i8* %347, i64 %349
store i8 122, i8* %350
br label %351
351: ; preds = %346
%352 = load i32, i32* %2
%353 = add nsw i32 %352, 1
store i32 %353, i32* %2
br label %343
354: ; preds = %343
%355 = load i8*, i8** %1
%356 = call i32 @free(i8* %355)
%357 = call i32 (...) @ofc_getCount()
%358 = icmp eq i32 %357, 0
%359 = zext i1 %358 to i32
%360 = call i32 @assert(i32 %359)
br label %361
361: ; preds = %354
%362 = load i32, i32* @stdout
%363 = call i32 @fprintf(i32 %362, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%364 = load i32, i32* @stdout
%365 = call i32 @fflush(i32 %364)
br label %366
366: ; preds = %361
br label %367
367: ; preds = %366
%368 = load i32, i32* @stdout
%369 = call i32 @fprintf(i32 %368, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%370 = load i32, i32* @stdout
%371 = call i32 @fflush(i32 %370)
br label %372
372: ; preds = %367
%373 = call i64 @realloc(i8* null, i32 0)
%374 = inttoptr i64 %373 to i8*
store i8* %374, i8** %1
%375 = load i8*, i8** %1
%376 = call i64 @malloc_usable_size(i8* %375)
%377 = icmp eq i64 %376, 0
%378 = zext i1 %377 to i32
%379 = call i32 @assert(i32 %378)
br label %380
380: ; preds = %372
%381 = load i32, i32* @stdout
%382 = call i32 @fprintf(i32 %381, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%383 = load i32, i32* @stdout
%384 = call i32 @fflush(i32 %383)
br label %385
385: ; preds = %380
br label %386
386: ; preds = %385
%387 = load i32, i32* @stdout
%388 = call i32 @fprintf(i32 %387, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%389 = load i32, i32* @stdout
%390 = call i32 @fflush(i32 %389)
br label %391
391: ; preds = %386
%392 = call i64 @malloc(i32 3)
%393 = inttoptr i64 %392 to i8*
store i8* %393, i8** %1
store i32 0, i32* %2
br label %394
394: ; preds = %402, %391
%395 = load i32, i32* %2
%396 = icmp slt i32 %395, 8
br i1 %396, label %397, label %405
397: ; preds = %394
%398 = load i8*, i8** %1
%399 = load i32, i32* %2
%400 = sext i32 %399 to i64
%401 = getelementptr inbounds i8, i8* %398, i64 %400
store i8 122, i8* %401
br label %402
402: ; preds = %397
%403 = load i32, i32* %2
%404 = add nsw i32 %403, 1
store i32 %404, i32* %2
br label %394
405: ; preds = %394
%406 = load i8*, i8** %1
%407 = call i64 @realloc(i8* %406, i32 0)
%408 = inttoptr i64 %407 to i8*
store i8* %408, i8** %1
%409 = call i32 (...) @ofc_getCount()
%410 = icmp eq i32 %409, 5
%411 = zext i1 %410 to i32
%412 = call i32 @assert(i32 %411)
br label %413
413: ; preds = %405
%414 = load i32, i32* @stdout
%415 = call i32 @fprintf(i32 %414, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%416 = load i32, i32* @stdout
%417 = call i32 @fflush(i32 %416)
br label %418
418: ; preds = %413
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [19 x i8] c"#### realloc ####\0A\00"
@.str.1 = [23 x i8] c"[TEST] realloc_01 ...\0A\00"
@.str.2 = [8 x i8] c"passed\0A\00"
@.str.3 = [23 x i8] c"[TEST] realloc_02 ...\0A\00"
@.str.4 = [23 x i8] c"[TEST] realloc_03 ...\0A\00"
@.str.5 = [23 x i8] c"[TEST] realloc_04 ...\0A\00"
@.str.6 = [23 x i8] c"[TEST] realloc_05 ...\0A\00"
@.str.7 = [23 x i8] c"[TEST] realloc_06 ...\0A\00"
@.str.8 = [23 x i8] c"[TEST] realloc_07 ...\0A\00"
@.str.9 = [23 x i8] c"[TEST] realloc_08 ...\0A\00"
@.str.10 = [23 x i8] c"[TEST] realloc_09 ...\0A\00"
@.str.11 = [23 x i8] c"[TEST] realloc_10 ...\0A\00"
@.str.12 = [23 x i8] c"[TEST] realloc_11 ...\0A\00"
@.str.13 = [23 x i8] c"[TEST] realloc_12 ...\0A\00"
define void @test_realloc() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
%9 = tail call i64 @malloc(i32 3)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i64 @realloc(i8* %10, i32 8)
%12 = inttoptr i64 %11 to i8*
%13 = tail call i32 @free(i8* %12)
%14 = tail call i32 (...) @ofc_getCount()
%15 = icmp eq i32 %14, 8
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = load i32, i32* @stdout
%19 = tail call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @stdout
%21 = tail call i32 @fflush(i32 %20)
%22 = load i32, i32* @stdout
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%24 = load i32, i32* @stdout
%25 = tail call i32 @fflush(i32 %24)
%26 = tail call i64 @malloc(i32 256)
%27 = inttoptr i64 %26 to i8*
%28 = tail call i64 @realloc(i8* %27, i32 1024)
%29 = inttoptr i64 %28 to i8*
%30 = tail call i32 @free(i8* %29)
%31 = tail call i32 (...) @ofc_getCount()
%32 = icmp eq i32 %31, 8
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = load i32, i32* @stdout
%36 = tail call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%37 = load i32, i32* @stdout
%38 = tail call i32 @fflush(i32 %37)
%39 = load i32, i32* @stdout
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%41 = load i32, i32* @stdout
%42 = tail call i32 @fflush(i32 %41)
%43 = tail call i64 @malloc(i32 131072)
%44 = inttoptr i64 %43 to i8*
%45 = tail call i64 @realloc(i8* %44, i32 262144)
%46 = inttoptr i64 %45 to i8*
%47 = tail call i32 @free(i8* %46)
%48 = tail call i32 (...) @ofc_getCount()
%49 = icmp eq i32 %48, 8
%50 = zext i1 %49 to i32
%51 = tail call i32 @assert(i32 %50)
%52 = load i32, i32* @stdout
%53 = tail call i32 @fprintf(i32 %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%54 = load i32, i32* @stdout
%55 = tail call i32 @fflush(i32 %54)
%56 = load i32, i32* @stdout
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32, i32* @stdout
%59 = tail call i32 @fflush(i32 %58)
%60 = tail call i64 @malloc(i32 8)
%61 = inttoptr i64 %60 to i8*
%62 = tail call i64 @realloc(i8* %61, i32 11)
%63 = inttoptr i64 %62 to i8*
%64 = tail call i32 @free(i8* %63)
%65 = tail call i32 (...) @ofc_getCount()
%66 = icmp eq i32 %65, 5
%67 = zext i1 %66 to i32
%68 = tail call i32 @assert(i32 %67)
%69 = load i32, i32* @stdout
%70 = tail call i32 @fprintf(i32 %69, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%71 = load i32, i32* @stdout
%72 = tail call i32 @fflush(i32 %71)
%73 = load i32, i32* @stdout
%74 = tail call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%75 = load i32, i32* @stdout
%76 = tail call i32 @fflush(i32 %75)
%77 = tail call i64 @malloc(i32 32)
%78 = inttoptr i64 %77 to i8*
%79 = tail call i64 @realloc(i8* %78, i32 11)
%80 = inttoptr i64 %79 to i8*
%81 = tail call i32 @free(i8* %80)
%82 = tail call i32 (...) @ofc_getCount()
%83 = icmp eq i32 %82, 9
%84 = zext i1 %83 to i32
%85 = tail call i32 @assert(i32 %84)
%86 = load i32, i32* @stdout
%87 = tail call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%88 = load i32, i32* @stdout
%89 = tail call i32 @fflush(i32 %88)
%90 = load i32, i32* @stdout
%91 = tail call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
%92 = load i32, i32* @stdout
%93 = tail call i32 @fflush(i32 %92)
%94 = tail call i64 @malloc(i32 8)
%95 = inttoptr i64 %94 to i8*
%96 = tail call i64 @realloc(i8* %95, i32 0)
%97 = inttoptr i64 %96 to i8*
%98 = icmp eq i64 %96, 0
br i1 %98, label %106, label %99
99: ; preds = %0
%100 = inttoptr i64 %96 to i64*
store i64 8825501086245354106, i64* %100
%101 = tail call i32 @free(i8* %97)
%102 = tail call i32 (...) @ofc_getCount()
%103 = icmp eq i32 %102, 8
%104 = zext i1 %103 to i32
%105 = tail call i32 @assert(i32 %104)
br label %108
106: ; preds = %0
%107 = tail call i32 @free(i8* %97)
br label %108
108: ; preds = %106, %99
%109 = load i32, i32* @stdout
%110 = tail call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%111 = load i32, i32* @stdout
%112 = tail call i32 @fflush(i32 %111)
%113 = load i32, i32* @stdout
%114 = tail call i32 @fprintf(i32 %113, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%115 = load i32, i32* @stdout
%116 = tail call i32 @fflush(i32 %115)
%117 = tail call i64 @malloc(i32 108)
%118 = inttoptr i64 %117 to i8*
%119 = tail call i64 @realloc(i8* %118, i32 24)
%120 = inttoptr i64 %119 to i8*
%121 = tail call i32 @free(i8* %120)
%122 = tail call i32 (...) @ofc_getCount()
%123 = icmp eq i32 %122, 8
%124 = zext i1 %123 to i32
%125 = tail call i32 @assert(i32 %124)
%126 = load i32, i32* @stdout
%127 = tail call i32 @fprintf(i32 %126, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%128 = load i32, i32* @stdout
%129 = tail call i32 @fflush(i32 %128)
%130 = load i32, i32* @stdout
%131 = tail call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%132 = load i32, i32* @stdout
%133 = tail call i32 @fflush(i32 %132)
%134 = tail call i64 @malloc(i32 1)
%135 = inttoptr i64 %134 to i8*
%136 = tail call i64 @realloc(i8* %135, i32 8)
%137 = inttoptr i64 %136 to i8*
%138 = inttoptr i64 %136 to i64*
store i64 8825501086245354106, i64* %138
%139 = tail call i32 @free(i8* %137)
%140 = tail call i32 (...) @ofc_getCount()
%141 = icmp eq i32 %140, 0
%142 = zext i1 %141 to i32
%143 = tail call i32 @assert(i32 %142)
%144 = load i32, i32* @stdout
%145 = tail call i32 @fprintf(i32 %144, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%146 = load i32, i32* @stdout
%147 = tail call i32 @fflush(i32 %146)
%148 = load i32, i32* @stdout
%149 = tail call i32 @fprintf(i32 %148, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0))
%150 = load i32, i32* @stdout
%151 = tail call i32 @fflush(i32 %150)
%152 = tail call i64 @malloc(i32 16)
%153 = inttoptr i64 %152 to i8*
%154 = tail call i64 @realloc(i8* %153, i32 1024)
%155 = inttoptr i64 %154 to i8*
%156 = tail call i32 @free(i8* %155)
%157 = tail call i32 (...) @ofc_getCount()
%158 = icmp eq i32 %157, 0
%159 = zext i1 %158 to i32
%160 = tail call i32 @assert(i32 %159)
%161 = load i32, i32* @stdout
%162 = tail call i32 @fprintf(i32 %161, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%163 = load i32, i32* @stdout
%164 = tail call i32 @fflush(i32 %163)
%165 = load i32, i32* @stdout
%166 = tail call i32 @fprintf(i32 %165, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
%167 = load i32, i32* @stdout
%168 = tail call i32 @fflush(i32 %167)
%169 = tail call i64 @malloc(i32 1024)
%170 = inttoptr i64 %169 to i8*
%171 = tail call i64 @realloc(i8* %170, i32 262144)
%172 = inttoptr i64 %171 to i8*
%173 = tail call i32 @free(i8* %172)
%174 = tail call i32 (...) @ofc_getCount()
%175 = icmp eq i32 %174, 0
%176 = zext i1 %175 to i32
%177 = tail call i32 @assert(i32 %176)
%178 = load i32, i32* @stdout
%179 = tail call i32 @fprintf(i32 %178, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%180 = load i32, i32* @stdout
%181 = tail call i32 @fflush(i32 %180)
%182 = load i32, i32* @stdout
%183 = tail call i32 @fprintf(i32 %182, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
%184 = load i32, i32* @stdout
%185 = tail call i32 @fflush(i32 %184)
%186 = tail call i64 @realloc(i8* null, i32 0)
%187 = inttoptr i64 %186 to i8*
%188 = tail call i64 @malloc_usable_size(i8* %187)
%189 = icmp eq i64 %188, 0
%190 = zext i1 %189 to i32
%191 = tail call i32 @assert(i32 %190)
%192 = load i32, i32* @stdout
%193 = tail call i32 @fprintf(i32 %192, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%194 = load i32, i32* @stdout
%195 = tail call i32 @fflush(i32 %194)
%196 = load i32, i32* @stdout
%197 = tail call i32 @fprintf(i32 %196, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
%198 = load i32, i32* @stdout
%199 = tail call i32 @fflush(i32 %198)
%200 = tail call i64 @malloc(i32 3)
%201 = inttoptr i64 %200 to i8*
%202 = inttoptr i64 %200 to i64*
store i64 8825501086245354106, i64* %202
%203 = tail call i64 @realloc(i8* %201, i32 0)
%204 = tail call i32 (...) @ofc_getCount()
%205 = icmp eq i32 %204, 5
%206 = zext i1 %205 to i32
%207 = tail call i32 @assert(i32 %206)
%208 = load i32, i32* @stdout
%209 = tail call i32 @fprintf(i32 %208, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%210 = load i32, i32* @stdout
%211 = tail call i32 @fflush(i32 %210)
ret void
}