#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 */
typedef int /*<<< orphan*/ test_src;
typedef int /*<<< orphan*/ test_dst;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int my_memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  int i;
  int real_size;
  char test_src[12];
  memset(test_src, 0, sizeof(test_src));
  strcpy(test_src, "1234567890");
  real_size = sizeof(test_src) - 2;
  char test_dst[12];
  memset(test_dst, 0, sizeof(test_dst));
  printf("目标地址为空\n");
  if (-1 == my_memcpy(NULL, test_src, real_size)) {
    printf("Error:目标地址为空！\n");
  }
  printf("源地址为空\n");
  if (-1 == my_memcpy(test_dst, NULL, real_size)) {
    printf("Error:源地址为空！\n");
  }
  printf("复制长度为空\n");
  if (-1 == my_memcpy(test_dst, test_src, 0)) {
    printf("Error:复制长度为0！\n");
  }
  my_memcpy(test_src, test_src, real_size);
  printf("源地址与目标地址相同，输出目标：\n");
  for (i = 0; i < real_size; ++i) {
    printf("%c ", *(test_src + i));
  }
  printf("\n");
  my_memcpy(test_src + 1, test_src, real_size);
  printf("目标地址大于源地址，输出目标：\n");
  for (i = 0; i < real_size; ++i) {
    printf("%c ", *(test_src + i + 1));
  }
  printf("\n");
  strcpy(test_src, "1234567890");
  memset(test_dst, 0, sizeof(test_dst));
  printf("目标地址小于源地址，输出目标：\n");
  my_memcpy(test_src - 1, test_src, real_size);
  for (i = 0; i < real_size; ++i) {
    printf("%c ", *(test_src + i - 1));
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x24(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    -0x24(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0xa,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%edx
xor    %eax,%eax
mov    %eax,%edi
call   1060 <my_memcpy@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    11c8 <main+0x88>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <my_memcpy@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1203 <main+0xc3>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    -0x24(%rbp),%rsi
xor    %edx,%edx
call   1060 <my_memcpy@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    123d <main+0xfd>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rdi
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <my_memcpy@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1293 <main+0x153>
movslq -0x14(%rbp),%rax
movsbl -0x24(%rbp,%rax,1),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1262 <main+0x122>
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rdi
add    $0x1,%rdi
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <my_memcpy@plt>
lea    0xe10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    12fb <main+0x1bb>
movslq -0x14(%rbp),%rax
movsbl -0x23(%rbp,%rax,1),%esi
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ca <main+0x18a>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rdi
lea    0xcec(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
lea    0xdcb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <my_memcpy@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1383 <main+0x243>
movslq -0x14(%rbp),%rax
movsbl -0x25(%rbp,%rax,1),%esi
lea    0xd5a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1352 <main+0x212>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0x14(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
lea    0xe6b(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1080 <my_memcpy@plt>
cmp    $0xffffffff,%eax
jne    11c9 <main+0x69>
lea    0xf41(%rip),%rdi
call   1050 <puts@plt>
lea    0xe52(%rip),%rdi
call   1050 <puts@plt>
lea    0x14(%rsp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <my_memcpy@plt>
cmp    $0xffffffff,%eax
jne    11f7 <main+0x97>
lea    0xefa(%rip),%rdi
call   1050 <puts@plt>
lea    0xe34(%rip),%rdi
call   1050 <puts@plt>
lea    0x14(%rsp),%rdi
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1080 <my_memcpy@plt>
cmp    $0xffffffff,%eax
jne    1225 <main+0xc5>
lea    0xeb2(%rip),%rdi
call   1050 <puts@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1080 <my_memcpy@plt>
lea    0xe04(%rip),%rdi
call   1050 <puts@plt>
movsbl 0x8(%rsp),%esi
lea    0xdb9(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x9(%rsp),%r15
movsbl 0x9(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xa(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xd(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xe(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x11(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1080 <my_memcpy@plt>
lea    0xd6d(%rip),%rdi
call   1050 <puts@plt>
movsbl 0x9(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xa(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xd(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xe(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x11(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x12(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc4b(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0x14(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
lea    0xccf(%rip),%rdi
call   1050 <puts@plt>
lea    0x7(%rsp),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1080 <my_memcpy@plt>
movsbl 0x7(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x9(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xa(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xd(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xe(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl 0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"1234567890\00"
@.str.1 = [20 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\0A\00"
@.str.2 = [29 x i8] c"Error:\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\EF\BC\81\0A\00"
@.str.3 = [17 x i8] c"\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\0A\00"
@.str.4 = [26 x i8] c"Error:\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\EF\BC\81\0A\00"
@.str.5 = [20 x i8] c"\E5\A4\8D\E5\88\B6\E9\95\BF\E5\BA\A6\E4\B8\BA\E7\A9\BA\0A\00"
@.str.6 = [27 x i8] c"Error:\E5\A4\8D\E5\88\B6\E9\95\BF\E5\BA\A6\E4\B8\BA0\EF\BC\81\0A\00"
@.str.7 = [50 x i8] c"\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\8E\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E7\9B\B8\E5\90\8C\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\0A\00"
@.str.8 = [4 x i8] c"%c \00"
@.str.9 = [2 x i8] c"\0A\00"
@.str.10 = [47 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E5\A4\A7\E4\BA\8E\E6\BA\90\E5\9C\B0\E5\9D\80\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\0A\00"
@.str.11 = [47 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E5\B0\8F\E4\BA\8E\E6\BA\90\E5\9C\B0\E5\9D\80\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [12 x i8]
%9 = alloca [12 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%11 = call i32 @memset(i8* %10, i32 0, i32 12)
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %7
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%15 = call i32 @memset(i8* %14, i32 0, i32 12)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%18 = load i32, i32* %7
%19 = call i32 @my_memcpy(i8* null, i8* %17, i32 %18)
%20 = icmp eq i32 -1, %19
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%25 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%26 = load i32, i32* %7
%27 = call i32 @my_memcpy(i8* %25, i8* null, i32 %26)
%28 = icmp eq i32 -1, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%34 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%35 = call i32 @my_memcpy(i8* %33, i8* %34, i32 0)
%36 = icmp eq i32 -1, %35
br i1 %36, label %37, label %39
37: ; preds = %31
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %37, %31
%40 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%41 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%42 = load i32, i32* %7
%43 = call i32 @my_memcpy(i8* %40, i8* %41, i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %6
br label %45
45: ; preds = %57, %39
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %60
49: ; preds = %45
%50 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %49
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
br label %45
60: ; preds = %45
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%62 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%65 = load i32, i32* %7
%66 = call i32 @my_memcpy(i8* %63, i8* %64, i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %6
br label %68
68: ; preds = %81, %60
%69 = load i32, i32* %6
%70 = load i32, i32* %7
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %84
72: ; preds = %68
%73 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %72
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %68
84: ; preds = %68
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%86 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%87 = call i32 @strcpy(i8* %86, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%88 = getelementptr inbounds [12 x i8], [12 x i8]* %9, i64 0, i64 0
%89 = call i32 @memset(i8* %88, i32 0, i32 12)
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
%91 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%92 = getelementptr inbounds i8, i8* %91, i64 -1
%93 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%94 = load i32, i32* %7
%95 = call i32 @my_memcpy(i8* %92, i8* %93, i32 %94)
store i32 0, i32* %6
br label %96
96: ; preds = %109, %84
%97 = load i32, i32* %6
%98 = load i32, i32* %7
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %112
100: ; preds = %96
%101 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%102 = load i32, i32* %6
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %101, i64 %103
%105 = getelementptr inbounds i8, i8* %104, i64 -1
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %107)
br label %109
109: ; preds = %100
%110 = load i32, i32* %6
%111 = add nsw i32 %110, 1
store i32 %111, i32* %6
br label %96
112: ; preds = %96
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"1234567890\00"
@.str.8 = [4 x i8] c"%c \00"
@str = [19 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\00"
@str.12 = [16 x i8] c"\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\00"
@str.13 = [19 x i8] c"\E5\A4\8D\E5\88\B6\E9\95\BF\E5\BA\A6\E4\B8\BA\E7\A9\BA\00"
@str.14 = [49 x i8] c"\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\8E\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E7\9B\B8\E5\90\8C\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\00"
@str.15 = [46 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E5\A4\A7\E4\BA\8E\E6\BA\90\E5\9C\B0\E5\9D\80\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\00"
@str.16 = [46 x i8] c"\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E5\B0\8F\E4\BA\8E\E6\BA\90\E5\9C\B0\E5\9D\80\EF\BC\8C\E8\BE\93\E5\87\BA\E7\9B\AE\E6\A0\87\EF\BC\9A\00"
@str.17 = [26 x i8] c"Error:\E5\A4\8D\E5\88\B6\E9\95\BF\E5\BA\A6\E4\B8\BA0\EF\BC\81\00"
@str.18 = [25 x i8] c"Error:\E6\BA\90\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\EF\BC\81\00"
@str.19 = [28 x i8] c"Error:\E7\9B\AE\E6\A0\87\E5\9C\B0\E5\9D\80\E4\B8\BA\E7\A9\BA\EF\BC\81\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [12 x i8]
%4 = alloca [12 x i8]
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 12)
%7 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 12)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%11 = call i32 @my_memcpy(i8* null, i8* %5, i32 10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.19, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.12, i64 0, i64 0))
%17 = call i32 @my_memcpy(i8* %8, i8* null, i32 10)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.18, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.13, i64 0, i64 0))
%23 = call i32 @my_memcpy(i8* %8, i8* %5, i32 0)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
br label %27
27: ; preds = %25, %21
%28 = call i32 @my_memcpy(i8* %5, i8* %5, i32 10)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.14, i64 0, i64 0))
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %35)
%37 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %39)
%41 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %43)
%45 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 4
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %47)
%49 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 5
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %51)
%53 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 6
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 7
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %59)
%61 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 8
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %63)
%65 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 9
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %67)
%69 = call i32 @putchar(i32 10)
%70 = call i32 @my_memcpy(i8* %33, i8* %5, i32 10)
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.15, i64 0, i64 0))
%72 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %74)
%76 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %78)
%80 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %82)
%84 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 4
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %86)
%88 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 5
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %90)
%92 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 6
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %94)
%96 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 7
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %98)
%100 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 8
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %102)
%104 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 9
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %106)
%108 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 10
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %110)
%112 = call i32 @putchar(i32 10)
%113 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%114 = call i32 @memset(i8* %8, i32 0, i32 12)
%115 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.16, i64 0, i64 0))
%116 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 -1
%117 = call i32 @my_memcpy(i8* %116, i8* %5, i32 10)
%118 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 -1
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %120)
%122 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%123 = load i8, i8* %122
%124 = sext i8 %123 to i32
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %124)
%126 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 1
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %128)
%130 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 2
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %132)
%134 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 3
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %136)
%138 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 4
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %140)
%142 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 5
%143 = load i8, i8* %142
%144 = sext i8 %143 to i32
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %144)
%146 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 6
%147 = load i8, i8* %146
%148 = sext i8 %147 to i32
%149 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %148)
%150 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 7
%151 = load i8, i8* %150
%152 = sext i8 %151 to i32
%153 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %152)
%154 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 8
%155 = load i8, i8* %154
%156 = sext i8 %155 to i32
%157 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32 %156)
%158 = call i32 @putchar(i32 10)
ret i32 0
}