int main() {
  char stringA[20] = {"liuzijian"};
  char stringB[20] = {"wakaka"};
  if (!CopyString(stringA, stringB, 3)) {
    printf("The third parameter number  is wrong!\n\n");
  }
  printf("stringA: %s \nstringB :%s\n", stringA, stringB);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec6(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1030 <CopyString@plt>
cmp    $0x0,%eax
jne    1198 <main+0x78>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <CopyString@plt>
test   %eax,%eax
jne    117f <main+0x4f>
lea    0xed4(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.stringA = [20 x i8] c"liuzijian\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.stringB = [20 x i8] c"wakaka\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [40 x i8] c"The third parameter number is wrong!\0A\0A\00"
@.str.1 = [26 x i8] c"stringA: %s \0AstringB :%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = bitcast [20 x i8]* %2 to i8*
%5 = bitcast [20 x i8]* %3 to i8*
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @CopyString to i32 (i8*, i8*, i32, ...)*)(i8* %6, i8* %7, i32 3)
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.stringA = [20 x i8] c"liuzijian\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.stringB = [20 x i8] c"wakaka\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.1 = [26 x i8] c"stringA: %s \0AstringB :%s\0A\00"
@str = [39 x i8] c"The third parameter number is wrong!\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @CopyString to i32 (i8*, i8*, i32, ...)*)(i8* %3, i8* %4, i32 3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
ret i32 0
}