#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int intArray_a[10];
  char destCharArray_a[10] = "lijun";
  char srcCharArray_a[10] = "nixiang";
  int i;
  printf("Before empty:\n");
  for (i = 0; i < 10; i++) {
    intArray_a[i] = i + 1;
    printf("%d ", intArray_a[i]);
  }
  memset(intArray_a, 0, (10 - 1) * sizeof(int));
  printf("\nAfter empty:\n");
  for (i = 0; i < 10; i++) {
    printf("%d ", intArray_a[i]);
  }
  printf("\nBefore Copy:destCharArray_a:'%s',srcCharArray_a:'%s'",
         destCharArray_a, srcCharArray_a);
  memcpy(destCharArray_a, srcCharArray_a, (10 - 7) * sizeof(char));
  printf("\nAfter Copy:destCharArray_a:'%s',srcCharArray_a:'%s'",
         destCharArray_a, srcCharArray_a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x3a(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x32(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x44(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x3c(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    11b5 <main+0x85>
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq -0x48(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1179 <main+0x49>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
jge    1208 <main+0xd8>
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11da <main+0xaa>
lea    -0x3a(%rbp),%rsi
lea    -0x44(%rbp),%rdx
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x3a(%rbp),%rdi
lea    -0x44(%rbp),%rsi
mov    $0x3,%edx
call   1050 <memcpy@plt>
lea    -0x3a(%rbp),%rsi
lea    -0x44(%rbp),%rdx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movabs $0x6e756a696c,%rax
mov    %rax,0x38(%rsp)
movw   $0x0,0x40(%rsp)
movabs $0x676e616978696e,%rax
mov    %rax,0x28(%rsp)
movw   $0x0,0x30(%rsp)
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0xe46(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movaps 0xe0f(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x9,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0xa,0x24(%rsp)
mov    %rbx,%rdi
mov    $0xa,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1050 <memset@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x1c(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x24(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd48(%rip),%rdi
lea    0x38(%rsp),%rbx
lea    0x28(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1060 <memcpy@plt>
lea    0xd50(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.destCharArray_a = [10 x i8] c"lijun\00\00\00\00\00"
@__const.main.srcCharArray_a = [10 x i8] c"nixiang\00\00\00"
@.str = [15 x i8] c"Before empty:\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [15 x i8] c"\0AAfter empty:\0A\00"
@.str.3 = [54 x i8] c"\0ABefore Copy:destCharArray_a:'%s',srcCharArray_a:'%s'\00"
@.str.4 = [53 x i8] c"\0AAfter Copy:destCharArray_a:'%s',srcCharArray_a:'%s'\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca i32
%5 = bitcast [10 x i8]* %2 to i8*
%6 = bitcast [10 x i8]* %3 to i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %15
store i32 %13, i32* %16
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %11
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %8
25: ; preds = %8
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%27 = call i32 @memset(i32* %26, i32 0, i32 36)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %29
29: ; preds = %38, %25
%30 = load i32, i32* %4
%31 = icmp slt i32 %30, 10
br i1 %31, label %32, label %41
32: ; preds = %29
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %32
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %29
41: ; preds = %29
%42 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i8* %42, i8* %43)
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%47 = call i32 @memcpy(i8* %45, i8* %46, i32 3)
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%49 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i8* %48, i8* %49)
ret void
}

LLVM IR (-O2):
@__const.main.destCharArray_a = [10 x i8] c"lijun\00\00\00\00\00"
@__const.main.srcCharArray_a = [10 x i8] c"nixiang\00\00\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [54 x i8] c"\0ABefore Copy:destCharArray_a:'%s',srcCharArray_a:'%s'\00"
@.str.4 = [53 x i8] c"\0AAfter Copy:destCharArray_a:'%s',srcCharArray_a:'%s'\00"
@str = [14 x i8] c"Before empty:\00"
@str.5 = [14 x i8] c"\0AAfter empty:\00"
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = bitcast [10 x i32]* %1 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%15 = bitcast [10 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %15
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 5)
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 6)
%21 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 7)
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%24 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %24
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 8)
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
store i32 9, i32* %26
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 9)
%28 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 10, i32* %28
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 10)
%30 = call i32 @memset(i32* %8, i32 0, i32 36)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%32 = load i32, i32* %8
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %10
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %12
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %14
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %17
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %19
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %21
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %23
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %26
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = load i32, i32* %28
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i8* %5, i8* %6)
%53 = call i32 @memcpy(i8* %5, i8* %6, i32 3)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0), i8* %5, i8* %6)
ret void
}