#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 */
char *memchr1(char const *, char, int);
int memcmp1(char const *, char const *, int);
scalar_t__ memcpy1(char *, char *, int);
scalar_t__ memmove1(char *, char *, int);
scalar_t__ memset1(char *, char, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char *test = "This is only a test string ok";
  char result[] = "The original string was longer";
  printf("---- memcpy1 ----\n");
  printf("memcpy1( result, test, 19 ) = %s\n",
         (char *)memcpy1(result, test, 19));
  printf("result = %s\n", result);
  printf("\nmemcpy1( result+2, result, 6 ) = %s\n",
         (char *)memcpy1(result + 2, result, 6));
  printf("result = %s\n", result);
  printf("\n");
  char *test1 = "This is only a test string ok";
  char result1[] = "The original string was longer";
  printf("---- memmove1 ----\n");
  printf("memmove1( result, test, 19 ) = %s\n",
         (char *)memmove1(result1, test1, 19));
  printf("result = %s\n", result1);
  printf("\nmemmove1( result+2, result, 6 ) = %s\n",
         (char *)memmove1(result1 + 2, result1, 6));
  printf("result+2 = %s\n", result1 + 2);
  printf("result   = %s\n", result1);
  printf("\n");
  printf("---- memcmp1 tests ----\n");
  const char *a1 = "appletart";
  const char *b1 = "applepie";
  const char *c1 = "apply";
  int result2 = memcmp1(a1, b1, 5);
  if (result2 < 0)
    printf("5 characters of %s is less than %s\n", a1, b1);
  else if (result2 == 0)
    printf("5 characters of %s is equal to %s\n", a1, b1);
  else if (result2 > 0)
    printf("5 characters of %s is greater than %s\n", a1, b1);
  result2 = memcmp1(a1, c1, 5);
  if (result2 < 0)
    printf("5 characters of %s is less than %s\n", a1, c1);
  else if (result2 == 0)
    printf("5 characters of %s is equal to %s\n", a1, c1);
  else if (result2 > 0)
    printf("5 characters of %s is greater than %s\n", a1, c1);
  result2 = memcmp1(a1, b1, 6);
  if (result2 < 0)
    printf("6 characters of %s is less than %s\n", a1, b1);
  else if (result2 == 0)
    printf("6 characters of %s is equal to %s\n", a1, b1);
  else if (result2 > 0)
    printf("6 characters of %s is greater than %s\n", a1, b1);
  printf("\n");
  const char *test2 = "This is only a test string ok";
  printf("---- memchr1 ----\n");
  printf("memchr1(test2, 'o', 29) = %s\n", (char *)memchr1(test2, 'o', 29));
  char *result3 = memchr1(test2, '7', 29);
  if (result3 == NULL)
    printf("memchr1(test2, '7', 29) = NULL\n");
  else
    printf("memchr1(test2, '7', 29) != NULL\n");
  printf("\n");
  char test3[] = "This is only a test string ok";
  printf("---- memset1 ----\n");
  printf("memset1(test3, 'A', 12) = %s\n", (char *)memset1(test3, 'A', 12));
  printf("test3 = %s\n", test3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x113c(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x1139(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x1136(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x1134(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0x112e(%rip),%ax
mov    %ax,-0x14(%rbp)
mov    0x1126(%rip),%al
mov    %al,-0x12(%rbp)
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x13,%edx
call   1070 <memcpy1@plt>
mov    %rax,%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
add    $0x2,%rdi
lea    -0x30(%rbp),%rsi
mov    $0x6,%edx
call   1070 <memcpy1@plt>
mov    %rax,%rsi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x1069(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x1066(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0x1063(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x1061(%rip),%eax
mov    %eax,-0x48(%rbp)
mov    0x105b(%rip),%ax
mov    %ax,-0x44(%rbp)
mov    0x1053(%rip),%al
mov    %al,-0x42(%rbp)
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    $0x13,%edx
call   1050 <memmove1@plt>
mov    %rax,%rsi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xd89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
add    $0x2,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x6,%edx
call   1050 <memmove1@plt>
mov    %rax,%rsi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
add    $0x2,%rsi
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd8(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xdd7(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xdd5(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    $0x5,%edx
call   1040 <memcmp1@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    1397 <main+0x237>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13e6 <main+0x286>
cmpl   $0x0,-0x7c(%rbp)
jne    13bc <main+0x25c>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13e1 <main+0x281>
cmpl   $0x0,-0x7c(%rbp)
jle    13dc <main+0x27c>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13e1 <main+0x281>
jmp    13e6 <main+0x286>
mov    -0x68(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    $0x5,%edx
call   1040 <memcmp1@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    1420 <main+0x2c0>
mov    -0x68(%rbp),%rsi
mov    -0x78(%rbp),%rdx
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146f <main+0x30f>
cmpl   $0x0,-0x7c(%rbp)
jne    1445 <main+0x2e5>
mov    -0x68(%rbp),%rsi
mov    -0x78(%rbp),%rdx
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146a <main+0x30a>
cmpl   $0x0,-0x7c(%rbp)
jle    1465 <main+0x305>
mov    -0x68(%rbp),%rsi
mov    -0x78(%rbp),%rdx
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    146a <main+0x30a>
jmp    146f <main+0x30f>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    $0x6,%edx
call   1040 <memcmp1@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    14a9 <main+0x349>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14f8 <main+0x398>
cmpl   $0x0,-0x7c(%rbp)
jne    14ce <main+0x36e>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14f3 <main+0x393>
cmpl   $0x0,-0x7c(%rbp)
jle    14ee <main+0x38e>
mov    -0x68(%rbp),%rsi
mov    -0x70(%rbp),%rdx
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14f3 <main+0x393>
jmp    14f8 <main+0x398>
lea    0xb99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xaf3(%rip),%rax
mov    %rax,-0x88(%rbp)
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rdi
mov    $0x6f,%esi
mov    $0x1d,%edx
call   1060 <memchr1@plt>
mov    %rax,%rsi
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x88(%rbp),%rdi
mov    $0x37,%esi
mov    $0x1d,%edx
call   1060 <memchr1@plt>
mov    %rax,-0x90(%rbp)
cmpq   $0x0,-0x90(%rbp)
jne    1587 <main+0x427>
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1595 <main+0x435>
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xafc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xd36(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0xd30(%rip),%rax
mov    %rax,-0xa8(%rbp)
mov    0xd2a(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xd25(%rip),%eax
mov    %eax,-0x98(%rbp)
mov    0xd1c(%rip),%ax
mov    %ax,-0x94(%rbp)
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x41,%esi
mov    $0xc,%edx
call   1080 <memset1@plt>
mov    %rax,%rsi
lea    0xc80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rsi
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movups 0x111a(%rip),%xmm0
movups %xmm0,0x2f(%rsp)
movaps 0x10ff(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x104d(%rip),%rdi
call   1040 <puts@plt>
lea    0x1107(%rip),%rbp
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x13,%edx
call   1090 <memcpy1@plt>
lea    0xe2b(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe3c(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x22(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1090 <memcpy1@plt>
lea    0xe23(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movups 0x107b(%rip),%xmm0
movups %xmm0,0xf(%rsp)
movaps 0x1060(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xfc1(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x13,%edx
call   1070 <memmove1@plt>
lea    0xdeb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x2(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1070 <memmove1@plt>
lea    0xddb(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdf1(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdef(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf45(%rip),%rdi
call   1040 <puts@plt>
lea    0xdd7(%rip),%r12
lea    0xdda(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x5,%edx
call   1060 <memcmp1@plt>
test   %eax,%eax
lea    0xdf4(%rip),%rbp
lea    0xe10(%rip),%rbx
mov    %rbx,%rdi
cmove  %rbp,%rdi
lea    0xdbb(%rip),%r14
cmovs  %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd9d(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rsi
mov    $0x5,%edx
call   1060 <memcmp1@plt>
test   %eax,%eax
cmove  %rbp,%rbx
cmovs  %r14,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1060 <memcmp1@plt>
test   %eax,%eax
lea    0xdf2(%rip),%rax
lea    0xe0e(%rip),%rcx
cmove  %rax,%rcx
lea    0xdbc(%rip),%rdi
cmovns %rcx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0a(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6f,%esi
mov    $0x1d,%edx
call   1080 <memchr1@plt>
lea    0xde3(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x37,%esi
mov    $0x1d,%edx
call   1080 <memchr1@plt>
test   %rax,%rax
lea    0xe86(%rip),%rax
lea    0xe4d(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movups 0xeb8(%rip),%xmm0
movups %xmm0,0x4e(%rsp)
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xe3b(%rip),%rdi
call   1040 <puts@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x41,%esi
mov    $0xc,%edx
call   10a0 <memset1@plt>
lea    0xd7f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd8c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"This is only a test string ok\00"
@__const.main.result = [31 x i8] c"The original string was longer\00"
@.str.1 = [19 x i8] c"---- memcpy1 ----\0A\00"
@.str.2 = [34 x i8] c"memcpy1( result, test, 19 ) = %s\0A\00"
@.str.3 = [13 x i8] c"result = %s\0A\00"
@.str.4 = [38 x i8] c"\0Amemcpy1( result+2, result, 6 ) = %s\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
@__const.main.result1 = [31 x i8] c"The original string was longer\00"
@.str.6 = [20 x i8] c"---- memmove1 ----\0A\00"
@.str.7 = [35 x i8] c"memmove1( result, test, 19 ) = %s\0A\00"
@.str.8 = [39 x i8] c"\0Amemmove1( result+2, result, 6 ) = %s\0A\00"
@.str.9 = [15 x i8] c"result+2 = %s\0A\00"
@.str.10 = [15 x i8] c"result = %s\0A\00"
@.str.11 = [25 x i8] c"---- memcmp1 tests ----\0A\00"
@.str.12 = [10 x i8] c"appletart\00"
@.str.13 = [9 x i8] c"applepie\00"
@.str.14 = [6 x i8] c"apply\00"
@.str.15 = [36 x i8] c"5 characters of %s is less than %s\0A\00"
@.str.16 = [35 x i8] c"5 characters of %s is equal to %s\0A\00"
@.str.17 = [39 x i8] c"5 characters of %s is greater than %s\0A\00"
@.str.18 = [36 x i8] c"6 characters of %s is less than %s\0A\00"
@.str.19 = [35 x i8] c"6 characters of %s is equal to %s\0A\00"
@.str.20 = [39 x i8] c"6 characters of %s is greater than %s\0A\00"
@.str.21 = [19 x i8] c"---- memchr1 ----\0A\00"
@.str.22 = [30 x i8] c"memchr1(test2, 'o', 29) = %s\0A\00"
@.str.23 = [32 x i8] c"memchr1(test2, '7', 29) = NULL\0A\00"
@.str.24 = [33 x i8] c"memchr1(test2, '7', 29) != NULL\0A\00"
@__const.main.test3 = [30 x i8] c"This is only a test string ok\00"
@.str.25 = [19 x i8] c"---- memset1 ----\0A\00"
@.str.26 = [30 x i8] c"memset1(test3, 'A', 12) = %s\0A\00"
@.str.27 = [12 x i8] c"test3 = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [31 x i8]
%4 = alloca i8*
%5 = alloca [31 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [30 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %2
%13 = bitcast [31 x i8]* %3 to i8*
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%16 = load i8*, i8** %2
%17 = call i64 @memcpy1(i8* %15, i8* %16, i32 19)
%18 = inttoptr i64 %17 to i8*
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%23 = getelementptr inbounds i8, i8* %22, i64 2
%24 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%25 = call i64 @memcpy1(i8* %23, i8* %24, i32 6)
%26 = inttoptr i64 %25 to i8*
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [31 x i8], [31 x i8]* %3, i64 0, i64 0
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %4
%31 = bitcast [31 x i8]* %5 to i8*
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%33 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%34 = load i8*, i8** %4
%35 = call i64 @memmove1(i8* %33, i8* %34, i32 19)
%36 = inttoptr i64 %35 to i8*
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%41 = getelementptr inbounds i8, i8* %40, i64 2
%42 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%43 = call i64 @memmove1(i8* %41, i8* %42, i32 6)
%44 = inttoptr i64 %43 to i8*
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %44)
%46 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%47 = getelementptr inbounds i8, i8* %46, i64 2
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %47)
%49 = getelementptr inbounds [31 x i8], [31 x i8]* %5, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8** %8
%53 = load i8*, i8** %6
%54 = load i8*, i8** %7
%55 = call i32 @memcmp1(i8* %53, i8* %54, i32 5)
store i32 %55, i32* %9
%56 = load i32, i32* %9
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %0
%59 = load i8*, i8** %6
%60 = load i8*, i8** %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %59, i8* %60)
br label %78
62: ; preds = %0
%63 = load i32, i32* %9
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i8*, i8** %6
%67 = load i8*, i8** %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* %66, i8* %67)
br label %77
69: ; preds = %62
%70 = load i32, i32* %9
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = load i8*, i8** %6
%74 = load i8*, i8** %7
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i8* %73, i8* %74)
br label %76
76: ; preds = %72, %69
br label %77
77: ; preds = %76, %65
br label %78
78: ; preds = %77, %58
%79 = load i8*, i8** %6
%80 = load i8*, i8** %8
%81 = call i32 @memcmp1(i8* %79, i8* %80, i32 5)
store i32 %81, i32* %9
%82 = load i32, i32* %9
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %78
%85 = load i8*, i8** %6
%86 = load i8*, i8** %8
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %85, i8* %86)
br label %104
88: ; preds = %78
%89 = load i32, i32* %9
%90 = icmp eq i32 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %88
%92 = load i8*, i8** %6
%93 = load i8*, i8** %8
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* %92, i8* %93)
br label %103
95: ; preds = %88
%96 = load i32, i32* %9
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = load i8*, i8** %6
%100 = load i8*, i8** %8
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0), i8* %99, i8* %100)
br label %102
102: ; preds = %98, %95
br label %103
103: ; preds = %102, %91
br label %104
104: ; preds = %103, %84
%105 = load i8*, i8** %6
%106 = load i8*, i8** %7
%107 = call i32 @memcmp1(i8* %105, i8* %106, i32 6)
store i32 %107, i32* %9
%108 = load i32, i32* %9
%109 = icmp slt i32 %108, 0
br i1 %109, label %110, label %114
110: ; preds = %104
%111 = load i8*, i8** %6
%112 = load i8*, i8** %7
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0), i8* %111, i8* %112)
br label %130
114: ; preds = %104
%115 = load i32, i32* %9
%116 = icmp eq i32 %115, 0
br i1 %116, label %117, label %121
117: ; preds = %114
%118 = load i8*, i8** %6
%119 = load i8*, i8** %7
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i8* %118, i8* %119)
br label %129
121: ; preds = %114
%122 = load i32, i32* %9
%123 = icmp sgt i32 %122, 0
br i1 %123, label %124, label %128
124: ; preds = %121
%125 = load i8*, i8** %6
%126 = load i8*, i8** %7
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.20, i64 0, i64 0), i8* %125, i8* %126)
br label %128
128: ; preds = %124, %121
br label %129
129: ; preds = %128, %117
br label %130
130: ; preds = %129, %110
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %10
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.21, i64 0, i64 0))
%133 = load i8*, i8** %10
%134 = call i8* @memchr1(i8* %133, i8 signext 111, i32 29)
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.22, i64 0, i64 0), i8* %134)
%136 = load i8*, i8** %10
%137 = call i8* @memchr1(i8* %136, i8 signext 55, i32 29)
store i8* %137, i8** %11
%138 = load i8*, i8** %11
%139 = icmp eq i8* %138, null
br i1 %139, label %140, label %142
140: ; preds = %130
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.23, i64 0, i64 0))
br label %144
142: ; preds = %130
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.24, i64 0, i64 0))
br label %144
144: ; preds = %142, %140
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%146 = bitcast [30 x i8]* %12 to i8*
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.25, i64 0, i64 0))
%148 = getelementptr inbounds [30 x i8], [30 x i8]* %12, i64 0, i64 0
%149 = call i64 @memset1(i8* %148, i8 signext 65, i32 12)
%150 = inttoptr i64 %149 to i8*
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.26, i64 0, i64 0), i8* %150)
%152 = getelementptr inbounds [30 x i8], [30 x i8]* %12, i64 0, i64 0
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.27, i64 0, i64 0), i8* %152)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [34 x i8] c"memcpy1( result, test, 19 ) = %s\0A\00"
@.str.3 = [13 x i8] c"result = %s\0A\00"
@.str.4 = [38 x i8] c"\0Amemcpy1( result+2, result, 6 ) = %s\0A\00"
@__const.main.result1 = [31 x i8] c"The original string was longer\00"
@.str.7 = [35 x i8] c"memmove1( result, test, 19 ) = %s\0A\00"
@.str.8 = [39 x i8] c"\0Amemmove1( result+2, result, 6 ) = %s\0A\00"
@.str.9 = [15 x i8] c"result+2 = %s\0A\00"
@.str.10 = [15 x i8] c"result = %s\0A\00"
@.str.12 = [10 x i8] c"appletart\00"
@.str.13 = [9 x i8] c"applepie\00"
@.str.14 = [6 x i8] c"apply\00"
@.str.15 = [36 x i8] c"5 characters of %s is less than %s\0A\00"
@.str.16 = [35 x i8] c"5 characters of %s is equal to %s\0A\00"
@.str.17 = [39 x i8] c"5 characters of %s is greater than %s\0A\00"
@.str.18 = [36 x i8] c"6 characters of %s is less than %s\0A\00"
@.str.19 = [35 x i8] c"6 characters of %s is equal to %s\0A\00"
@.str.20 = [39 x i8] c"6 characters of %s is greater than %s\0A\00"
@.str.22 = [30 x i8] c"memchr1(test2, 'o', 29) = %s\0A\00"
@__const.main.test3 = [30 x i8] c"This is only a test string ok\00"
@.str.26 = [30 x i8] c"memset1(test3, 'A', 12) = %s\0A\00"
@.str.27 = [12 x i8] c"test3 = %s\0A\00"
@str = [18 x i8] c"---- memcpy1 ----\00"
@str.28 = [19 x i8] c"---- memmove1 ----\00"
@str.29 = [24 x i8] c"---- memcmp1 tests ----\00"
@str.30 = [18 x i8] c"---- memchr1 ----\00"
@str.31 = [32 x i8] c"memchr1(test2, '7', 29) != NULL\00"
@str.32 = [18 x i8] c"---- memset1 ----\00"
@str.33 = [31 x i8] c"memchr1(test2, '7', 29) = NULL\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca [31 x i8]
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = call i64 @memcpy1(i8* %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__const.main.test3, i64 0, i64 0), i32 19)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%10 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 2
%11 = call i64 @memcpy1(i8* %10, i8* %4, i32 6)
%12 = inttoptr i64 %11 to i8*
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%15 = call i32 @putchar(i32 10)
%16 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.28, i64 0, i64 0))
%18 = call i64 @memmove1(i8* %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__const.main.test3, i64 0, i64 0), i32 19)
%19 = inttoptr i64 %18 to i8*
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%22 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 2
%23 = call i64 @memmove1(i8* %22, i8* %16, i32 6)
%24 = inttoptr i64 %23 to i8*
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0), i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %22)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), i8* %16)
%28 = call i32 @putchar(i32 10)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.29, i64 0, i64 0))
%30 = call i32 @memcmp1(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 5)
%31 = icmp slt i32 %30, 0
%32 = icmp eq i32 %30, 0
%33 = select i1 %32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0)
%34 = select i1 %31, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%36 = call i32 @memcmp1(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32 5)
%37 = icmp slt i32 %36, 0
%38 = icmp eq i32 %36, 0
%39 = select i1 %38, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.17, i64 0, i64 0)
%40 = select i1 %37, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0), i8* %39
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %40, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%42 = call i32 @memcmp1(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0), i32 6)
%43 = icmp slt i32 %42, 0
%44 = icmp eq i32 %42, 0
%45 = select i1 %44, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.20, i64 0, i64 0)
%46 = select i1 %43, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0), i8* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%48 = call i32 @putchar(i32 10)
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.30, i64 0, i64 0))
%50 = call i8* @memchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__const.main.test3, i64 0, i64 0), i8 signext 111, i32 29)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.22, i64 0, i64 0), i8* %50)
%52 = call i8* @memchr1(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @__const.main.test3, i64 0, i64 0), i8 signext 55, i32 29)
%53 = icmp eq i8* %52, null
%54 = select i1 %53, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str.33, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.31, i64 0, i64 0)
%55 = call i32 @puts(i8* dereferenceable(1) %54)
%56 = call i32 @putchar(i32 10)
%57 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.32, i64 0, i64 0))
%59 = call i64 @memset1(i8* %57, i8 signext 65, i32 12)
%60 = inttoptr i64 %59 to i8*
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.26, i64 0, i64 0), i8* %60)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.27, i64 0, i64 0), i8* %57)
ret i32 0
}