#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*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ mymemcpy(char *, char *, int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char *c = malloc(7018911);
  char *d = malloc(7018911);
  for (int i = 0; i < 7018911; i++) {
    d[i] = 'a' + i;
  }
  mymemcpy(c + 7, d + 7, 7018911 - 7);
  for (int i = 7; i < 7018911; i++) {
    assert(c[i] == d[i]);
  }
  puts("OK");
  free(c);
  free(d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6b199f,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x6b199f,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6b199f,-0x1c(%rbp)
jge    11b0 <main+0x60>
mov    -0x1c(%rbp),%eax
add    $0x61,%eax
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <main+0x32>
mov    -0x10(%rbp),%rdi
add    $0x7,%rdi
mov    -0x18(%rbp),%rsi
add    $0x7,%rsi
mov    $0x6b1998,%edx
call   1070 <mymemcpy@plt>
movl   $0x7,-0x20(%rbp)
cmpl   $0x6b199f,-0x20(%rbp)
jge    1213 <main+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d1 <main+0x81>
lea    0xde6(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x6b199f,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x6b199f,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
movdqa 0xe89(%rip),%xmm0
mov    $0x20,%eax
movdqa 0xe8c(%rip),%xmm1
movdqa 0xe94(%rip),%xmm2
movdqa 0xe9c(%rip),%xmm3
movdqa 0xea4(%rip),%xmm4
nopl   0x0(%rax)
movdqa %xmm0,%xmm5
paddb  %xmm1,%xmm5
movdqu %xmm5,-0x20(%r15,%rax,1)
movdqa %xmm0,%xmm5
paddb  %xmm2,%xmm5
movdqu %xmm5,-0x10(%r15,%rax,1)
movdqa %xmm0,%xmm5
paddb  %xmm3,%xmm5
movdqu %xmm5,(%r15,%rax,1)
paddb  %xmm4,%xmm0
add    $0x30,%rax
cmp    $0x6b19b0,%rax
jne    11a0 <main+0x50>
movabs $0xf8f7f6f5f4f3f2f1,%rax
f6 f7 f8
mov    %rax,0x6b1990(%r15)
movl   $0xfcfbfaf9,0x6b1998(%r15)
f9 fa fb fc
movw   $0xfefd,0x6b199c(%r15)
movb   $0xff,0x6b199e(%r15)
ff
mov    %r14,%rdi
add    $0x7,%rdi
mov    %r15,%rsi
add    $0x7,%rsi
mov    $0x6b1998,%edx
call   1070 <mymemcpy@plt>
mov    $0x7,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r14,%rbx,1),%eax
xor    %edi,%edi
cmp    (%r15,%rbx,1),%al
sete   %dil
call   1050 <assert@plt>
add    $0x1,%rbx
cmp    $0x6b199f,%rbx
jne    1230 <main+0xe0>
lea    0xdf8(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i8* @malloc(i32 7018911)
store i8* %6, i8** %2
%7 = call i8* @malloc(i32 7018911)
store i8* %7, i8** %3
store i32 0, i32* %4
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 7018911
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %4
%13 = add nsw i32 97, %12
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %14, i8* %18
br label %19
19: ; preds = %11
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %8
22: ; preds = %8
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 7
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 7
%27 = call i32 @mymemcpy(i8* %24, i8* %26, i32 7018904)
store i32 7, i32* %5
br label %28
28: ; preds = %47, %22
%29 = load i32, i32* %5
%30 = icmp slt i32 %29, 7018911
br i1 %30, label %31, label %50
31: ; preds = %28
%32 = load i8*, i8** %2
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = load i8*, i8** %3
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %37, %43
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
br label %47
47: ; preds = %31
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %28
50: ; preds = %28
%51 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%52 = load i8*, i8** %2
%53 = call i32 @free(i8* %52)
%54 = load i8*, i8** %3
%55 = call i32 @free(i8* %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(7018911) i8* @malloc(i32 7018911)
%2 = tail call dereferenceable_or_null(7018911) i8* @malloc(i32 7018911)
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %17, %3 ]
%5 = phi <16 x i8> [ <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, %0 ], [ %18, %3 ]
%6 = add <16 x i8> %5, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%7 = getelementptr inbounds i8, i8* %2, i64 %4
%8 = bitcast i8* %7 to <16 x i8>*
store <16 x i8> %6, <16 x i8>* %8
%9 = add nuw nsw i64 %4, 16
%10 = add <16 x i8> %5, <i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113, i8 113>
%11 = getelementptr inbounds i8, i8* %2, i64 %9
%12 = bitcast i8* %11 to <16 x i8>*
store <16 x i8> %10, <16 x i8>* %12
%13 = add nuw nsw i64 %4, 32
%14 = add <16 x i8> %5, <i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127, i8 -127>
%15 = getelementptr inbounds i8, i8* %2, i64 %13
%16 = bitcast i8* %15 to <16 x i8>*
store <16 x i8> %14, <16 x i8>* %16
%17 = add nuw nsw i64 %4, 48
%18 = add <16 x i8> %5, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%19 = icmp eq i64 %17, 7018896
br i1 %19, label %20, label %3
20: ; preds = %3
%21 = getelementptr inbounds i8, i8* %2, i64 7018896
store i8 -15, i8* %21
%22 = getelementptr inbounds i8, i8* %2, i64 7018897
store i8 -14, i8* %22
%23 = getelementptr inbounds i8, i8* %2, i64 7018898
store i8 -13, i8* %23
%24 = getelementptr inbounds i8, i8* %2, i64 7018899
store i8 -12, i8* %24
%25 = getelementptr inbounds i8, i8* %2, i64 7018900
store i8 -11, i8* %25
%26 = getelementptr inbounds i8, i8* %2, i64 7018901
store i8 -10, i8* %26
%27 = getelementptr inbounds i8, i8* %2, i64 7018902
store i8 -9, i8* %27
%28 = getelementptr inbounds i8, i8* %2, i64 7018903
store i8 -8, i8* %28
%29 = getelementptr inbounds i8, i8* %2, i64 7018904
store i8 -7, i8* %29
%30 = getelementptr inbounds i8, i8* %2, i64 7018905
store i8 -6, i8* %30
%31 = getelementptr inbounds i8, i8* %2, i64 7018906
store i8 -5, i8* %31
%32 = getelementptr inbounds i8, i8* %2, i64 7018907
store i8 -4, i8* %32
%33 = getelementptr inbounds i8, i8* %2, i64 7018908
store i8 -3, i8* %33
%34 = getelementptr inbounds i8, i8* %2, i64 7018909
store i8 -2, i8* %34
%35 = getelementptr inbounds i8, i8* %2, i64 7018910
store i8 -1, i8* %35
%36 = getelementptr inbounds i8, i8* %1, i64 7
%37 = getelementptr inbounds i8, i8* %2, i64 7
%38 = tail call i32 @mymemcpy(i8* %36, i8* %37, i32 7018904)
br label %43
39: ; preds = %43
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%41 = tail call i32 @free(i8* %1)
%42 = tail call i32 @free(i8* %2)
ret i32 0
43: ; preds = %20, %43
%44 = phi i64 [ 7, %20 ], [ %52, %43 ]
%45 = getelementptr inbounds i8, i8* %1, i64 %44
%46 = load i8, i8* %45
%47 = getelementptr inbounds i8, i8* %2, i64 %44
%48 = load i8, i8* %47
%49 = icmp eq i8 %46, %48
%50 = zext i1 %49 to i32
%51 = tail call i32 @assert(i32 %50)
%52 = add nuw nsw i64 %44, 1
%53 = icmp eq i64 %52, 7018911
br i1 %53, label %39, label %43
}