#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*/ fail(char *);
char *memchr(char *, char, int);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ pr(char *);
void test_memfn(void) {
  char *c1, *c2, *p;
  char v1[128];
  int i;
  pr("memcmp");
  c1 = "test01";
  c2 = "test03";
  if (memcmp(c1, c2, 5))
    fail("memcmp-1");
  if (!memcmp(c1, c2, 6))
    fail("memcmp-2");
  if (memcmp(c1, c2, 6) >= 0)
    fail("memcmp-3");
  if (memcmp(c2, c1, 6) <= 0)
    fail("memcmp-4");
  pr("memcpy");
  c1 = "abcdefghijklmnopqrstuvwxyz0123456789";
  memcpy(v1, c1, 36);
  if (memcmp(c1, v1, 36))
    fail("memcpy-1");
  memcpy(v1 + 18, v1, 36);
  if (memcmp(c1, v1 + 18, 18))
    fail("memcpy-2");
  memcpy(v1, v1 + 18, 36);
  if (memcmp(c1, v1, 18))
    fail("memcpy-3");
  pr("memmove");
  memcpy(v1, c1, 36);
  memmove(v1 + 1, v1, 35);
  if (memcmp(v1 + 1, c1, 35) || *v1 != 'a')
    fail("memmove-1");
  memcpy(v1, c1, 36);
  memmove(v1, v1 + 1, 35);
  if (memcmp(v1, c1 + 1, 35) || v1[35] != '9')
    fail("memmove-2");
  pr("memset");
  for (i = 0; i < 128; i++)
    v1[i] = -1;
  memset(v1, 0, 64);
  if (v1[63])
    fail("memset-1");
  if (!v1[64])
    fail("memset-2");
  for (i = 0; i < 128; i++)
    v1[i] = -1;
  memset(v1, 123, 64);
  if (v1[63] != 123)
    fail("memset-3");
  if (v1[64] == 123)
    fail("memset-4");
  pr("memchr");
  c1 = "...............X1";
  p = memchr(c1, 'X', 16);
  if (!p || *p != 'X' || p[1] != '1')
    fail("memchr-1");
  if (memchr(c1, 'X', 15) != NULL)
    fail("memchr-2");
}


x86 assembly (clang, -O0):
<test_memfn>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    0xe7e(%rip),%rdi
call   1040 <pr@plt>
lea    0xe79(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe75(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x5,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     11c5 <test_memfn+0x55>
lea    0xe55(%rip),%rdi
call   1030 <fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    11ed <test_memfn+0x7d>
lea    0xe36(%rip),%rdi
call   1030 <fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jl     1215 <test_memfn+0xa5>
lea    0xe17(%rip),%rdi
call   1030 <fail@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jg     123d <test_memfn+0xcd>
lea    0xdf8(%rip),%rdi
call   1030 <fail@plt>
lea    0xdf5(%rip),%rdi
call   1040 <pr@plt>
lea    0xdf0(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x24,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     1294 <test_memfn+0x124>
lea    0xdd6(%rip),%rdi
call   1030 <fail@plt>
lea    -0xa0(%rbp),%rdi
add    $0x12,%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
add    $0x12,%rsi
mov    $0x12,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     12df <test_memfn+0x16f>
lea    0xd94(%rip),%rdi
call   1030 <fail@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
add    $0x12,%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x12,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
je     1326 <test_memfn+0x1b6>
lea    0xd56(%rip),%rdi
call   1030 <fail@plt>
lea    0xd53(%rip),%rdi
call   1040 <pr@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
add    $0x1,%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x23,%edx
call   1090 <memmove@plt>
lea    -0xa0(%rbp),%rdi
add    $0x1,%rdi
mov    -0x8(%rbp),%rsi
mov    $0x23,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    1396 <test_memfn+0x226>
movsbl -0xa0(%rbp),%eax
cmp    $0x61,%eax
je     13a2 <test_memfn+0x232>
lea    0xceb(%rip),%rdi
call   1030 <fail@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
add    $0x1,%rsi
mov    $0x23,%edx
call   1090 <memmove@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    $0x23,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
jne    1403 <test_memfn+0x293>
movsbl -0x7d(%rbp),%eax
cmp    $0x39,%eax
je     140f <test_memfn+0x29f>
lea    0xc88(%rip),%rdi
call   1030 <fail@plt>
lea    0xc86(%rip),%rdi
call   1040 <pr@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x80,-0xa4(%rbp)
jge    1458 <test_memfn+0x2e8>
movslq -0xa4(%rbp),%rax
movb   $0xff,-0xa0(%rbp,%rax,1)
ff
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    1425 <test_memfn+0x2b5>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
cmpb   $0x0,-0x61(%rbp)
je     1481 <test_memfn+0x311>
lea    0xc27(%rip),%rdi
call   1030 <fail@plt>
cmpb   $0x0,-0x60(%rbp)
jne    1497 <test_memfn+0x327>
lea    0xc1a(%rip),%rdi
call   1030 <fail@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x80,-0xa4(%rbp)
jge    14d4 <test_memfn+0x364>
movslq -0xa4(%rbp),%rax
movb   $0xff,-0xa0(%rbp,%rax,1)
ff
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    14a1 <test_memfn+0x331>
lea    -0xa0(%rbp),%rdi
mov    $0x7b,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
movsbl -0x61(%rbp),%eax
cmp    $0x7b,%eax
je     1503 <test_memfn+0x393>
lea    0xbb7(%rip),%rdi
call   1030 <fail@plt>
movsbl -0x60(%rbp),%eax
cmp    $0x7b,%eax
jne    151c <test_memfn+0x3ac>
lea    0xba7(%rip),%rdi
call   1030 <fail@plt>
lea    0xba4(%rip),%rdi
call   1040 <pr@plt>
lea    0xb9f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x58,%esi
mov    $0x10,%edx
call   1060 <memchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1576 <test_memfn+0x406>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x58,%eax
jne    1576 <test_memfn+0x406>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x31,%eax
je     1582 <test_memfn+0x412>
lea    0xb63(%rip),%rdi
call   1030 <fail@plt>
mov    -0x8(%rbp),%rdi
mov    $0x58,%esi
mov    $0xf,%edx
call   1060 <memchr@plt>
cmp    $0x0,%rax
je     15ab <test_memfn+0x43b>
lea    0xb43(%rip),%rdi
call   1030 <fail@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memfn>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xe7d(%rip),%rdi
call   1040 <pr@plt>
lea    0xe78(%rip),%rdi
lea    0xe78(%rip),%rsi
mov    $0x5,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
je     11b1 <test_memfn+0x41>
lea    0xe69(%rip),%rdi
call   1030 <fail@plt>
lea    0xe4f(%rip),%rdi
lea    0xe4f(%rip),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
jne    11da <test_memfn+0x6a>
lea    0xe49(%rip),%rdi
call   1030 <fail@plt>
lea    0xe26(%rip),%rdi
lea    0xe26(%rip),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
js     1203 <test_memfn+0x93>
lea    0xe29(%rip),%rdi
call   1030 <fail@plt>
lea    0xe04(%rip),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x6,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
jg     122c <test_memfn+0xbc>
lea    0xe09(%rip),%rdi
call   1030 <fail@plt>
lea    0xe06(%rip),%rdi
call   1040 <pr@plt>
lea    0xe01(%rip),%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x24,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
je     1273 <test_memfn+0x103>
lea    0xdf7(%rip),%rdi
call   1030 <fail@plt>
lea    0x12(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x24,%edx
call   1080 <memcpy@plt>
lea    0xdb1(%rip),%rdi
mov    %r14,%rsi
mov    $0x12,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
je     12ad <test_memfn+0x13d>
lea    0xdc6(%rip),%rdi
call   1030 <fail@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
lea    0xd79(%rip),%rdi
mov    %rbx,%rsi
mov    $0x12,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
je     12e5 <test_memfn+0x175>
lea    0xd97(%rip),%rdi
call   1030 <fail@plt>
lea    0xd94(%rip),%rdi
call   1040 <pr@plt>
lea    0xd48(%rip),%r15
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x24,%edx
call   1080 <memcpy@plt>
lea    0x1(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x23,%edx
call   1090 <memmove@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x23,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
jne    133b <test_memfn+0x1cb>
cmpb   $0x61,(%rsp)
je     1347 <test_memfn+0x1d7>
lea    0xd46(%rip),%rdi
call   1030 <fail@plt>
lea    0xcf2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x24,%edx
call   1080 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x23,%edx
call   1090 <memmove@plt>
lea    0xccc(%rip),%rsi
mov    %rbx,%rdi
mov    $0x23,%edx
call   1070 <memcmp@plt>
test   %rax,%rax
jne    138e <test_memfn+0x21e>
cmpb   $0x39,0x23(%rsp)
je     139a <test_memfn+0x22a>
lea    0xcfd(%rip),%rdi
call   1030 <fail@plt>
lea    0xcfb(%rip),%rdi
call   1040 <pr@plt>
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,(%rsp)
movdqa %xmm0,0x10(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x70(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
cmpb   $0x0,0x3f(%rsp)
je     13fb <test_memfn+0x28b>
lea    0xcad(%rip),%rdi
call   1030 <fail@plt>
cmpb   $0x0,0x40(%rsp)
jne    140e <test_memfn+0x29e>
lea    0xca3(%rip),%rdi
call   1030 <fail@plt>
pcmpeqd %xmm0,%xmm0
movdqa %xmm0,0x70(%rsp)
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x10(%rsp)
movdqa %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7b,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
cmpb   $0x7b,0x3f(%rsp)
je     1466 <test_memfn+0x2f6>
lea    0xc54(%rip),%rdi
call   1030 <fail@plt>
cmpb   $0x7b,0x40(%rsp)
jne    1479 <test_memfn+0x309>
lea    0xc4a(%rip),%rdi
call   1030 <fail@plt>
lea    0xc47(%rip),%rdi
call   1040 <pr@plt>
lea    0xc42(%rip),%rdi
mov    $0x58,%esi
mov    $0x10,%edx
call   1060 <memchr@plt>
test   %rax,%rax
je     14ab <test_memfn+0x33b>
cmpb   $0x58,(%rax)
jne    14ab <test_memfn+0x33b>
cmpb   $0x31,0x1(%rax)
je     14b7 <test_memfn+0x347>
lea    0xc2e(%rip),%rdi
call   1030 <fail@plt>
lea    0xc10(%rip),%rdi
mov    $0x58,%esi
mov    $0xf,%edx
call   1060 <memchr@plt>
test   %rax,%rax
je     14de <test_memfn+0x36e>
lea    0xc10(%rip),%rdi
call   1030 <fail@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"memcmp\00"
@.str.1 = [7 x i8] c"test01\00"
@.str.2 = [7 x i8] c"test03\00"
@.str.3 = [9 x i8] c"memcmp-1\00"
@.str.4 = [9 x i8] c"memcmp-2\00"
@.str.5 = [9 x i8] c"memcmp-3\00"
@.str.6 = [9 x i8] c"memcmp-4\00"
@.str.7 = [7 x i8] c"memcpy\00"
@.str.8 = [37 x i8] c"abcdefghijklmnopqrstuvwxyz0123456789\00"
@.str.9 = [9 x i8] c"memcpy-1\00"
@.str.10 = [9 x i8] c"memcpy-2\00"
@.str.11 = [9 x i8] c"memcpy-3\00"
@.str.12 = [8 x i8] c"memmove\00"
@.str.13 = [10 x i8] c"memmove-1\00"
@.str.14 = [10 x i8] c"memmove-2\00"
@.str.15 = [7 x i8] c"memset\00"
@.str.16 = [9 x i8] c"memset-1\00"
@.str.17 = [9 x i8] c"memset-2\00"
@.str.18 = [9 x i8] c"memset-3\00"
@.str.19 = [9 x i8] c"memset-4\00"
@.str.20 = [7 x i8] c"memchr\00"
@.str.21 = [18 x i8] c"...............X1\00"
@.str.22 = [9 x i8] c"memchr-1\00"
@.str.23 = [9 x i8] c"memchr-2\00"
define void @test_memfn() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 5)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = tail call i64 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = tail call i64 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%16 = icmp sgt i64 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = tail call i64 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%21 = icmp slt i64 %20, 1
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = tail call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = tail call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 36)
%27 = call i64 @memcmp(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i8* %3, i32 36)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24
%30 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %31
31: ; preds = %29, %24
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 18
%33 = call i32 @memcpy(i8* %32, i8* %3, i32 36)
%34 = call i64 @memcmp(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i8* %32, i32 18)
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %31
%37 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
%39 = call i32 @memcpy(i8* %3, i8* %32, i32 36)
%40 = call i64 @memcmp(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i8* %3, i32 18)
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = call i32 @pr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%46 = call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 36)
%47 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 1
%48 = call i32 @memmove(i8* %47, i8* %3, i32 35)
%49 = call i64 @memcmp(i8* %47, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 35)
%50 = icmp ne i64 %49, 0
%51 = load i8, i8* %3
%52 = icmp ne i8 %51, 97
%53 = select i1 %50, i1 true, i1 %52
br i1 %53, label %54, label %56
54: ; preds = %44
%55 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.13, i64 0, i64 0))
br label %56
56: ; preds = %44, %54
%57 = call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 0), i32 36)
%58 = call i32 @memmove(i8* %3, i8* %47, i32 35)
%59 = call i64 @memcmp(i8* %3, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.8, i64 0, i64 1), i32 35)
%60 = icmp ne i64 %59, 0
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 35
%62 = load i8, i8* %61
%63 = icmp ne i8 %62, 57
%64 = select i1 %60, i1 true, i1 %63
br i1 %64, label %65, label %67
65: ; preds = %56
%66 = call i32 @fail(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0))
br label %67
67: ; preds = %56, %65
%68 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%69 = call i32 @memset(i8* %3, i32 0, i32 64)
%70 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 63
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 0
br i1 %72, label %75, label %73
73: ; preds = %67
%74 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0))
br label %75
75: ; preds = %73, %67
%76 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 64
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %75
%80 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.17, i64 0, i64 0))
br label %81
81: ; preds = %79, %75
%82 = call i32 @memset(i8* %3, i32 123, i32 64)
%83 = load i8, i8* %70
%84 = icmp eq i8 %83, 123
br i1 %84, label %87, label %85
85: ; preds = %81
%86 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.18, i64 0, i64 0))
br label %87
87: ; preds = %85, %81
%88 = load i8, i8* %76
%89 = icmp eq i8 %88, 123
br i1 %89, label %90, label %92
90: ; preds = %87
%91 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0))
br label %92
92: ; preds = %90, %87
%93 = call i32 @pr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
%94 = call i8* @memchr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8 signext 88, i32 16)
%95 = icmp eq i8* %94, null
br i1 %95, label %103, label %96
96: ; preds = %92
%97 = load i8, i8* %94
%98 = icmp eq i8 %97, 88
br i1 %98, label %99, label %103
99: ; preds = %96
%100 = getelementptr inbounds i8, i8* %94, i64 1
%101 = load i8, i8* %100
%102 = icmp eq i8 %101, 49
br i1 %102, label %105, label %103
103: ; preds = %99, %96, %92
%104 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.22, i64 0, i64 0))
br label %105
105: ; preds = %103, %99
%106 = call i8* @memchr(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8 signext 88, i32 15)
%107 = icmp eq i8* %106, null
br i1 %107, label %110, label %108
108: ; preds = %105
%109 = call i32 @fail(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i64 0, i64 0))
br label %110
110: ; preds = %108, %105
ret void
}