#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*/ memchr(void *, int, unsigned long);
int /*<<< orphan*/ memcmp(void *, void *, unsigned long);
int /*<<< orphan*/ memcpy(void *, void *, unsigned long);
int /*<<< orphan*/ memmove(void *, void *, unsigned long);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ strcat(void *, void *);
int /*<<< orphan*/ strchr(void *, char);
int /*<<< orphan*/ strcmp(void *, void *);
int /*<<< orphan*/ strcpy(void *, void *);
int /*<<< orphan*/ strcspn(void *, void *);
int /*<<< orphan*/ strlen(void *);
int /*<<< orphan*/ strncat(void *, void *, unsigned long);
int /*<<< orphan*/ strncmp(void *, void *, unsigned long);
int /*<<< orphan*/ strncpy(void *, void *, unsigned long);
int /*<<< orphan*/ strpbrk(void *, void *);
int /*<<< orphan*/ strrchr(void *, char);
int /*<<< orphan*/ strspn(void *, void *);
int /*<<< orphan*/ strstr(void *, void *);
void string(void *p, void *q, long unsigned int sz) {
  memchr(p, 2, sz);
  memcmp(p, q, sz);
  memcpy(p, q, sz);
  memmove(p, q, sz);
  memset(p, 0, sz);
  strcat(p, q);
  strchr(p, 'a');
  strcmp(p, q);
  strcpy(p, q);
  strcspn(p, q);
  strlen(p);
  strncat(p, q, sz);
  strncmp(p, q, sz);
  strncpy(p, q, sz);
  strpbrk(p, q);
  strrchr(p, 'q');
  strspn(p, q);
  strstr(p, q);
}


x86 assembly (clang, -O0):
<string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x2,%esi
call   10d0 <memchr@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10e0 <memcmp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1100 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1120 <memmove@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1130 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    $0x61,%esi
call   1070 <strchr@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10f0 <strcmp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <strcspn@plt>
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10a0 <strncat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <strncmp@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1110 <strpbrk@plt>
mov    -0x8(%rbp),%rdi
mov    $0x71,%esi
call   1080 <strrchr@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10b0 <strspn@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1140 <strstr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2,%esi
call   10a0 <memchr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10b0 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   10d0 <memmove@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
mov    %rbx,%rdi
mov    $0x61,%esi
call   1060 <strchr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1090 <strncat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <strpbrk@plt>
mov    %rbx,%rdi
mov    $0x71,%esi
call   1070 <strrchr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    10f0 <strstr@plt>

LLVM IR (-O0):
define void @string(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %6
%9 = call i32 @memchr(i8* %7, i32 2, i64 %8)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = load i64, i64* %6
%13 = call i32 @memcmp(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %5
%16 = load i64, i64* %6
%17 = call i32 @memcpy(i8* %14, i8* %15, i64 %16)
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = call i32 @memmove(i8* %18, i8* %19, i64 %20)
%22 = load i8*, i8** %4
%23 = load i64, i64* %6
%24 = call i32 @memset(i8* %22, i32 0, i64 %23)
%25 = load i8*, i8** %4
%26 = load i8*, i8** %5
%27 = call i32 @strcat(i8* %25, i8* %26)
%28 = load i8*, i8** %4
%29 = call i32 @strchr(i8* %28, i8 signext 97)
%30 = load i8*, i8** %4
%31 = load i8*, i8** %5
%32 = call i32 @strcmp(i8* %30, i8* %31)
%33 = load i8*, i8** %4
%34 = load i8*, i8** %5
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = load i8*, i8** %4
%37 = load i8*, i8** %5
%38 = call i32 @strcspn(i8* %36, i8* %37)
%39 = load i8*, i8** %4
%40 = call i32 @strlen(i8* %39)
%41 = load i8*, i8** %4
%42 = load i8*, i8** %5
%43 = load i64, i64* %6
%44 = call i32 @strncat(i8* %41, i8* %42, i64 %43)
%45 = load i8*, i8** %4
%46 = load i8*, i8** %5
%47 = load i64, i64* %6
%48 = call i32 @strncmp(i8* %45, i8* %46, i64 %47)
%49 = load i8*, i8** %4
%50 = load i8*, i8** %5
%51 = load i64, i64* %6
%52 = call i32 @strncpy(i8* %49, i8* %50, i64 %51)
%53 = load i8*, i8** %4
%54 = load i8*, i8** %5
%55 = call i32 @strpbrk(i8* %53, i8* %54)
%56 = load i8*, i8** %4
%57 = call i32 @strrchr(i8* %56, i8 signext 113)
%58 = load i8*, i8** %4
%59 = load i8*, i8** %5
%60 = call i32 @strspn(i8* %58, i8* %59)
%61 = load i8*, i8** %4
%62 = load i8*, i8** %5
%63 = call i32 @strstr(i8* %61, i8* %62)
ret void
}

LLVM IR (-O2):
define void @string(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memchr(i8* %0, i32 2, i64 %2)
%5 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%6 = tail call i32 @memmove(i8* %0, i8* %1, i64 %2)
%7 = tail call i32 @memset(i8* %0, i32 0, i64 %2)
%8 = tail call i32 @strcat(i8* %0, i8* %1)
%9 = tail call i32 @strchr(i8* %0, i8 signext 97)
%10 = tail call i32 @strcpy(i8* %0, i8* %1)
%11 = tail call i32 @strlen(i8* %0)
%12 = tail call i32 @strncat(i8* %0, i8* %1, i64 %2)
%13 = tail call i32 @strncpy(i8* %0, i8* %1, i64 %2)
%14 = tail call i32 @strpbrk(i8* %0, i8* %1)
%15 = tail call i32 @strrchr(i8* %0, i8 signext 113)
%16 = tail call i32 @strstr(i8* %0, i8* %1)
ret void
}