#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 */
typedef float clock_t;

/* Variables and functions */
float CLOCKS_PER_SEC;
int atoi(char *);
float clock();
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ help(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(void *, void *, int);
int /*<<< orphan*/ memset(void *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int size = (2 * 1024);
  int end_size = (1024 * 1024);
  int salign = (4 * 1024);
  int dalign = (4 * 1024);
  int loops = 200000;
  int src, dst, asrc, adst;
  if (argc > 1) {
    loops = atoi(argv[1]) * 1000;
    if (loops <= 0)
      help(argv[0]);
  }
  if (argc > 2) {
    size = atoi(argv[2]) * 1024;
    if (size <= 0)
      help(argv[0]);
  }
  if (argc > 3) {
    end_size = atoi(argv[3]) * 1024;
    if (end_size < size)
      help(argv[0]);
  }
  if (argc > 4) {
    salign = atoi(argv[4]);
    if ((salign < 0) || (salign > (4 * 1024)))
      help(argv[0]);
  }
  if (argc > 5) {
    dalign = atoi(argv[5]);
    if ((dalign < 0) || (dalign > (4 * 1024)))
      help(argv[0]);
  }
  if ((src = (int)malloc(end_size + salign + (4 * 1024))) == 0) {
    printf("%s: insufficient memory\n", argv[0]);
    return -1;
  }
  memset((void *)src, 0xaa, end_size + salign + (4 * 1024));
  if ((dst = (int)malloc(end_size + dalign + (4 * 1024))) == 0) {
    free((void *)src);
    printf("%s: insuficient memory\n", argv[0]);
    return -1;
  }
  memset((void *)dst, 0x55, end_size + dalign + (4 * 1024));
  if (src % (4 * 1024) == 0)
    asrc = src + salign;
  else
    asrc = src + (4 * 1024) - (src % (4 * 1024)) + salign;
  if (dst % (4 * 1024) == 0)
    adst = dst + dalign;
  else
    adst = dst + (4 * 1024) - (dst % (4 * 1024)) + dalign;
  printf("\nMEMCPY Benchmark\n\n");
  printf("Src Buffer 0x%08x\n", asrc);
  printf("Dst Buffer 0x%08x\n\n", adst);
  printf("%10s %10s\n", "Cached", "Bandwidth");
  printf("%10s %10s\n", "(KBytes)", "(MB/sec)");
  while (size <= end_size) {
    clock_t start_time;
    float elapsed_time;
    int loop;
    printf("%10d", size / 1024);
    start_time = clock();
    for (loop = 0; loop < loops; loop++)
      memcpy((void *)adst, (void *)asrc, size);
    elapsed_time = ((float)clock() - start_time) / CLOCKS_PER_SEC;
    printf(" %10.0f\n",
           ((float)size * loops * 2) / elapsed_time / (1024 * 1024));
    size *= 2;
    loops /= 2;
  }
  free((void *)src);
  free((void *)dst);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x800,-0x14(%rbp)
movl   $0x100000,-0x18(%rbp)
movl   $0x1000,-0x1c(%rbp)
movl   $0x1000,-0x20(%rbp)
movl   $0x30d40,-0x24(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11f4 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atoi@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     11ef <main+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <help@plt>
jmp    11f4 <main+0x74>
cmpl   $0x2,-0x8(%rbp)
jle    122c <main+0xac>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <atoi@plt>
shl    $0xa,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     1227 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <help@plt>
jmp    122c <main+0xac>
cmpl   $0x3,-0x8(%rbp)
jle    1266 <main+0xe6>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <atoi@plt>
shl    $0xa,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1261 <main+0xe1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <help@plt>
jmp    1266 <main+0xe6>
cmpl   $0x4,-0x8(%rbp)
jle    12a8 <main+0x128>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1297 <main+0x117>
cmpl   $0x1000,-0x1c(%rbp)
jle    12a3 <main+0x123>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <help@plt>
jmp    12a8 <main+0x128>
cmpl   $0x5,-0x8(%rbp)
jle    12ea <main+0x16a>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   10a0 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     12d9 <main+0x159>
cmpl   $0x1000,-0x20(%rbp)
jle    12e5 <main+0x165>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <help@plt>
jmp    12ea <main+0x16a>
mov    -0x18(%rbp),%edi
add    -0x1c(%rbp),%edi
add    $0x1000,%edi
call   1080 <malloc@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jne    1328 <main+0x1a8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    157c <main+0x3fc>
movslq -0x28(%rbp),%rdi
mov    -0x18(%rbp),%edx
add    -0x1c(%rbp),%edx
add    $0x1000,%edx
mov    $0xaa,%esi
call   1060 <memset@plt>
mov    -0x18(%rbp),%edi
add    -0x20(%rbp),%edi
add    $0x1000,%edi
call   1080 <malloc@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jne    1389 <main+0x209>
movslq -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xcab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    157c <main+0x3fc>
movslq -0x2c(%rbp),%rdi
mov    -0x18(%rbp),%edx
add    -0x20(%rbp),%edx
add    $0x1000,%edx
mov    $0x55,%esi
call   1060 <memset@plt>
mov    -0x28(%rbp),%eax
mov    $0x1000,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    13c5 <main+0x245>
mov    -0x28(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    13e6 <main+0x266>
mov    -0x28(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x44(%rbp)
mov    -0x28(%rbp),%eax
mov    $0x1000,%ecx
cltd
idiv   %ecx
mov    -0x44(%rbp),%eax
sub    %edx,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x1000,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1408 <main+0x288>
mov    -0x2c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    1429 <main+0x2a9>
mov    -0x2c(%rbp),%eax
add    $0x1000,%eax
mov    %eax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x1000,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%eax
sub    %edx,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xc0c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xc14(%rip),%rdi
lea    0xc18(%rip),%rsi
lea    0xc18(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xbf8(%rip),%rdi
lea    0xc0d(%rip),%rsi
lea    0xc0f(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     156a <main+0x3ea>
mov    -0x14(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xbf1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
movss  %xmm0,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14f5 <main+0x375>
movslq -0x34(%rbp),%rdi
movslq -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1070 <memcpy@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    14cb <main+0x34b>
mov    $0x0,%al
call   1040 <clock@plt>
subss  -0x38(%rbp),%xmm0
mov    0x2ae0(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x3c(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
cvtsi2ssl -0x24(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xadd(%rip),%xmm1
mulss  %xmm1,%xmm0
divss  -0x3c(%rbp),%xmm0
movss  0xac8(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xb60(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
jmp    1491 <main+0x311>
movslq -0x28(%rbp),%rdi
call   1030 <free@plt>
movslq -0x2c(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    $0x100000,%r14d
mov    $0x30d40,%r13d
mov    $0x800,%r12d
cmp    $0x2,%edi
mov    %rsi,0x8(%rsp)
jl     127a <main+0xea>
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
test   %eax,%eax
jg     11da <main+0x4a>
mov    (%r15),%rdi
call   10a0 <help@plt>
imul   $0x3e8,%ebp,%r13d
cmp    $0x3,%ebx
jb     127a <main+0xea>
movl   $0x1000,0x4(%rsp)
mov    0x10(%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r12d
test   %eax,%eax
jg     120a <main+0x7a>
mov    (%r15),%rdi
call   10a0 <help@plt>
shl    $0xa,%r12d
cmp    $0x4,%ebx
jb     1282 <main+0xf2>
mov    0x18(%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r14d
shl    $0xa,%r14d
cmp    %r12d,%r14d
jge    1230 <main+0xa0>
mov    (%r15),%rdi
call   10a0 <help@plt>
cmp    $0x5,%ebx
jb     1282 <main+0xf2>
mov    0x20(%r15),%rdi
call   10b0 <atoi@plt>
mov    %rax,%rbp
cmp    $0x1001,%eax
jb     1250 <main+0xc0>
mov    (%r15),%rdi
call   10a0 <help@plt>
cmp    $0x6,%ebx
jb     14d9 <main+0x349>
mov    0x28(%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,0x4(%rsp)
cmp    $0x1001,%eax
mov    %rbp,%rbx
jb     1287 <main+0xf7>
mov    (%r15),%rdi
call   10a0 <help@plt>
jmp    1287 <main+0xf7>
movl   $0x1000,0x4(%rsp)
mov    $0x1000,%ebx
lea    (%r14,%rbx,1),%ebp
add    $0x1000,%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
test   %r15d,%r15d
je     13c1 <main+0x231>
mov    %rbx,0x20(%rsp)
lea    0x1000(%r14),%ebx
mov    %r14,0x18(%rsp)
movslq %r15d,%r14
mov    %r14,%rdi
mov    $0xaa,%esi
mov    %ebp,%edx
call   1070 <memset@plt>
add    0x4(%rsp),%ebx
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
test   %ebp,%ebp
je     13d2 <main+0x242>
mov    %r14,0x8(%rsp)
movslq %ebp,%rdi
mov    %rdi,0x10(%rsp)
mov    $0x55,%esi
mov    %ebx,%edx
call   1070 <memset@plt>
lea    0xfff(%r15),%eax
test   %r15d,%r15d
cmovns %r15d,%eax
and    $0xfffff000,%eax
lea    0x1000(%rax),%r14d
cmp    %eax,%r15d
cmove  %r15d,%r14d
add    0x20(%rsp),%r14d
lea    0xfff(%rbp),%eax
test   %ebp,%ebp
cmovns %ebp,%eax
and    $0xfffff000,%eax
lea    0x1000(%rax),%ebx
cmp    %eax,%ebp
cmove  %ebp,%ebx
add    0x4(%rsp),%ebx
lea    0xd56(%rip),%rdi
call   1040 <puts@plt>
lea    0xce7(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xce9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xced(%rip),%r15
lea    0xcf1(%rip),%rsi
lea    0xcf1(%rip),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xcea(%rip),%rsi
lea    0xcec(%rip),%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%rax
cmp    %eax,%r12d
jle    1404 <main+0x274>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    13f5 <main+0x265>
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
lea    0xc34(%rip),%rdi
jmp    13e9 <main+0x259>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rsi
lea    0xc34(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%r15
movslq %ebx,%rbp
movslq %r14d,%rbx
jmp    147b <main+0x2eb>
nop
xor    %eax,%eax
call   1050 <clock@plt>
subss  0x4(%rsp),%xmm0
mov    0x2bc4(%rip),%rax
divss  (%rax),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
xorps  %xmm2,%xmm2
cvtsi2ss %r13d,%xmm2
mulss  %xmm1,%xmm2
addss  %xmm2,%xmm2
divss  %xmm0,%xmm2
mulss  0xbb4(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xc35(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
add    %r12d,%r12d
mov    %r13d,%eax
shr    $0x1f,%eax
add    %r13d,%eax
sar    %eax
mov    %eax,%r13d
cmp    %r15d,%r12d
jg     13a9 <main+0x219>
lea    0x3ff(%r12),%esi
test   %r12d,%r12d
cmovns %r12d,%esi
sar    $0xa,%esi
lea    0xbf6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
movss  %xmm0,0x4(%rsp)
test   %r13d,%r13d
jle    1410 <main+0x280>
mov    %r13d,%r14d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1080 <memcpy@plt>
add    $0xffffffff,%r14d
jne    14c0 <main+0x330>
jmp    1410 <main+0x280>
mov    %rbp,%rbx
jmp    1287 <main+0xf7>

LLVM IR (-O0):
@.str = [25 x i8] c"%s: insufficient memory\0A\00"
@.str.1 = [24 x i8] c"%s: insuficient memory\0A\00"
@.str.2 = [20 x i8] c"\0AMEMCPY Benchmark\0A\0A\00"
@.str.3 = [19 x i8] c"Src Buffer 0x%08x\0A\00"
@.str.4 = [20 x i8] c"Dst Buffer 0x%08x\0A\0A\00"
@.str.5 = [11 x i8] c"%10s %10s\0A\00"
@.str.6 = [7 x i8] c"Cached\00"
@.str.7 = [10 x i8] c"Bandwidth\00"
@.str.8 = [9 x i8] c"(KBytes)\00"
@.str.9 = [9 x i8] c"(MB/sec)\00"
@.str.10 = [5 x i8] c"%10d\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.11 = [9 x i8] c" %10.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca float
%16 = alloca float
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2048, i32* %6
store i32 1048576, i32* %7
store i32 4096, i32* %8
store i32 4096, i32* %9
store i32 200000, i32* %10
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %34
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = mul nsw i32 %24, 1000
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp sle i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %20
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @help(i8* %31)
br label %33
33: ; preds = %28, %20
br label %34
34: ; preds = %33, %2
%35 = load i32, i32* %4
%36 = icmp sgt i32 %35, 2
br i1 %36, label %37, label %51
37: ; preds = %34
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = call i32 @atoi(i8* %40)
%42 = mul nsw i32 %41, 1024
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp sle i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %37
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i32 @help(i8* %48)
br label %50
50: ; preds = %45, %37
br label %51
51: ; preds = %50, %34
%52 = load i32, i32* %4
%53 = icmp sgt i32 %52, 3
br i1 %53, label %54, label %69
54: ; preds = %51
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 3
%57 = load i8*, i8** %56
%58 = call i32 @atoi(i8* %57)
%59 = mul nsw i32 %58, 1024
store i32 %59, i32* %7
%60 = load i32, i32* %7
%61 = load i32, i32* %6
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %68
63: ; preds = %54
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 0
%66 = load i8*, i8** %65
%67 = call i32 @help(i8* %66)
br label %68
68: ; preds = %63, %54
br label %69
69: ; preds = %68, %51
%70 = load i32, i32* %4
%71 = icmp sgt i32 %70, 4
br i1 %71, label %72, label %88
72: ; preds = %69
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 4
%75 = load i8*, i8** %74
%76 = call i32 @atoi(i8* %75)
store i32 %76, i32* %8
%77 = load i32, i32* %8
%78 = icmp slt i32 %77, 0
br i1 %78, label %82, label %79
79: ; preds = %72
%80 = load i32, i32* %8
%81 = icmp sgt i32 %80, 4096
br i1 %81, label %82, label %87
82: ; preds = %79, %72
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 0
%85 = load i8*, i8** %84
%86 = call i32 @help(i8* %85)
br label %87
87: ; preds = %82, %79
br label %88
88: ; preds = %87, %69
%89 = load i32, i32* %4
%90 = icmp sgt i32 %89, 5
br i1 %90, label %91, label %107
91: ; preds = %88
%92 = load i8**, i8*** %5
%93 = getelementptr inbounds i8*, i8** %92, i64 5
%94 = load i8*, i8** %93
%95 = call i32 @atoi(i8* %94)
store i32 %95, i32* %9
%96 = load i32, i32* %9
%97 = icmp slt i32 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %91
%99 = load i32, i32* %9
%100 = icmp sgt i32 %99, 4096
br i1 %100, label %101, label %106
101: ; preds = %98, %91
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 0
%104 = load i8*, i8** %103
%105 = call i32 @help(i8* %104)
br label %106
106: ; preds = %101, %98
br label %107
107: ; preds = %106, %88
%108 = load i32, i32* %7
%109 = load i32, i32* %8
%110 = add nsw i32 %108, %109
%111 = add nsw i32 %110, 4096
%112 = call i64 @malloc(i32 %111)
%113 = trunc i64 %112 to i32
store i32 %113, i32* %11
%114 = icmp eq i32 %113, 0
br i1 %114, label %115, label %120
115: ; preds = %107
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 0
%118 = load i8*, i8** %117
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %118)
store i32 -1, i32* %3
br label %248
120: ; preds = %107
%121 = load i32, i32* %11
%122 = sext i32 %121 to i64
%123 = inttoptr i64 %122 to i8*
%124 = load i32, i32* %7
%125 = load i32, i32* %8
%126 = add nsw i32 %124, %125
%127 = add nsw i32 %126, 4096
%128 = call i32 @memset(i8* %123, i32 170, i32 %127)
%129 = load i32, i32* %7
%130 = load i32, i32* %9
%131 = add nsw i32 %129, %130
%132 = add nsw i32 %131, 4096
%133 = call i64 @malloc(i32 %132)
%134 = trunc i64 %133 to i32
store i32 %134, i32* %12
%135 = icmp eq i32 %134, 0
br i1 %135, label %136, label %145
136: ; preds = %120
%137 = load i32, i32* %11
%138 = sext i32 %137 to i64
%139 = inttoptr i64 %138 to i8*
%140 = call i32 @free(i8* %139)
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 0
%143 = load i8*, i8** %142
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %143)
store i32 -1, i32* %3
br label %248
145: ; preds = %120
%146 = load i32, i32* %12
%147 = sext i32 %146 to i64
%148 = inttoptr i64 %147 to i8*
%149 = load i32, i32* %7
%150 = load i32, i32* %9
%151 = add nsw i32 %149, %150
%152 = add nsw i32 %151, 4096
%153 = call i32 @memset(i8* %148, i32 85, i32 %152)
%154 = load i32, i32* %11
%155 = srem i32 %154, 4096
%156 = icmp eq i32 %155, 0
br i1 %156, label %157, label %161
157: ; preds = %145
%158 = load i32, i32* %11
%159 = load i32, i32* %8
%160 = add nsw i32 %158, %159
store i32 %160, i32* %13
br label %169
161: ; preds = %145
%162 = load i32, i32* %11
%163 = add nsw i32 %162, 4096
%164 = load i32, i32* %11
%165 = srem i32 %164, 4096
%166 = sub nsw i32 %163, %165
%167 = load i32, i32* %8
%168 = add nsw i32 %166, %167
store i32 %168, i32* %13
br label %169
169: ; preds = %161, %157
%170 = load i32, i32* %12
%171 = srem i32 %170, 4096
%172 = icmp eq i32 %171, 0
br i1 %172, label %173, label %177
173: ; preds = %169
%174 = load i32, i32* %12
%175 = load i32, i32* %9
%176 = add nsw i32 %174, %175
store i32 %176, i32* %14
br label %185
177: ; preds = %169
%178 = load i32, i32* %12
%179 = add nsw i32 %178, 4096
%180 = load i32, i32* %12
%181 = srem i32 %180, 4096
%182 = sub nsw i32 %179, %181
%183 = load i32, i32* %9
%184 = add nsw i32 %182, %183
store i32 %184, i32* %14
br label %185
185: ; preds = %177, %173
%186 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%187 = load i32, i32* %13
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %187)
%189 = load i32, i32* %14
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %189)
%191 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %193
193: ; preds = %218, %185
%194 = load i32, i32* %6
%195 = load i32, i32* %7
%196 = icmp sle i32 %194, %195
br i1 %196, label %197, label %239
197: ; preds = %193
%198 = load i32, i32* %6
%199 = sdiv i32 %198, 1024
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %199)
%201 = call float (...) @clock()
store float %201, float* %15
store i32 0, i32* %17
br label %202
202: ; preds = %215, %197
%203 = load i32, i32* %17
%204 = load i32, i32* %10
%205 = icmp slt i32 %203, %204
br i1 %205, label %206, label %218
206: ; preds = %202
%207 = load i32, i32* %14
%208 = sext i32 %207 to i64
%209 = inttoptr i64 %208 to i8*
%210 = load i32, i32* %13
%211 = sext i32 %210 to i64
%212 = inttoptr i64 %211 to i8*
%213 = load i32, i32* %6
%214 = call i32 @memcpy(i8* %209, i8* %212, i32 %213)
br label %215
215: ; preds = %206
%216 = load i32, i32* %17
%217 = add nsw i32 %216, 1
store i32 %217, i32* %17
br label %202
218: ; preds = %202
%219 = call float (...) @clock()
%220 = load float, float* %15
%221 = fsub float %219, %220
%222 = load float, float* @CLOCKS_PER_SEC
%223 = fdiv float %221, %222
store float %223, float* %16
%224 = load i32, i32* %6
%225 = sitofp i32 %224 to float
%226 = load i32, i32* %10
%227 = sitofp i32 %226 to float
%228 = fmul float %225, %227
%229 = fmul float %228, 2.000000e+00
%230 = load float, float* %16
%231 = fdiv float %229, %230
%232 = fdiv float %231, 0x4130000000000000
%233 = fpext float %232 to double
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %233)
%235 = load i32, i32* %6
%236 = mul nsw i32 %235, 2
store i32 %236, i32* %6
%237 = load i32, i32* %10
%238 = sdiv i32 %237, 2
store i32 %238, i32* %10
br label %193
239: ; preds = %193
%240 = load i32, i32* %11
%241 = sext i32 %240 to i64
%242 = inttoptr i64 %241 to i8*
%243 = call i32 @free(i8* %242)
%244 = load i32, i32* %12
%245 = sext i32 %244 to i64
%246 = inttoptr i64 %245 to i8*
%247 = call i32 @free(i8* %246)
br label %248
248: ; preds = %239, %136, %115
%249 = load i32, i32* %3
ret i32 %249
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s: insufficient memory\0A\00"
@.str.1 = [24 x i8] c"%s: insuficient memory\0A\00"
@.str.3 = [19 x i8] c"Src Buffer 0x%08x\0A\00"
@.str.4 = [20 x i8] c"Dst Buffer 0x%08x\0A\0A\00"
@.str.5 = [11 x i8] c"%10s %10s\0A\00"
@.str.6 = [7 x i8] c"Cached\00"
@.str.7 = [10 x i8] c"Bandwidth\00"
@.str.8 = [9 x i8] c"(KBytes)\00"
@.str.9 = [9 x i8] c"(MB/sec)\00"
@.str.10 = [5 x i8] c"%10d\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.11 = [9 x i8] c" %10.0f\0A\00"
@str = [19 x i8] c"\0AMEMCPY Benchmark\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %55
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = mul nsw i32 %7, 1000
%9 = icmp slt i32 %7, 1
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = load i8*, i8** %1
%12 = tail call i32 @help(i8* %11)
br label %13
13: ; preds = %4, %10
%14 = icmp ugt i32 %0, 2
br i1 %14, label %15, label %55
15: ; preds = %13
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = shl nsw i32 %18, 10
%20 = icmp slt i32 %18, 1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8*, i8** %1
%23 = tail call i32 @help(i8* %22)
br label %24
24: ; preds = %15, %21
%25 = icmp ugt i32 %0, 3
br i1 %25, label %26, label %55
26: ; preds = %24
%27 = getelementptr inbounds i8*, i8** %1, i64 3
%28 = load i8*, i8** %27
%29 = tail call i32 @atoi(i8* %28)
%30 = shl nsw i32 %29, 10
%31 = icmp slt i32 %30, %19
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i8*, i8** %1
%34 = tail call i32 @help(i8* %33)
br label %35
35: ; preds = %26, %32
%36 = icmp ugt i32 %0, 4
br i1 %36, label %37, label %55
37: ; preds = %35
%38 = getelementptr inbounds i8*, i8** %1, i64 4
%39 = load i8*, i8** %38
%40 = tail call i32 @atoi(i8* %39)
%41 = icmp ugt i32 %40, 4096
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = load i8*, i8** %1
%44 = tail call i32 @help(i8* %43)
br label %45
45: ; preds = %42, %37
%46 = icmp ugt i32 %0, 5
br i1 %46, label %47, label %55
47: ; preds = %45
%48 = getelementptr inbounds i8*, i8** %1, i64 5
%49 = load i8*, i8** %48
%50 = tail call i32 @atoi(i8* %49)
%51 = icmp ugt i32 %50, 4096
br i1 %51, label %52, label %55
52: ; preds = %47
%53 = load i8*, i8** %1
%54 = tail call i32 @help(i8* %53)
br label %55
55: ; preds = %2, %13, %24, %35, %52, %47, %45
%56 = phi i32 [ %40, %52 ], [ %40, %47 ], [ %40, %45 ], [ 4096, %35 ], [ 4096, %24 ], [ 4096, %13 ], [ 4096, %2 ]
%57 = phi i32 [ %19, %52 ], [ %19, %47 ], [ %19, %45 ], [ %19, %35 ], [ %19, %24 ], [ 2048, %13 ], [ 2048, %2 ]
%58 = phi i32 [ %8, %52 ], [ %8, %47 ], [ %8, %45 ], [ %8, %35 ], [ %8, %24 ], [ %8, %13 ], [ 200000, %2 ]
%59 = phi i32 [ %30, %52 ], [ %30, %47 ], [ %30, %45 ], [ %30, %35 ], [ 1048576, %24 ], [ 1048576, %13 ], [ 1048576, %2 ]
%60 = phi i32 [ %50, %52 ], [ %50, %47 ], [ 4096, %45 ], [ 4096, %35 ], [ 4096, %24 ], [ 4096, %13 ], [ 4096, %2 ]
%61 = add i32 %59, 4096
%62 = add i32 %61, %56
%63 = tail call i64 @malloc(i32 %62)
%64 = trunc i64 %63 to i32
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %55
%67 = load i8*, i8** %1
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %67)
br label %141
69: ; preds = %55
%70 = shl i64 %63, 32
%71 = ashr exact i64 %70, 32
%72 = inttoptr i64 %71 to i8*
%73 = tail call i32 @memset(i8* %72, i32 170, i32 %62)
%74 = add i32 %61, %60
%75 = tail call i64 @malloc(i32 %74)
%76 = trunc i64 %75 to i32
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %82
78: ; preds = %69
%79 = tail call i32 @free(i8* %72)
%80 = load i8*, i8** %1
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %80)
br label %141
82: ; preds = %69
%83 = shl i64 %75, 32
%84 = ashr exact i64 %83, 32
%85 = inttoptr i64 %84 to i8*
%86 = tail call i32 @memset(i8* %85, i32 85, i32 %74)
%87 = srem i32 %64, 4096
%88 = icmp eq i32 %87, 0
%89 = add nsw i32 %64, 4096
%90 = sub i32 %89, %87
%91 = select i1 %88, i32 %64, i32 %90
%92 = add nsw i32 %91, %56
%93 = srem i32 %76, 4096
%94 = icmp eq i32 %93, 0
%95 = add nsw i32 %76, 4096
%96 = sub i32 %95, %93
%97 = select i1 %94, i32 %76, i32 %96
%98 = add nsw i32 %97, %60
%99 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %92)
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i32 %98)
%102 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
%104 = icmp sgt i32 %57, %59
br i1 %104, label %138, label %105
105: ; preds = %82
%106 = sext i32 %98 to i64
%107 = inttoptr i64 %106 to i8*
%108 = sext i32 %92 to i64
%109 = inttoptr i64 %108 to i8*
br label %110
110: ; preds = %105, %122
%111 = phi i32 [ %57, %105 ], [ %135, %122 ]
%112 = phi i32 [ %58, %105 ], [ %136, %122 ]
%113 = sdiv i32 %111, 1024
%114 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i32 %113)
%115 = tail call float (...) @clock()
%116 = icmp sgt i32 %112, 0
br i1 %116, label %117, label %122
117: ; preds = %110, %117
%118 = phi i32 [ %120, %117 ], [ 0, %110 ]
%119 = tail call i32 @memcpy(i8* %107, i8* %109, i32 %111)
%120 = add nuw nsw i32 %118, 1
%121 = icmp eq i32 %120, %112
br i1 %121, label %122, label %117
122: ; preds = %117, %110
%123 = tail call float (...) @clock()
%124 = fsub float %123, %115
%125 = load float, float* @CLOCKS_PER_SEC
%126 = fdiv float %124, %125
%127 = sitofp i32 %111 to float
%128 = sitofp i32 %112 to float
%129 = fmul float %128, %127
%130 = fmul float %129, 2.000000e+00
%131 = fdiv float %130, %126
%132 = fmul float %131, 0x3EB0000000000000
%133 = fpext float %132 to double
%134 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %133)
%135 = shl nsw i32 %111, 1
%136 = sdiv i32 %112, 2
%137 = icmp sgt i32 %135, %59
br i1 %137, label %138, label %110
138: ; preds = %122, %82
%139 = tail call i32 @free(i8* %72)
%140 = tail call i32 @free(i8* %85)
br label %141
141: ; preds = %138, %78, %66
%142 = phi i32 [ -1, %66 ], [ -1, %78 ], [ 0, %138 ]
ret i32 %142
}