#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*/ free(char *);
char *malloc(int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int test_memchr(char *, char, int, char *);
int test_memcmp(char *, char *, int, int);
int test_memmove(char *, char *, int, char *, char *, int);
scalar_t__ test_memset(char *, int, int);
int test_strcasecmp(char *, char *, int);
int test_strchr(char *, char, char *);
int test_strcmp(char *, char *, int);
int test_strncasecmp(char *, char *, int, int);
int main(void) {
  char *buf;
  char *buf2;
  buf = malloc(100);
  assert(test_memset(buf, 0x42, 100) == 0);
  free(buf);
  buf = malloc(128);
  assert(test_memset(buf, 0, 128) == 0);
  assert(test_memset(buf + 1, 0, 127) == 0);
  free(buf);
  buf = malloc(1024);
  assert(test_memset(buf, 0, 1024) == 0);
  free(buf);
  buf = malloc(20);
  strncpy(buf, "Hello World!", 20);
  assert(test_memchr(buf, 'o', strlen(buf), buf + 4));
  assert(test_memchr(buf, 'a', strlen(buf), NULL));
  assert(test_memcmp(buf, "Hello World!", strlen(buf), 0));
  assert(test_memcmp(buf, "Hfllow World", strlen(buf), -1));
  assert(test_strcmp(buf, "Hello World!", 0));
  assert(test_strcmp(buf, "Hfllow World", -1));
  assert(test_strchr(buf, 'H', buf));
  assert(test_strchr(buf, 'e', buf + 1));
  assert(test_strchr(buf, 'a', NULL));
  assert(test_strchr(buf, '!', buf + 11));
  assert(test_strcasecmp(buf, "Hello World!", 0));
  assert(test_strcasecmp(buf, "HELLO WORLD!", 0));
  assert(test_strcasecmp(buf, "IELLO world!", -1));
  assert(test_strcasecmp(buf, "HeLLo WOrlc!", 1));
  assert(test_strncasecmp(buf, "Hello World!", strlen(buf), 0));
  assert(test_strncasecmp(buf, "HELLO WORLD!", strlen(buf), 0));
  assert(test_strncasecmp(buf, "IELLO world!", strlen(buf), -1));
  assert(test_strncasecmp(buf, "HeLLo WOrlc!", strlen(buf), 1));
  assert(test_strncasecmp(buf, "HeLLo WOrlc!", 0, 0));
  assert(test_strncasecmp(buf, "HeLLo WOrlc!", 1, 0));
  assert(test_strncasecmp(buf, "HeLLo WOrlc!", 2, 0));
  assert(test_strncasecmp(buf, "HeLLp WOrlc!", 5, -1));
  free(buf);
  buf = malloc(20);
  buf2 = malloc(20);
  strncpy(buf, "Hello", 20);
  strncpy(buf2, " World!", 20);
  assert(test_memmove(buf + 5, buf2, strlen(buf2), buf, "Hello World!",
                      strlen("Hello World!")));
  strncpy(buf, "HHello World!", 20);
  assert(test_memmove(buf, buf + 1, strlen("Hello World!"), buf, "Hello World!",
                      strlen("Hello World!")));
  strncpy(buf, "0123456789", 20);
  assert(test_memmove(buf + 1, buf, strlen("0123456789"), buf, "00123456789",
                      strlen("00123456789")));
  free(buf);
  free(buf2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x42,%esi
mov    $0x64,%edx
call   1060 <test_memset@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <test_memset@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
xor    %esi,%esi
mov    $0x7f,%edx
call   1060 <test_memset@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <test_memset@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd7d(%rip),%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%edx
mov    -0x10(%rbp),%rcx
add    $0x4,%rcx
mov    $0x6f,%esi
call   10c0 <test_memchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xb0(%rbp),%rdi
mov    %eax,%edx
mov    $0x61,%esi
xor    %eax,%eax
mov    %eax,%ecx
call   10c0 <test_memchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xa8(%rbp),%rdi
mov    %eax,%edx
lea    0xce7(%rip),%rsi
xor    %ecx,%ecx
call   10f0 <test_memcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xa0(%rbp),%rdi
mov    %eax,%edx
lea    0xc6d(%rip),%rsi
mov    $0xffffffff,%ecx
call   10f0 <test_memcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xc99(%rip),%rsi
xor    %edx,%edx
call   10b0 <test_strcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xc38(%rip),%rsi
mov    $0xffffffff,%edx
call   10b0 <test_strcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x48,%esi
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
add    $0x1,%rdx
mov    $0x65,%esi
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x61,%esi
xor    %eax,%eax
mov    %eax,%edx
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rdx
add    $0xb,%rdx
mov    $0x21,%esi
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xbf8(%rip),%rsi
xor    %edx,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xba4(%rip),%rsi
xor    %edx,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xb98(%rip),%rsi
mov    $0xffffffff,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xb89(%rip),%rsi
mov    $0x1,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%edx
lea    0xb75(%rip),%rsi
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x90(%rbp),%rdi
mov    %eax,%edx
lea    0xb08(%rip),%rsi
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x88(%rbp),%rdi
mov    %eax,%edx
lea    0xae3(%rip),%rsi
mov    $0xffffffff,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%edx
lea    0xac1(%rip),%rsi
mov    $0x1,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xaa5(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xa8a(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xa6c(%rip),%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xa5b(%rip),%rsi
mov    $0x5,%edx
mov    $0xffffffff,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xa22(%rip),%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xa19(%rip),%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    0x9db(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x64(%rbp),%edx
mov    -0x60(%rbp),%rcx
mov    %eax,%r9d
lea    0x9bd(%rip),%r8
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0x9a5(%rip),%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
lea    0x981(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    0x96a(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%rcx
mov    %eax,%r9d
lea    0x94c(%rip),%r8
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0x943(%rip),%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0x91e(%rip),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0x906(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    %eax,%r9d
lea    0x8e8(%rip),%r8
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x42,%esi
mov    $0x64,%edx
call   1060 <test_memset@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x80,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <test_memset@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0x1(%rbx),%rdi
xor    %esi,%esi
mov    $0x7f,%edx
call   1060 <test_memset@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x400,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1060 <test_memset@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
lea    0xda2(%rip),%r14
mov    %rax,%rdi
mov    %r14,%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0x4(%rbx),%rcx
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    %eax,%edx
call   10c0 <test_memchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
mov    %eax,%edx
xor    %ecx,%ecx
call   10c0 <test_memchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10f0 <test_memcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xcdb(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    $0xffffffff,%ecx
call   10f0 <test_memcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   10b0 <test_strcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0xffffffff,%edx
call   10b0 <test_strcmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    $0x48,%esi
mov    %rbx,%rdx
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0x1(%rbx),%rdx
mov    %rbx,%rdi
mov    $0x65,%esi
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
xor    %edx,%edx
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xb(%rbx),%rdx
mov    %rbx,%rdi
mov    $0x21,%esi
call   10e0 <test_strchr@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xc2c(%rip),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %edx,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xc1e(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xffffffff,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xc0d(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1080 <test_strcasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
mov    $0xffffffff,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
mov    $0x1,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x2,%edx
xor    %ecx,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xb36(%rip),%rsi
mov    %rbx,%rdi
mov    $0x5,%edx
mov    $0xffffffff,%ecx
call   10d0 <test_strncasecmp@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    $0x14,%edi
call   10a0 <malloc@plt>
mov    %rax,%r15
lea    0xb01(%rip),%rsi
mov    %rbx,%rdi
mov    $0x14,%edx
call   1040 <strncpy@plt>
lea    0xaf9(%rip),%rsi
mov    %r15,%rdi
mov    $0x14,%edx
call   1040 <strncpy@plt>
lea    0x5(%rbx),%r12
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %eax,%r9d
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xaac(%rip),%rsi
mov    %rbx,%rdi
mov    $0x14,%edx
call   1040 <strncpy@plt>
lea    0x1(%rbx),%r12
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %eax,%r9d
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
lea    0xa74(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x14,%edx
call   1040 <strncpy@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
lea    0xa52(%rip),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14,%r8
mov    %eax,%r9d
call   1090 <test_memmove@plt>
mov    %eax,%edi
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
@.str.1 = [13 x i8] c"Hfllow World\00"
@.str.2 = [13 x i8] c"HELLO WORLD!\00"
@.str.3 = [13 x i8] c"IELLO world!\00"
@.str.4 = [13 x i8] c"HeLLo WOrlc!\00"
@.str.5 = [13 x i8] c"HeLLp WOrlc!\00"
@.str.6 = [6 x i8] c"Hello\00"
@.str.7 = [8 x i8] c" World!\00"
@.str.8 = [14 x i8] c"HHello World!\00"
@.str.9 = [11 x i8] c"0123456789\00"
@.str.10 = [12 x i8] c"00123456789\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @malloc(i32 100)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @test_memset(i8* %5, i32 66, i32 100)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
%12 = call i8* @malloc(i32 128)
store i8* %12, i8** %2
%13 = load i8*, i8** %2
%14 = call i64 @test_memset(i8* %13, i32 0, i32 128)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = call i64 @test_memset(i8* %19, i32 0, i32 127)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i8*, i8** %2
%25 = call i32 @free(i8* %24)
%26 = call i8* @malloc(i32 1024)
store i8* %26, i8** %2
%27 = load i8*, i8** %2
%28 = call i64 @test_memset(i8* %27, i32 0, i32 1024)
%29 = icmp eq i64 %28, 0
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i8*, i8** %2
%33 = call i32 @free(i8* %32)
%34 = call i8* @malloc(i32 20)
store i8* %34, i8** %2
%35 = load i8*, i8** %2
%36 = call i32 @strncpy(i8* %35, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 20)
%37 = load i8*, i8** %2
%38 = load i8*, i8** %2
%39 = call i32 @strlen(i8* %38)
%40 = load i8*, i8** %2
%41 = getelementptr inbounds i8, i8* %40, i64 4
%42 = call i32 @test_memchr(i8* %37, i8 signext 111, i32 %39, i8* %41)
%43 = call i32 @assert(i32 %42)
%44 = load i8*, i8** %2
%45 = load i8*, i8** %2
%46 = call i32 @strlen(i8* %45)
%47 = call i32 @test_memchr(i8* %44, i8 signext 97, i32 %46, i8* null)
%48 = call i32 @assert(i32 %47)
%49 = load i8*, i8** %2
%50 = load i8*, i8** %2
%51 = call i32 @strlen(i8* %50)
%52 = call i32 @test_memcmp(i8* %49, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %51, i32 0)
%53 = call i32 @assert(i32 %52)
%54 = load i8*, i8** %2
%55 = load i8*, i8** %2
%56 = call i32 @strlen(i8* %55)
%57 = call i32 @test_memcmp(i8* %54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %56, i32 -1)
%58 = call i32 @assert(i32 %57)
%59 = load i8*, i8** %2
%60 = call i32 @test_strcmp(i8* %59, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
%61 = call i32 @assert(i32 %60)
%62 = load i8*, i8** %2
%63 = call i32 @test_strcmp(i8* %62, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%64 = call i32 @assert(i32 %63)
%65 = load i8*, i8** %2
%66 = load i8*, i8** %2
%67 = call i32 @test_strchr(i8* %65, i8 signext 72, i8* %66)
%68 = call i32 @assert(i32 %67)
%69 = load i8*, i8** %2
%70 = load i8*, i8** %2
%71 = getelementptr inbounds i8, i8* %70, i64 1
%72 = call i32 @test_strchr(i8* %69, i8 signext 101, i8* %71)
%73 = call i32 @assert(i32 %72)
%74 = load i8*, i8** %2
%75 = call i32 @test_strchr(i8* %74, i8 signext 97, i8* null)
%76 = call i32 @assert(i32 %75)
%77 = load i8*, i8** %2
%78 = load i8*, i8** %2
%79 = getelementptr inbounds i8, i8* %78, i64 11
%80 = call i32 @test_strchr(i8* %77, i8 signext 33, i8* %79)
%81 = call i32 @assert(i32 %80)
%82 = load i8*, i8** %2
%83 = call i32 @test_strcasecmp(i8* %82, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
%84 = call i32 @assert(i32 %83)
%85 = load i8*, i8** %2
%86 = call i32 @test_strcasecmp(i8* %85, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0)
%87 = call i32 @assert(i32 %86)
%88 = load i8*, i8** %2
%89 = call i32 @test_strcasecmp(i8* %88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 -1)
%90 = call i32 @assert(i32 %89)
%91 = load i8*, i8** %2
%92 = call i32 @test_strcasecmp(i8* %91, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 1)
%93 = call i32 @assert(i32 %92)
%94 = load i8*, i8** %2
%95 = load i8*, i8** %2
%96 = call i32 @strlen(i8* %95)
%97 = call i32 @test_strncasecmp(i8* %94, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %96, i32 0)
%98 = call i32 @assert(i32 %97)
%99 = load i8*, i8** %2
%100 = load i8*, i8** %2
%101 = call i32 @strlen(i8* %100)
%102 = call i32 @test_strncasecmp(i8* %99, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %101, i32 0)
%103 = call i32 @assert(i32 %102)
%104 = load i8*, i8** %2
%105 = load i8*, i8** %2
%106 = call i32 @strlen(i8* %105)
%107 = call i32 @test_strncasecmp(i8* %104, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %106, i32 -1)
%108 = call i32 @assert(i32 %107)
%109 = load i8*, i8** %2
%110 = load i8*, i8** %2
%111 = call i32 @strlen(i8* %110)
%112 = call i32 @test_strncasecmp(i8* %109, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %111, i32 1)
%113 = call i32 @assert(i32 %112)
%114 = load i8*, i8** %2
%115 = call i32 @test_strncasecmp(i8* %114, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%116 = call i32 @assert(i32 %115)
%117 = load i8*, i8** %2
%118 = call i32 @test_strncasecmp(i8* %117, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 0)
%119 = call i32 @assert(i32 %118)
%120 = load i8*, i8** %2
%121 = call i32 @test_strncasecmp(i8* %120, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 0)
%122 = call i32 @assert(i32 %121)
%123 = load i8*, i8** %2
%124 = call i32 @test_strncasecmp(i8* %123, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 5, i32 -1)
%125 = call i32 @assert(i32 %124)
%126 = load i8*, i8** %2
%127 = call i32 @free(i8* %126)
%128 = call i8* @malloc(i32 20)
store i8* %128, i8** %2
%129 = call i8* @malloc(i32 20)
store i8* %129, i8** %3
%130 = load i8*, i8** %2
%131 = call i32 @strncpy(i8* %130, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 20)
%132 = load i8*, i8** %3
%133 = call i32 @strncpy(i8* %132, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 20)
%134 = load i8*, i8** %2
%135 = getelementptr inbounds i8, i8* %134, i64 5
%136 = load i8*, i8** %3
%137 = load i8*, i8** %3
%138 = call i32 @strlen(i8* %137)
%139 = load i8*, i8** %2
%140 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%141 = call i32 @test_memmove(i8* %135, i8* %136, i32 %138, i8* %139, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %140)
%142 = call i32 @assert(i32 %141)
%143 = load i8*, i8** %2
%144 = call i32 @strncpy(i8* %143, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 20)
%145 = load i8*, i8** %2
%146 = load i8*, i8** %2
%147 = getelementptr inbounds i8, i8* %146, i64 1
%148 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%149 = load i8*, i8** %2
%150 = call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%151 = call i32 @test_memmove(i8* %145, i8* %147, i32 %148, i8* %149, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %150)
%152 = call i32 @assert(i32 %151)
%153 = load i8*, i8** %2
%154 = call i32 @strncpy(i8* %153, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 20)
%155 = load i8*, i8** %2
%156 = getelementptr inbounds i8, i8* %155, i64 1
%157 = load i8*, i8** %2
%158 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%159 = load i8*, i8** %2
%160 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%161 = call i32 @test_memmove(i8* %156, i8* %157, i32 %158, i8* %159, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %160)
%162 = call i32 @assert(i32 %161)
%163 = load i8*, i8** %2
%164 = call i32 @free(i8* %163)
%165 = load i8*, i8** %3
%166 = call i32 @free(i8* %165)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
@.str.1 = [13 x i8] c"Hfllow World\00"
@.str.2 = [13 x i8] c"HELLO WORLD!\00"
@.str.3 = [13 x i8] c"IELLO world!\00"
@.str.4 = [13 x i8] c"HeLLo WOrlc!\00"
@.str.5 = [13 x i8] c"HeLLp WOrlc!\00"
@.str.6 = [6 x i8] c"Hello\00"
@.str.7 = [8 x i8] c" World!\00"
@.str.8 = [14 x i8] c"HHello World!\00"
@.str.9 = [11 x i8] c"0123456789\00"
@.str.10 = [12 x i8] c"00123456789\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i64 @test_memset(i8* %1, i32 66, i32 100)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @free(i8* %1)
%7 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%8 = tail call i64 @test_memset(i8* %7, i32 0, i32 128)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = tail call i64 @test_memset(i8* %12, i32 0, i32 127)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 @free(i8* %7)
%18 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%19 = tail call i64 @test_memset(i8* %18, i32 0, i32 1024)
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @free(i8* %18)
%24 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%25 = tail call i32 @strncpy(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 20)
%26 = tail call i32 @strlen(i8* %24)
%27 = getelementptr inbounds i8, i8* %24, i64 4
%28 = tail call i32 @test_memchr(i8* %24, i8 signext 111, i32 %26, i8* %27)
%29 = tail call i32 @assert(i32 %28)
%30 = tail call i32 @strlen(i8* %24)
%31 = tail call i32 @test_memchr(i8* %24, i8 signext 97, i32 %30, i8* null)
%32 = tail call i32 @assert(i32 %31)
%33 = tail call i32 @strlen(i8* %24)
%34 = tail call i32 @test_memcmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %33, i32 0)
%35 = tail call i32 @assert(i32 %34)
%36 = tail call i32 @strlen(i8* %24)
%37 = tail call i32 @test_memcmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 -1)
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @test_strcmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
%40 = tail call i32 @assert(i32 %39)
%41 = tail call i32 @test_strcmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @test_strchr(i8* %24, i8 signext 72, i8* %24)
%44 = tail call i32 @assert(i32 %43)
%45 = getelementptr inbounds i8, i8* %24, i64 1
%46 = tail call i32 @test_strchr(i8* %24, i8 signext 101, i8* %45)
%47 = tail call i32 @assert(i32 %46)
%48 = tail call i32 @test_strchr(i8* %24, i8 signext 97, i8* null)
%49 = tail call i32 @assert(i32 %48)
%50 = getelementptr inbounds i8, i8* %24, i64 11
%51 = tail call i32 @test_strchr(i8* %24, i8 signext 33, i8* %50)
%52 = tail call i32 @assert(i32 %51)
%53 = tail call i32 @test_strcasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0)
%54 = tail call i32 @assert(i32 %53)
%55 = tail call i32 @test_strcasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 0)
%56 = tail call i32 @assert(i32 %55)
%57 = tail call i32 @test_strcasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 -1)
%58 = tail call i32 @assert(i32 %57)
%59 = tail call i32 @test_strcasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 1)
%60 = tail call i32 @assert(i32 %59)
%61 = tail call i32 @strlen(i8* %24)
%62 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %61, i32 0)
%63 = tail call i32 @assert(i32 %62)
%64 = tail call i32 @strlen(i8* %24)
%65 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %64, i32 0)
%66 = tail call i32 @assert(i32 %65)
%67 = tail call i32 @strlen(i8* %24)
%68 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %67, i32 -1)
%69 = tail call i32 @assert(i32 %68)
%70 = tail call i32 @strlen(i8* %24)
%71 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %70, i32 1)
%72 = tail call i32 @assert(i32 %71)
%73 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0)
%74 = tail call i32 @assert(i32 %73)
%75 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 0)
%76 = tail call i32 @assert(i32 %75)
%77 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 0)
%78 = tail call i32 @assert(i32 %77)
%79 = tail call i32 @test_strncasecmp(i8* %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 5, i32 -1)
%80 = tail call i32 @assert(i32 %79)
%81 = tail call i32 @free(i8* %24)
%82 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%83 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%84 = tail call i32 @strncpy(i8* %82, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32 20)
%85 = tail call i32 @strncpy(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 20)
%86 = getelementptr inbounds i8, i8* %82, i64 5
%87 = tail call i32 @strlen(i8* %83)
%88 = tail call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%89 = tail call i32 @test_memmove(i8* %86, i8* %83, i32 %87, i8* %82, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %88)
%90 = tail call i32 @assert(i32 %89)
%91 = tail call i32 @strncpy(i8* %82, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i32 20)
%92 = getelementptr inbounds i8, i8* %82, i64 1
%93 = tail call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%94 = tail call i32 @strlen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%95 = tail call i32 @test_memmove(i8* %82, i8* %92, i32 %93, i8* %82, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %94)
%96 = tail call i32 @assert(i32 %95)
%97 = tail call i32 @strncpy(i8* %82, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), i32 20)
%98 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%99 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%100 = tail call i32 @test_memmove(i8* %92, i8* %82, i32 %98, i8* %82, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %99)
%101 = tail call i32 @assert(i32 %100)
%102 = tail call i32 @free(i8* %82)
%103 = tail call i32 @free(i8* %83)
ret i32 0
}