#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 /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
size_t st_aligned_alignment(char *);
int /*<<< orphan*/ st_aligned_free(char *);
char *st_aligned_malloc_impl(size_t, size_t);
char *st_aligned_realloc_impl(char *, size_t, size_t);
size_t st_aligned_size(char *);
int /*<<< orphan*/ stderr;
int unit_test_st_aligned_realloc() {
  char *ptr = NULL;
  size_t size = 123, add, a;
  size_t alignment;
  int i;
  int ncase;
  fprintf(stderr, " Testing st_aligned_malloc...\n");
  ncase = 1;
  fprintf(stderr, "    Case %d...", ncase++);
  for (i = 4; i <= 12; i++) {
    alignment = 1 << i;
    ptr = st_aligned_realloc_impl(NULL, size, alignment);
    if (st_aligned_alignment(ptr) != alignment) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (st_aligned_size(ptr) != size) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (((size_t)ptr & (alignment - 1)) != 0) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    do {
      if ((ptr) != NULL) {
        st_aligned_free(ptr);
        (ptr) = NULL;
      }
    } while (0);
    fprintf(stderr, "Passed\n");
  }
  fprintf(stderr, "    Case %d...", ncase++);
  for (i = 4; i <= 12; i++) {
    alignment = 1 << i;
    ptr = st_aligned_malloc_impl(size, alignment);
    for (a = 0; a < size; a++) {
      ptr[a] = a;
    }
    assert(ptr != NULL);
    add = 10;
    ptr = st_aligned_realloc_impl(ptr, size + add, alignment);
    if (st_aligned_alignment(ptr) != alignment) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (st_aligned_size(ptr) != size + add) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (((size_t)ptr & (alignment - 1)) != 0) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    for (a = 0; a < size; a++) {
      if (ptr[a] != a) {
        fprintf(stderr, "Failed\n");
        goto FAILED;
      }
    }
    add += 25;
    ptr = st_aligned_realloc_impl(ptr, size + add, alignment);
    if (st_aligned_alignment(ptr) != alignment) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (st_aligned_size(ptr) != size + add) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    if (((size_t)ptr & (alignment - 1)) != 0) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    for (a = 0; a < size; a++) {
      if (ptr[a] != a) {
        fprintf(stderr, "Failed\n");
        goto FAILED;
      }
    }
    do {
      if ((ptr) != NULL) {
        st_aligned_free(ptr);
        (ptr) = NULL;
      }
    } while (0);
    fprintf(stderr, "Passed\n");
  }
  fprintf(stderr, "    Case %d...", ncase++);
  for (i = 4; i <= 12; i++) {
    alignment = 1 << i;
    ptr = st_aligned_malloc_impl(size, alignment);
    assert(ptr != NULL);
    alignment *= 2;
    ptr = st_aligned_realloc_impl(ptr, size + 10, alignment);
    if (((size_t)ptr & (alignment - 1)) != 0) {
      fprintf(stderr, "Failed\n");
      goto FAILED;
    }
    do {
      if ((ptr) != NULL) {
        st_aligned_free(ptr);
        (ptr) = NULL;
      }
    } while (0);
    fprintf(stderr, "Passed\n");
  }
  return 0;
FAILED:
  do {
    if ((ptr) != NULL) {
      st_aligned_free(ptr);
      (ptr) = NULL;
    }
  } while (0);
  return -1;
}


x86 assembly (clang, -O0):
<unit_test_st_aligned_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x10(%rbp)
movq   $0x7b,-0x18(%rbp)
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x38(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x34(%rbp)
cmpl   $0xc,-0x34(%rbp)
jg     12dc <unit_test_st_aligned_realloc+0x16c>
mov    -0x34(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <st_aligned_alignment@plt>
cmp    -0x30(%rbp),%rax
je     122d <unit_test_st_aligned_realloc+0xbd>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rdi
call   1050 <st_aligned_size@plt>
cmp    -0x18(%rbp),%rax
je     125c <unit_test_st_aligned_realloc+0xec>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1291 <unit_test_st_aligned_realloc+0x121>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
jmp    1296 <unit_test_st_aligned_realloc+0x126>
cmpq   $0x0,-0x10(%rbp)
je     12b2 <unit_test_st_aligned_realloc+0x142>
mov    -0x10(%rbp),%rdi
call   1030 <st_aligned_free@plt>
movq   $0x0,-0x10(%rbp)
jmp    12b7 <unit_test_st_aligned_realloc+0x147>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11cf <unit_test_st_aligned_realloc+0x5f>
mov    0x2cfd(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    0xd28(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x34(%rbp)
cmpl   $0xc,-0x34(%rbp)
jg     15fd <unit_test_st_aligned_realloc+0x48d>
mov    -0x34(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <st_aligned_malloc_impl@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1368 <unit_test_st_aligned_realloc+0x1f8>
mov    -0x28(%rbp),%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1338 <unit_test_st_aligned_realloc+0x1c8>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movq   $0xa,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <st_aligned_alignment@plt>
cmp    -0x30(%rbp),%rax
je     13ca <unit_test_st_aligned_realloc+0x25a>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
lea    0xc70(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rdi
call   1050 <st_aligned_size@plt>
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
je     1400 <unit_test_st_aligned_realloc+0x290>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
lea    0xc3a(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1435 <unit_test_st_aligned_realloc+0x2c5>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
lea    0xc05(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1494 <unit_test_st_aligned_realloc+0x324>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbq (%rax,%rcx,1),%rax
cmp    -0x28(%rbp),%rax
je     147e <unit_test_st_aligned_realloc+0x30e>
mov    0x2b77(%rip),%rax
mov    (%rax),%edi
lea    0xbbc(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
jmp    1483 <unit_test_st_aligned_realloc+0x313>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    143d <unit_test_st_aligned_realloc+0x2cd>
mov    -0x20(%rbp),%rax
add    $0x19,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <st_aligned_alignment@plt>
cmp    -0x30(%rbp),%rax
je     14e8 <unit_test_st_aligned_realloc+0x378>
mov    0x2b0d(%rip),%rax
mov    (%rax),%edi
lea    0xb52(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rdi
call   1050 <st_aligned_size@plt>
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
je     151e <unit_test_st_aligned_realloc+0x3ae>
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
lea    0xb1c(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1553 <unit_test_st_aligned_realloc+0x3e3>
mov    0x2aa2(%rip),%rax
mov    (%rax),%edi
lea    0xae7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    15b2 <unit_test_st_aligned_realloc+0x442>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbq (%rax,%rcx,1),%rax
cmp    -0x28(%rbp),%rax
je     159c <unit_test_st_aligned_realloc+0x42c>
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
lea    0xa9e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
jmp    15a1 <unit_test_st_aligned_realloc+0x431>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    155b <unit_test_st_aligned_realloc+0x3eb>
jmp    15b7 <unit_test_st_aligned_realloc+0x447>
cmpq   $0x0,-0x10(%rbp)
je     15d3 <unit_test_st_aligned_realloc+0x463>
mov    -0x10(%rbp),%rdi
call   1030 <st_aligned_free@plt>
movq   $0x0,-0x10(%rbp)
jmp    15d8 <unit_test_st_aligned_realloc+0x468>
mov    0x2a01(%rip),%rax
mov    (%rax),%edi
lea    0xa4e(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1305 <unit_test_st_aligned_realloc+0x195>
mov    0x29dc(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
lea    0xa07(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x4,-0x34(%rbp)
cmpl   $0xc,-0x34(%rbp)
jg     1708 <unit_test_st_aligned_realloc+0x598>
mov    -0x34(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1080 <st_aligned_malloc_impl@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x30(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0xa,%rsi
mov    -0x30(%rbp),%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     16bd <unit_test_st_aligned_realloc+0x54d>
mov    0x2938(%rip),%rax
mov    (%rax),%edi
lea    0x97d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
jmp    1714 <unit_test_st_aligned_realloc+0x5a4>
jmp    16c2 <unit_test_st_aligned_realloc+0x552>
cmpq   $0x0,-0x10(%rbp)
je     16de <unit_test_st_aligned_realloc+0x56e>
mov    -0x10(%rbp),%rdi
call   1030 <st_aligned_free@plt>
movq   $0x0,-0x10(%rbp)
jmp    16e3 <unit_test_st_aligned_realloc+0x573>
mov    0x28f6(%rip),%rax
mov    (%rax),%edi
lea    0x943(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1626 <unit_test_st_aligned_realloc+0x4b6>
movl   $0x0,-0x4(%rbp)
jmp    1741 <unit_test_st_aligned_realloc+0x5d1>
jmp    1719 <unit_test_st_aligned_realloc+0x5a9>
cmpq   $0x0,-0x10(%rbp)
je     1735 <unit_test_st_aligned_realloc+0x5c5>
mov    -0x10(%rbp),%rdi
call   1030 <st_aligned_free@plt>
movq   $0x0,-0x10(%rbp)
jmp    173a <unit_test_st_aligned_realloc+0x5ca>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unit_test_st_aligned_realloc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e5e(%rip),%r13
mov    0x0(%r13),%edi
lea    0xee3(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xef0(%rip),%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x4,%ebp
lea    0xeef(%rip),%r14
jmp    11d6 <unit_test_st_aligned_realloc+0x66>
nopl   0x0(%rax)
mov    0x0(%r13),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%ebp
cmp    $0xd,%ebp
je     1230 <unit_test_st_aligned_realloc+0xc0>
mov    $0x1,%ebx
mov    %ebp,%ecx
shl    %cl,%ebx
mov    $0x7b,%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <st_aligned_alignment@plt>
cmp    %rbx,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
mov    %r12,%rdi
call   1050 <st_aligned_size@plt>
cmp    $0x7b,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
add    $0xffffffffffffffff,%rbx
test   %r12,%rbx
jne    14b8 <unit_test_st_aligned_realloc+0x348>
test   %r12,%r12
je     11c0 <unit_test_st_aligned_realloc+0x50>
mov    %r12,%rdi
call   1030 <st_aligned_free@plt>
jmp    11c0 <unit_test_st_aligned_realloc+0x50>
mov    0x0(%r13),%edi
lea    0xe54(%rip),%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x4,%r15d
movabs $0x7776757473727170,%r14
75 76 77
mov    $0x1,%ebp
mov    %r15d,%ecx
shl    %cl,%ebp
mov    $0x7b,%edi
mov    %rbp,%rsi
call   1080 <st_aligned_malloc_impl@plt>
mov    %rax,%rbx
movaps 0xd88(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xd8e(%rip),%xmm0
movups %xmm0,0x10(%rax)
movaps 0xd93(%rip),%xmm0
movups %xmm0,0x20(%rax)
movaps 0xd98(%rip),%xmm0
movups %xmm0,0x30(%rax)
movaps 0xd9d(%rip),%xmm0
movups %xmm0,0x40(%rax)
movaps 0xda2(%rip),%xmm0
movups %xmm0,0x50(%rax)
movaps 0xda7(%rip),%xmm0
movups %xmm0,0x60(%rax)
mov    %r14,0x70(%rax)
movw   $0x7978,0x78(%rax)
movb   $0x7a,0x7a(%rax)
mov    $0x1,%edi
call   1060 <assert@plt>
mov    $0x85,%esi
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <st_aligned_alignment@plt>
cmp    %rbp,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
mov    %r12,%rdi
call   1050 <st_aligned_size@plt>
cmp    $0x85,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
lea    -0x1(%rbp),%rbx
test   %r12,%rbx
jne    14b8 <unit_test_st_aligned_realloc+0x348>
xor    %eax,%eax
nopl   0x0(%rax)
movsbq (%r12,%rax,1),%rcx
cmp    %rcx,%rax
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
movsbq 0x1(%r12,%rax,1),%rdx
lea    0x1(%rax),%rcx
cmp    %rdx,%rcx
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
movsbq 0x2(%r12,%rax,1),%rax
add    $0x1,%rcx
cmp    %rax,%rcx
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
add    $0x1,%rcx
mov    %rcx,%rax
cmp    $0x7b,%rcx
jne    1320 <unit_test_st_aligned_realloc+0x1b0>
mov    $0x9e,%esi
mov    %r12,%rdi
mov    %rbp,%rdx
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <st_aligned_alignment@plt>
cmp    %rbp,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
mov    %r12,%rdi
call   1050 <st_aligned_size@plt>
cmp    $0x9e,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
and    %r12,%rbx
jne    14b8 <unit_test_st_aligned_realloc+0x348>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbq (%r12,%rax,1),%rcx
cmp    %rcx,%rax
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
movsbq 0x1(%r12,%rax,1),%rdx
lea    0x1(%rax),%rcx
cmp    %rdx,%rcx
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
movsbq 0x2(%r12,%rax,1),%rax
add    $0x1,%rcx
cmp    %rax,%rcx
jne    1432 <unit_test_st_aligned_realloc+0x2c2>
add    $0x1,%rcx
mov    %rcx,%rax
cmp    $0x7b,%rcx
jne    13b0 <unit_test_st_aligned_realloc+0x240>
mov    %r12,%rdi
call   1030 <st_aligned_free@plt>
mov    0x0(%r13),%edi
lea    0xcae(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%r15d
cmp    $0xd,%r15d
jne    1257 <unit_test_st_aligned_realloc+0xe7>
mov    0x0(%r13),%edi
lea    0xc77(%rip),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x4,%ebp
lea    0xc76(%rip),%r14
jmp    1461 <unit_test_st_aligned_realloc+0x2f1>
mov    0x0(%r13),%edi
lea    0xc61(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    14cf <unit_test_st_aligned_realloc+0x35f>
mov    0x0(%r13),%edi
xor    %ebx,%ebx
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
add    $0x1,%ebp
cmp    $0xd,%ebp
je     14dc <unit_test_st_aligned_realloc+0x36c>
mov    $0x1,%ebx
mov    %ebp,%ecx
shl    %cl,%ebx
mov    $0x7b,%edi
mov    %rbx,%rsi
call   1080 <st_aligned_malloc_impl@plt>
mov    %rax,%r15
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1060 <assert@plt>
lea    (%rbx,%rbx,1),%rdx
mov    $0x85,%esi
mov    %r15,%rdi
call   1090 <st_aligned_realloc_impl@plt>
mov    %rax,%r12
lea    (%rbx,%rbx,1),%rax
add    $0xffffffffffffffff,%rax
test   %r12,%rax
jne    14b8 <unit_test_st_aligned_realloc+0x348>
test   %r12,%r12
je     1449 <unit_test_st_aligned_realloc+0x2d9>
mov    %r12,%rdi
call   1030 <st_aligned_free@plt>
jmp    1449 <unit_test_st_aligned_realloc+0x2d9>
mov    0x0(%r13),%edi
lea    0xbdb(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
test   %r12,%r12
je     14d7 <unit_test_st_aligned_realloc+0x367>
mov    %r12,%rdi
call   1030 <st_aligned_free@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c" Testing st_aligned_malloc...\0A\00"
@.str.1 = [15 x i8] c" Case %d...\00"
@.str.2 = [8 x i8] c"Failed\0A\00"
@.str.3 = [8 x i8] c"Passed\0A\00"
define i32 @unit_test_st_aligned_realloc() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i8* null, i8** %2
store i64 123, i64* %3
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %8
%11 = load i32, i32* @stderr
%12 = load i32, i32* %8
%13 = add nsw i32 %12, 1
store i32 %13, i32* %8
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %12)
store i32 4, i32* %7
br label %15
15: ; preds = %61, %0
%16 = load i32, i32* %7
%17 = icmp sle i32 %16, 12
br i1 %17, label %18, label %64
18: ; preds = %15
%19 = load i32, i32* %7
%20 = shl i32 1, %19
%21 = sext i32 %20 to i64
store i64 %21, i64* %6
%22 = load i64, i64* %3
%23 = load i64, i64* %6
%24 = call i8* @st_aligned_realloc_impl(i8* null, i64 %22, i64 %23)
store i8* %24, i8** %2
%25 = load i8*, i8** %2
%26 = call i64 @st_aligned_alignment(i8* %25)
%27 = load i64, i64* %6
%28 = icmp ne i64 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
32: ; preds = %18
%33 = load i8*, i8** %2
%34 = call i64 @st_aligned_size(i8* %33)
%35 = load i64, i64* %3
%36 = icmp ne i64 %34, %35
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
40: ; preds = %32
%41 = load i8*, i8** %2
%42 = ptrtoint i8* %41 to i64
%43 = load i64, i64* %6
%44 = sub i64 %43, 1
%45 = and i64 %42, %44
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %40
%48 = load i32, i32* @stderr
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
50: ; preds = %40
br label %51
51: ; preds = %50
%52 = load i8*, i8** %2
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i8*, i8** %2
%56 = call i32 @st_aligned_free(i8* %55)
store i8* null, i8** %2
br label %57
57: ; preds = %54, %51
br label %58
58: ; preds = %57
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %61
61: ; preds = %58
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %15
64: ; preds = %15
%65 = load i32, i32* @stderr
%66 = load i32, i32* %8
%67 = add nsw i32 %66, 1
store i32 %67, i32* %8
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %66)
store i32 4, i32* %7
br label %69
69: ; preds = %217, %64
%70 = load i32, i32* %7
%71 = icmp sle i32 %70, 12
br i1 %71, label %72, label %220
72: ; preds = %69
%73 = load i32, i32* %7
%74 = shl i32 1, %73
%75 = sext i32 %74 to i64
store i64 %75, i64* %6
%76 = load i64, i64* %3
%77 = load i64, i64* %6
%78 = call i8* @st_aligned_malloc_impl(i64 %76, i64 %77)
store i8* %78, i8** %2
store i64 0, i64* %5
br label %79
79: ; preds = %89, %72
%80 = load i64, i64* %5
%81 = load i64, i64* %3
%82 = icmp ult i64 %80, %81
br i1 %82, label %83, label %92
83: ; preds = %79
%84 = load i64, i64* %5
%85 = trunc i64 %84 to i8
%86 = load i8*, i8** %2
%87 = load i64, i64* %5
%88 = getelementptr inbounds i8, i8* %86, i64 %87
store i8 %85, i8* %88
br label %89
89: ; preds = %83
%90 = load i64, i64* %5
%91 = add i64 %90, 1
store i64 %91, i64* %5
br label %79
92: ; preds = %79
%93 = load i8*, i8** %2
%94 = icmp ne i8* %93, null
%95 = zext i1 %94 to i32
%96 = call i32 @assert(i32 %95)
store i64 10, i64* %4
%97 = load i8*, i8** %2
%98 = load i64, i64* %3
%99 = load i64, i64* %4
%100 = add i64 %98, %99
%101 = load i64, i64* %6
%102 = call i8* @st_aligned_realloc_impl(i8* %97, i64 %100, i64 %101)
store i8* %102, i8** %2
%103 = load i8*, i8** %2
%104 = call i64 @st_aligned_alignment(i8* %103)
%105 = load i64, i64* %6
%106 = icmp ne i64 %104, %105
br i1 %106, label %107, label %110
107: ; preds = %92
%108 = load i32, i32* @stderr
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
110: ; preds = %92
%111 = load i8*, i8** %2
%112 = call i64 @st_aligned_size(i8* %111)
%113 = load i64, i64* %3
%114 = load i64, i64* %4
%115 = add i64 %113, %114
%116 = icmp ne i64 %112, %115
br i1 %116, label %117, label %120
117: ; preds = %110
%118 = load i32, i32* @stderr
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
120: ; preds = %110
%121 = load i8*, i8** %2
%122 = ptrtoint i8* %121 to i64
%123 = load i64, i64* %6
%124 = sub i64 %123, 1
%125 = and i64 %122, %124
%126 = icmp ne i64 %125, 0
br i1 %126, label %127, label %130
127: ; preds = %120
%128 = load i32, i32* @stderr
%129 = call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
130: ; preds = %120
store i64 0, i64* %5
br label %131
131: ; preds = %147, %130
%132 = load i64, i64* %5
%133 = load i64, i64* %3
%134 = icmp ult i64 %132, %133
br i1 %134, label %135, label %150
135: ; preds = %131
%136 = load i8*, i8** %2
%137 = load i64, i64* %5
%138 = getelementptr inbounds i8, i8* %136, i64 %137
%139 = load i8, i8* %138
%140 = sext i8 %139 to i64
%141 = load i64, i64* %5
%142 = icmp ne i64 %140, %141
br i1 %142, label %143, label %146
143: ; preds = %135
%144 = load i32, i32* @stderr
%145 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
146: ; preds = %135
br label %147
147: ; preds = %146
%148 = load i64, i64* %5
%149 = add i64 %148, 1
store i64 %149, i64* %5
br label %131
150: ; preds = %131
%151 = load i64, i64* %4
%152 = add i64 %151, 25
store i64 %152, i64* %4
%153 = load i8*, i8** %2
%154 = load i64, i64* %3
%155 = load i64, i64* %4
%156 = add i64 %154, %155
%157 = load i64, i64* %6
%158 = call i8* @st_aligned_realloc_impl(i8* %153, i64 %156, i64 %157)
store i8* %158, i8** %2
%159 = load i8*, i8** %2
%160 = call i64 @st_aligned_alignment(i8* %159)
%161 = load i64, i64* %6
%162 = icmp ne i64 %160, %161
br i1 %162, label %163, label %166
163: ; preds = %150
%164 = load i32, i32* @stderr
%165 = call i32 (i32, i8*, ...) @fprintf(i32 %164, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
166: ; preds = %150
%167 = load i8*, i8** %2
%168 = call i64 @st_aligned_size(i8* %167)
%169 = load i64, i64* %3
%170 = load i64, i64* %4
%171 = add i64 %169, %170
%172 = icmp ne i64 %168, %171
br i1 %172, label %173, label %176
173: ; preds = %166
%174 = load i32, i32* @stderr
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
176: ; preds = %166
%177 = load i8*, i8** %2
%178 = ptrtoint i8* %177 to i64
%179 = load i64, i64* %6
%180 = sub i64 %179, 1
%181 = and i64 %178, %180
%182 = icmp ne i64 %181, 0
br i1 %182, label %183, label %186
183: ; preds = %176
%184 = load i32, i32* @stderr
%185 = call i32 (i32, i8*, ...) @fprintf(i32 %184, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
186: ; preds = %176
store i64 0, i64* %5
br label %187
187: ; preds = %203, %186
%188 = load i64, i64* %5
%189 = load i64, i64* %3
%190 = icmp ult i64 %188, %189
br i1 %190, label %191, label %206
191: ; preds = %187
%192 = load i8*, i8** %2
%193 = load i64, i64* %5
%194 = getelementptr inbounds i8, i8* %192, i64 %193
%195 = load i8, i8* %194
%196 = sext i8 %195 to i64
%197 = load i64, i64* %5
%198 = icmp ne i64 %196, %197
br i1 %198, label %199, label %202
199: ; preds = %191
%200 = load i32, i32* @stderr
%201 = call i32 (i32, i8*, ...) @fprintf(i32 %200, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
202: ; preds = %191
br label %203
203: ; preds = %202
%204 = load i64, i64* %5
%205 = add i64 %204, 1
store i64 %205, i64* %5
br label %187
206: ; preds = %187
br label %207
207: ; preds = %206
%208 = load i8*, i8** %2
%209 = icmp ne i8* %208, null
br i1 %209, label %210, label %213
210: ; preds = %207
%211 = load i8*, i8** %2
%212 = call i32 @st_aligned_free(i8* %211)
store i8* null, i8** %2
br label %213
213: ; preds = %210, %207
br label %214
214: ; preds = %213
%215 = load i32, i32* @stderr
%216 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %217
217: ; preds = %214
%218 = load i32, i32* %7
%219 = add nsw i32 %218, 1
store i32 %219, i32* %7
br label %69
220: ; preds = %69
%221 = load i32, i32* @stderr
%222 = load i32, i32* %8
%223 = add nsw i32 %222, 1
store i32 %223, i32* %8
%224 = call i32 (i32, i8*, ...) @fprintf(i32 %221, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %222)
store i32 4, i32* %7
br label %225
225: ; preds = %266, %220
%226 = load i32, i32* %7
%227 = icmp sle i32 %226, 12
br i1 %227, label %228, label %269
228: ; preds = %225
%229 = load i32, i32* %7
%230 = shl i32 1, %229
%231 = sext i32 %230 to i64
store i64 %231, i64* %6
%232 = load i64, i64* %3
%233 = load i64, i64* %6
%234 = call i8* @st_aligned_malloc_impl(i64 %232, i64 %233)
store i8* %234, i8** %2
%235 = load i8*, i8** %2
%236 = icmp ne i8* %235, null
%237 = zext i1 %236 to i32
%238 = call i32 @assert(i32 %237)
%239 = load i64, i64* %6
%240 = mul i64 %239, 2
store i64 %240, i64* %6
%241 = load i8*, i8** %2
%242 = load i64, i64* %3
%243 = add i64 %242, 10
%244 = load i64, i64* %6
%245 = call i8* @st_aligned_realloc_impl(i8* %241, i64 %243, i64 %244)
store i8* %245, i8** %2
%246 = load i8*, i8** %2
%247 = ptrtoint i8* %246 to i64
%248 = load i64, i64* %6
%249 = sub i64 %248, 1
%250 = and i64 %247, %249
%251 = icmp ne i64 %250, 0
br i1 %251, label %252, label %255
252: ; preds = %228
%253 = load i32, i32* @stderr
%254 = call i32 (i32, i8*, ...) @fprintf(i32 %253, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %270
255: ; preds = %228
br label %256
256: ; preds = %255
%257 = load i8*, i8** %2
%258 = icmp ne i8* %257, null
br i1 %258, label %259, label %262
259: ; preds = %256
%260 = load i8*, i8** %2
%261 = call i32 @st_aligned_free(i8* %260)
store i8* null, i8** %2
br label %262
262: ; preds = %259, %256
br label %263
263: ; preds = %262
%264 = load i32, i32* @stderr
%265 = call i32 (i32, i8*, ...) @fprintf(i32 %264, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %266
266: ; preds = %263
%267 = load i32, i32* %7
%268 = add nsw i32 %267, 1
store i32 %268, i32* %7
br label %225
269: ; preds = %225
store i32 0, i32* %1
br label %279
270: ; preds = %252, %199, %183, %173, %163, %143, %127, %117, %107, %47, %37, %29
br label %271
271: ; preds = %270
%272 = load i8*, i8** %2
%273 = icmp ne i8* %272, null
br i1 %273, label %274, label %277
274: ; preds = %271
%275 = load i8*, i8** %2
%276 = call i32 @st_aligned_free(i8* %275)
store i8* null, i8** %2
br label %277
277: ; preds = %274, %271
br label %278
278: ; preds = %277
store i32 -1, i32* %1
br label %279
279: ; preds = %278, %269
%280 = load i32, i32* %1
ret i32 %280
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c" Testing st_aligned_malloc...\0A\00"
@.str.1 = [15 x i8] c" Case %d...\00"
@.str.2 = [8 x i8] c"Failed\0A\00"
@.str.3 = [8 x i8] c"Passed\0A\00"
define i32 @unit_test_st_aligned_realloc() {
%1 = load i32, i32* @stderr
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %5
5: ; preds = %0, %24
%6 = phi i32 [ 4, %0 ], [ %27, %24 ]
%7 = shl nuw nsw i32 1, %6
%8 = zext i32 %7 to i64
%9 = tail call i8* @st_aligned_realloc_impl(i8* null, i64 123, i64 %8)
%10 = tail call i64 @st_aligned_alignment(i8* %9)
%11 = icmp eq i64 %10, %8
br i1 %11, label %12, label %158
12: ; preds = %5
%13 = tail call i64 @st_aligned_size(i8* %9)
%14 = icmp eq i64 %13, 123
br i1 %14, label %15, label %158
15: ; preds = %12
%16 = ptrtoint i8* %9 to i64
%17 = add nsw i64 %8, -1
%18 = and i64 %17, %16
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %158
20: ; preds = %15
%21 = icmp eq i8* %9, null
br i1 %21, label %24, label %22
22: ; preds = %20
%23 = tail call i32 @st_aligned_free(i8* %9)
br label %24
24: ; preds = %22, %20
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%27 = add nuw nsw i32 %6, 1
%28 = icmp eq i32 %27, 13
br i1 %28, label %29, label %5
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 2)
br label %32
32: ; preds = %29, %126
%33 = phi i32 [ 4, %29 ], [ %130, %126 ]
%34 = shl nuw nsw i32 1, %33
%35 = zext i32 %34 to i64
%36 = tail call i8* @st_aligned_malloc_impl(i64 123, i64 %35)
%37 = bitcast i8* %36 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %37
%38 = getelementptr inbounds i8, i8* %36, i64 16
%39 = bitcast i8* %38 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %39
%40 = getelementptr inbounds i8, i8* %36, i64 32
%41 = bitcast i8* %40 to <16 x i8>*
store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, <16 x i8>* %41
%42 = getelementptr inbounds i8, i8* %36, i64 48
%43 = bitcast i8* %42 to <16 x i8>*
store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, <16 x i8>* %43
%44 = getelementptr inbounds i8, i8* %36, i64 64
%45 = bitcast i8* %44 to <16 x i8>*
store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, <16 x i8>* %45
%46 = getelementptr inbounds i8, i8* %36, i64 80
%47 = bitcast i8* %46 to <16 x i8>*
store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, <16 x i8>* %47
%48 = getelementptr inbounds i8, i8* %36, i64 96
%49 = bitcast i8* %48 to <16 x i8>*
store <16 x i8> <i8 96, i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111>, <16 x i8>* %49
%50 = getelementptr inbounds i8, i8* %36, i64 112
store i8 112, i8* %50
%51 = getelementptr inbounds i8, i8* %36, i64 113
store i8 113, i8* %51
%52 = getelementptr inbounds i8, i8* %36, i64 114
store i8 114, i8* %52
%53 = getelementptr inbounds i8, i8* %36, i64 115
store i8 115, i8* %53
%54 = getelementptr inbounds i8, i8* %36, i64 116
store i8 116, i8* %54
%55 = getelementptr inbounds i8, i8* %36, i64 117
store i8 117, i8* %55
%56 = getelementptr inbounds i8, i8* %36, i64 118
store i8 118, i8* %56
%57 = getelementptr inbounds i8, i8* %36, i64 119
store i8 119, i8* %57
%58 = getelementptr inbounds i8, i8* %36, i64 120
store i8 120, i8* %58
%59 = getelementptr inbounds i8, i8* %36, i64 121
store i8 121, i8* %59
%60 = getelementptr inbounds i8, i8* %36, i64 122
store i8 122, i8* %60
%61 = tail call i32 @assert(i32 1)
%62 = tail call i8* @st_aligned_realloc_impl(i8* %36, i64 133, i64 %35)
%63 = tail call i64 @st_aligned_alignment(i8* %62)
%64 = icmp eq i64 %63, %35
br i1 %64, label %65, label %158
65: ; preds = %32
%66 = tail call i64 @st_aligned_size(i8* %62)
%67 = icmp eq i64 %66, 133
br i1 %67, label %68, label %158
68: ; preds = %65
%69 = ptrtoint i8* %62 to i64
%70 = add nsw i64 %35, -1
%71 = and i64 %70, %69
%72 = icmp eq i64 %71, 0
br i1 %72, label %88, label %158
73: ; preds = %88
%74 = add nuw nsw i64 %89, 1
%75 = getelementptr inbounds i8, i8* %62, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i64
%78 = icmp eq i64 %74, %77
br i1 %78, label %79, label %163
79: ; preds = %73
%80 = add nuw nsw i64 %89, 2
%81 = getelementptr inbounds i8, i8* %62, i64 %80
%82 = load i8, i8* %81
%83 = sext i8 %82 to i64
%84 = icmp eq i64 %80, %83
br i1 %84, label %85, label %163
85: ; preds = %79
%86 = add nuw nsw i64 %89, 3
%87 = icmp eq i64 %86, 123
br i1 %87, label %94, label %88
88: ; preds = %68, %85
%89 = phi i64 [ %86, %85 ], [ 0, %68 ]
%90 = getelementptr inbounds i8, i8* %62, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i64
%93 = icmp eq i64 %89, %92
br i1 %93, label %73, label %163
94: ; preds = %85
%95 = tail call i8* @st_aligned_realloc_impl(i8* %62, i64 158, i64 %35)
%96 = tail call i64 @st_aligned_alignment(i8* %95)
%97 = icmp eq i64 %96, %35
br i1 %97, label %98, label %158
98: ; preds = %94
%99 = tail call i64 @st_aligned_size(i8* %95)
%100 = icmp eq i64 %99, 158
%101 = ptrtoint i8* %95 to i64
%102 = and i64 %70, %101
%103 = icmp eq i64 %102, 0
%104 = select i1 %100, i1 %103, i1 false
br i1 %104, label %120, label %158
105: ; preds = %120
%106 = add nuw nsw i64 %121, 1
%107 = getelementptr inbounds i8, i8* %95, i64 %106
%108 = load i8, i8* %107
%109 = sext i8 %108 to i64
%110 = icmp eq i64 %106, %109
br i1 %110, label %111, label %163
111: ; preds = %105
%112 = add nuw nsw i64 %121, 2
%113 = getelementptr inbounds i8, i8* %95, i64 %112
%114 = load i8, i8* %113
%115 = sext i8 %114 to i64
%116 = icmp eq i64 %112, %115
br i1 %116, label %117, label %163
117: ; preds = %111
%118 = add nuw nsw i64 %121, 3
%119 = icmp eq i64 %118, 123
br i1 %119, label %126, label %120
120: ; preds = %98, %117
%121 = phi i64 [ %118, %117 ], [ 0, %98 ]
%122 = getelementptr inbounds i8, i8* %95, i64 %121
%123 = load i8, i8* %122
%124 = sext i8 %123 to i64
%125 = icmp eq i64 %121, %124
br i1 %125, label %105, label %163
126: ; preds = %117
%127 = tail call i32 @st_aligned_free(i8* %95)
%128 = load i32, i32* @stderr
%129 = tail call i32 (i32, i8*, ...) @fprintf(i32 %128, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%130 = add nuw nsw i32 %33, 1
%131 = icmp eq i32 %130, 13
br i1 %131, label %132, label %32
132: ; preds = %126
%133 = load i32, i32* @stderr
%134 = tail call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 3)
br label %135
135: ; preds = %132, %153
%136 = phi i32 [ 4, %132 ], [ %156, %153 ]
%137 = shl nuw nsw i32 1, %136
%138 = zext i32 %137 to i64
%139 = tail call i8* @st_aligned_malloc_impl(i64 123, i64 %138)
%140 = icmp ne i8* %139, null
%141 = zext i1 %140 to i32
%142 = tail call i32 @assert(i32 %141)
%143 = shl nuw nsw i64 %138, 1
%144 = tail call i8* @st_aligned_realloc_impl(i8* %139, i64 133, i64 %143)
%145 = ptrtoint i8* %144 to i64
%146 = add nsw i64 %143, -1
%147 = and i64 %146, %145
%148 = icmp eq i64 %147, 0
br i1 %148, label %149, label %158
149: ; preds = %135
%150 = icmp eq i8* %144, null
br i1 %150, label %153, label %151
151: ; preds = %149
%152 = tail call i32 @st_aligned_free(i8* %144)
br label %153
153: ; preds = %151, %149
%154 = load i32, i32* @stderr
%155 = tail call i32 (i32, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%156 = add nuw nsw i32 %136, 1
%157 = icmp eq i32 %156, 13
br i1 %157, label %170, label %135
158: ; preds = %15, %12, %5, %98, %94, %68, %65, %32, %135
%159 = phi i8* [ %144, %135 ], [ %62, %32 ], [ %62, %65 ], [ %62, %68 ], [ %95, %94 ], [ %95, %98 ], [ %9, %5 ], [ %9, %12 ], [ %9, %15 ]
%160 = load i32, i32* @stderr
%161 = tail call i32 (i32, i8*, ...) @fprintf(i32 %160, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%162 = icmp eq i8* %159, null
br i1 %162, label %170, label %167
163: ; preds = %88, %73, %79, %120, %105, %111
%164 = phi i8* [ %95, %111 ], [ %95, %105 ], [ %95, %120 ], [ %62, %79 ], [ %62, %73 ], [ %62, %88 ]
%165 = load i32, i32* @stderr
%166 = tail call i32 (i32, i8*, ...) @fprintf(i32 %165, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %167
167: ; preds = %163, %158
%168 = phi i8* [ %159, %158 ], [ %164, %163 ]
%169 = tail call i32 @st_aligned_free(i8* %168)
br label %170
170: ; preds = %153, %158, %167
%171 = phi i32 [ -1, %167 ], [ -1, %158 ], [ 0, %153 ]
ret i32 %171
}