#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*/ assert(int);
int /*<<< orphan*/ memmove(int *, int *, int);
int main() {
  {
    int foo[5] = {0, 1, 2, 3, 4};
    memmove(foo + 2, foo, sizeof(int) * 3);
    assert(foo[0] == 0);
    assert(foo[1] == 1);
    assert(foo[2] == 0);
    assert(foo[3] == 1);
    assert(foo[4] == 2);
  }
  {
    int foo[5] = {0, 1, 2, 3, 4};
    memmove(foo, foo + 2, sizeof(int) * 3);
    assert(foo[0] == 2);
    assert(foo[1] == 3);
    assert(foo[2] == 4);
    assert(foo[3] == 3);
    assert(foo[4] == 4);
  }
  {
    int foo[5] = {0, 1, 2, 3, 4};
    memmove(foo, foo, sizeof(int) * 5);
    assert(foo[0] == 0);
    assert(foo[1] == 1);
    assert(foo[2] == 2);
    assert(foo[3] == 3);
    assert(foo[4] == 4);
  }
  {
    int foo[5] = {0, 1, 2, 3, 4};
    memmove(foo + 2, foo, sizeof(int) * 2);
    assert(foo[0] == 0);
    assert(foo[1] == 1);
    assert(foo[2] == 0);
    assert(foo[3] == 1);
    assert(foo[4] == 4);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
add    $0x8,%rdi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1040 <memmove@plt>
cmpl   $0x0,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0xe5d(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe5a(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe58(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rsi
add    $0x8,%rsi
mov    $0xc,%edx
call   1040 <memmove@plt>
cmpl   $0x2,-0x40(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x3,-0x3c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x38(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x3,-0x34(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x30(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0xdf3(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xdf0(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xdee(%rip),%eax
mov    %eax,-0x50(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x14,%edx
call   1040 <memmove@plt>
cmpl   $0x0,-0x60(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x5c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x2,-0x58(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x3,-0x54(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x50(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0xd8d(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xd8a(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xd88(%rip),%eax
mov    %eax,-0x70(%rbp)
lea    -0x80(%rbp),%rdi
add    $0x8,%rdi
lea    -0x80(%rbp),%rsi
mov    $0x8,%edx
call   1040 <memmove@plt>
cmpl   $0x0,-0x80(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x7c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x78(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x1,-0x74(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x4,-0x70(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xee5(%rip),%ebx
mov    %ebx,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
mov    $0xc,%edx
call   1040 <memmove@plt>
xor    %edi,%edi
cmpl   $0x0,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0x8(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0xc(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0x10(%rsp)
sete   %dil
call   1030 <assert@plt>
mov    %ebx,0x10(%rsp)
movaps 0xe5a(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%rsi
mov    %rsp,%rdi
mov    $0xc,%edx
call   1040 <memmove@plt>
xor    %edi,%edi
cmpl   $0x2,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x4,0x8(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0xc(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x4,0x10(%rsp)
sete   %dil
call   1030 <assert@plt>
mov    %ebx,0x10(%rsp)
movaps 0xdea(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    %rdi,%rsi
mov    $0x14,%edx
call   1040 <memmove@plt>
xor    %edi,%edi
cmpl   $0x0,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x2,0x8(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x3,0xc(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x4,0x10(%rsp)
sete   %dil
call   1030 <assert@plt>
mov    %ebx,0x10(%rsp)
movaps 0xd7c(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1040 <memmove@plt>
xor    %edi,%edi
cmpl   $0x0,(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x0,0x8(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x1,0xc(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
cmpl   $0x4,0x10(%rsp)
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.foo = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@__const.main.foo.1 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@__const.main.foo.2 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@__const.main.foo.3 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca [5 x i32]
%5 = alloca [5 x i32]
store i32 0, i32* %1
%6 = bitcast [5 x i32]* %2 to i8*
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%10 = call i32 @memmove(i32* %8, i32* %9, i32 12)
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 1
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 1
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 2
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = bitcast [5 x i32]* %3 to i8*
%37 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%39 = getelementptr inbounds i32, i32* %38, i64 2
%40 = call i32 @memmove(i32* %37, i32* %39, i32 12)
%41 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 2
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 3
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%52 = load i32, i32* %51
%53 = icmp eq i32 %52, 4
%54 = zext i1 %53 to i32
%55 = call i32 @assert(i32 %54)
%56 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%57 = load i32, i32* %56
%58 = icmp eq i32 %57, 3
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 4
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = bitcast [5 x i32]* %4 to i8*
%67 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%69 = call i32 @memmove(i32* %67, i32* %68, i32 20)
%70 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%71 = load i32, i32* %70
%72 = icmp eq i32 %71, 0
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 1
%76 = load i32, i32* %75
%77 = icmp eq i32 %76, 1
%78 = zext i1 %77 to i32
%79 = call i32 @assert(i32 %78)
%80 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 2
%81 = load i32, i32* %80
%82 = icmp eq i32 %81, 2
%83 = zext i1 %82 to i32
%84 = call i32 @assert(i32 %83)
%85 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 3
%86 = load i32, i32* %85
%87 = icmp eq i32 %86, 3
%88 = zext i1 %87 to i32
%89 = call i32 @assert(i32 %88)
%90 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 4
%91 = load i32, i32* %90
%92 = icmp eq i32 %91, 4
%93 = zext i1 %92 to i32
%94 = call i32 @assert(i32 %93)
%95 = bitcast [5 x i32]* %5 to i8*
%96 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%97 = getelementptr inbounds i32, i32* %96, i64 2
%98 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%99 = call i32 @memmove(i32* %97, i32* %98, i32 8)
%100 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%101 = load i32, i32* %100
%102 = icmp eq i32 %101, 0
%103 = zext i1 %102 to i32
%104 = call i32 @assert(i32 %103)
%105 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 1
%106 = load i32, i32* %105
%107 = icmp eq i32 %106, 1
%108 = zext i1 %107 to i32
%109 = call i32 @assert(i32 %108)
%110 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 2
%111 = load i32, i32* %110
%112 = icmp eq i32 %111, 0
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
%115 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 3
%116 = load i32, i32* %115
%117 = icmp eq i32 %116, 1
%118 = zext i1 %117 to i32
%119 = call i32 @assert(i32 %118)
%120 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 4
%121 = load i32, i32* %120
%122 = icmp eq i32 %121, 4
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
ret i32 0
}

LLVM IR (-O2):
@__const.main.foo.3 = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
%4 = alloca [5 x i32]
%5 = bitcast [5 x i32]* %1 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%8 = call i32 @memmove(i32* %7, i32* %6, i32 12)
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 1
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 2
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = bitcast [5 x i32]* %2 to i8*
%33 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 2
%35 = call i32 @memmove(i32* %33, i32* %34, i32 12)
%36 = load i32, i32* %33
%37 = icmp eq i32 %36, 2
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 1
%41 = load i32, i32* %40
%42 = icmp eq i32 %41, 3
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32, i32* %34
%46 = icmp eq i32 %45, 4
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 3
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, 3
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 4
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 4
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
%59 = bitcast [5 x i32]* %3 to i8*
%60 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%61 = call i32 @memmove(i32* %60, i32* %60, i32 20)
%62 = load i32, i32* %60
%63 = icmp eq i32 %62, 0
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%67 = load i32, i32* %66
%68 = icmp eq i32 %67, 1
%69 = zext i1 %68 to i32
%70 = call i32 @assert(i32 %69)
%71 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, 2
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%77 = load i32, i32* %76
%78 = icmp eq i32 %77, 3
%79 = zext i1 %78 to i32
%80 = call i32 @assert(i32 %79)
%81 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%82 = load i32, i32* %81
%83 = icmp eq i32 %82, 4
%84 = zext i1 %83 to i32
%85 = call i32 @assert(i32 %84)
%86 = bitcast [5 x i32]* %4 to i8*
%87 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 0
%88 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 2
%89 = call i32 @memmove(i32* %88, i32* %87, i32 8)
%90 = load i32, i32* %87
%91 = icmp eq i32 %90, 0
%92 = zext i1 %91 to i32
%93 = call i32 @assert(i32 %92)
%94 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 1
%95 = load i32, i32* %94
%96 = icmp eq i32 %95, 1
%97 = zext i1 %96 to i32
%98 = call i32 @assert(i32 %97)
%99 = load i32, i32* %88
%100 = icmp eq i32 %99, 0
%101 = zext i1 %100 to i32
%102 = call i32 @assert(i32 %101)
%103 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 3
%104 = load i32, i32* %103
%105 = icmp eq i32 %104, 1
%106 = zext i1 %105 to i32
%107 = call i32 @assert(i32 %106)
%108 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 4
%109 = load i32, i32* %108
%110 = icmp eq i32 %109, 4
%111 = zext i1 %110 to i32
%112 = call i32 @assert(i32 %111)
ret i32 0
}