#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 */
char *memmove(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int main(void) {
  char x[] = "Home Sweet Home";
  printf("%s%s\n", "The string in array x before memmove is: ", x);
  printf("%s%s\n",
         "The string in array x after memmove is: ", memmove(x, &x[5], 10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdx
lea    0xec0(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x20(%rbp),%rsi
add    $0x5,%rsi
mov    $0xa,%edx
call   1040 <memmove@plt>
mov    %rax,%rdx
lea    0xe94(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movaps 0xed2(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed7(%rip),%r14
lea    0xed6(%rip),%rsi
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
lea    0x5(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <memmove@plt>
lea    0xed9(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.x = [16 x i8] c"Home Sweet Home\00"
@.str = [6 x i8] c"%s%s\0A\00"
@.str.1 = [42 x i8] c"The string in array x before memmove is: \00"
@.str.2 = [41 x i8] c"The string in array x after memmove is: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = bitcast [16 x i8]* %2 to i8*
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 5
%8 = call i8* @memmove(i8* %6, i8* %7, i32 10)
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [16 x i8] c"Home Sweet Home\00"
@.str = [6 x i8] c"%s%s\0A\00"
@.str.1 = [42 x i8] c"The string in array x before memmove is: \00"
@.str.2 = [41 x i8] c"The string in array x after memmove is: \00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 5
%5 = call i8* @memmove(i8* %2, i8* %4, i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}