#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ bench_a_copy(size_t, size_t, int /*<<< orphan*/ *);
void _bench_copy(FILE *outf) {
  size_t accesses_per_tree = 30000;
  for (size_t i = 400; i < 2000; i += 200) {
    for (size_t j = 0; j < 2; j++) {
      bench_a_copy(i, accesses_per_tree, outf);
    }
  }
  accesses_per_tree = 30000;
  for (size_t i = 2000; i < 20000; i += 1000) {
    for (size_t j = 0; j < 2; j++) {
      bench_a_copy(i, accesses_per_tree, outf);
    }
  }
  accesses_per_tree = 100000;
  for (size_t i = 20000; i < 100000; i += 5000) {
    for (size_t j = 0; j < 2; j++) {
      bench_a_copy(i, accesses_per_tree, outf);
    }
  }
  accesses_per_tree = 200000;
  for (size_t i = 100000; i <= 400000; i += 10000) {
    for (size_t j = 0; j < 2; j++) {
      bench_a_copy(i, accesses_per_tree, outf);
    }
  }
}


x86 assembly (clang, -O0):
<_bench_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x7530,-0x10(%rbp)
movq   $0x190,-0x18(%rbp)
cmpq   $0x7d0,-0x18(%rbp)
jae    1187 <_bench_copy+0x77>
movq   $0x0,-0x20(%rbp)
cmpq   $0x2,-0x20(%rbp)
jae    116f <_bench_copy+0x5f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <bench_a_copy@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1142 <_bench_copy+0x32>
jmp    1174 <_bench_copy+0x64>
mov    -0x18(%rbp),%rax
add    $0xc8,%rax
mov    %rax,-0x18(%rbp)
jmp    112c <_bench_copy+0x1c>
movq   $0x7530,-0x10(%rbp)
movq   $0x7d0,-0x28(%rbp)
cmpq   $0x4e20,-0x28(%rbp)
jae    11f2 <_bench_copy+0xe2>
movq   $0x0,-0x30(%rbp)
cmpq   $0x2,-0x30(%rbp)
jae    11da <_bench_copy+0xca>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <bench_a_copy@plt>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11ad <_bench_copy+0x9d>
jmp    11df <_bench_copy+0xcf>
mov    -0x28(%rbp),%rax
add    $0x3e8,%rax
mov    %rax,-0x28(%rbp)
jmp    1197 <_bench_copy+0x87>
movq   $0x186a0,-0x10(%rbp)
movq   $0x4e20,-0x38(%rbp)
cmpq   $0x186a0,-0x38(%rbp)
jae    125d <_bench_copy+0x14d>
movq   $0x0,-0x40(%rbp)
cmpq   $0x2,-0x40(%rbp)
jae    1245 <_bench_copy+0x135>
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <bench_a_copy@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1218 <_bench_copy+0x108>
jmp    124a <_bench_copy+0x13a>
mov    -0x38(%rbp),%rax
add    $0x1388,%rax
mov    %rax,-0x38(%rbp)
jmp    1202 <_bench_copy+0xf2>
movq   $0x30d40,-0x10(%rbp)
movq   $0x186a0,-0x48(%rbp)
cmpq   $0x61a80,-0x48(%rbp)
ja     12c8 <_bench_copy+0x1b8>
movq   $0x0,-0x50(%rbp)
cmpq   $0x2,-0x50(%rbp)
jae    12b0 <_bench_copy+0x1a0>
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1030 <bench_a_copy@plt>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1283 <_bench_copy+0x173>
jmp    12b5 <_bench_copy+0x1a5>
mov    -0x48(%rbp),%rax
add    $0x2710,%rax
mov    %rax,-0x48(%rbp)
jmp    126d <_bench_copy+0x15d>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bench_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x190,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x190,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x258,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x258,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x320,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x320,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x3e8,%ebx
mov    $0x3e8,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x3e8,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x4b0,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x4b0,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x578,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x578,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x640,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x640,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x708,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x708,%edi
mov    $0x7530,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
nopl   0x0(%rax)
add    $0x3e8,%rbx
mov    $0x7530,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x7530,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
cmp    $0x4a38,%rbx
jb     1240 <_bench_copy+0x130>
mov    $0x4e20,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x4e20,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x61a8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x61a8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x7530,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x7530,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x88b8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x88b8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x9c40,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x9c40,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xafc8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xafc8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xc350,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xc350,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xd6d8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xd6d8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xea60,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xea60,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xfde8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0xfde8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x11170,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x11170,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x124f8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x124f8,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x13880,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x13880,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x14c08,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x14c08,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x15f90,%ebx
mov    $0x15f90,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x15f90,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x17318,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x17318,%edi
mov    $0x186a0,%esi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x2710,%rbx
mov    $0x30d40,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
mov    $0x30d40,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1030 <bench_a_copy@plt>
cmp    $0x5f371,%rbx
jb     14c0 <_bench_copy+0x3b0>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @_bench_copy(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32* %0, i32** %2
store i64 30000, i64* %3
store i64 400, i64* %4
br label %12
12: ; preds = %28, %1
%13 = load i64, i64* %4
%14 = icmp ult i64 %13, 2000
br i1 %14, label %15, label %31
15: ; preds = %12
store i64 0, i64* %5
br label %16
16: ; preds = %24, %15
%17 = load i64, i64* %5
%18 = icmp ult i64 %17, 2
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i64, i64* %4
%21 = load i64, i64* %3
%22 = load i32*, i32** %2
%23 = call i32 @bench_a_copy(i64 %20, i64 %21, i32* %22)
br label %24
24: ; preds = %19
%25 = load i64, i64* %5
%26 = add i64 %25, 1
store i64 %26, i64* %5
br label %16
27: ; preds = %16
br label %28
28: ; preds = %27
%29 = load i64, i64* %4
%30 = add i64 %29, 200
store i64 %30, i64* %4
br label %12
31: ; preds = %12
store i64 30000, i64* %3
store i64 2000, i64* %6
br label %32
32: ; preds = %48, %31
%33 = load i64, i64* %6
%34 = icmp ult i64 %33, 20000
br i1 %34, label %35, label %51
35: ; preds = %32
store i64 0, i64* %7
br label %36
36: ; preds = %44, %35
%37 = load i64, i64* %7
%38 = icmp ult i64 %37, 2
br i1 %38, label %39, label %47
39: ; preds = %36
%40 = load i64, i64* %6
%41 = load i64, i64* %3
%42 = load i32*, i32** %2
%43 = call i32 @bench_a_copy(i64 %40, i64 %41, i32* %42)
br label %44
44: ; preds = %39
%45 = load i64, i64* %7
%46 = add i64 %45, 1
store i64 %46, i64* %7
br label %36
47: ; preds = %36
br label %48
48: ; preds = %47
%49 = load i64, i64* %6
%50 = add i64 %49, 1000
store i64 %50, i64* %6
br label %32
51: ; preds = %32
store i64 100000, i64* %3
store i64 20000, i64* %8
br label %52
52: ; preds = %68, %51
%53 = load i64, i64* %8
%54 = icmp ult i64 %53, 100000
br i1 %54, label %55, label %71
55: ; preds = %52
store i64 0, i64* %9
br label %56
56: ; preds = %64, %55
%57 = load i64, i64* %9
%58 = icmp ult i64 %57, 2
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i64, i64* %8
%61 = load i64, i64* %3
%62 = load i32*, i32** %2
%63 = call i32 @bench_a_copy(i64 %60, i64 %61, i32* %62)
br label %64
64: ; preds = %59
%65 = load i64, i64* %9
%66 = add i64 %65, 1
store i64 %66, i64* %9
br label %56
67: ; preds = %56
br label %68
68: ; preds = %67
%69 = load i64, i64* %8
%70 = add i64 %69, 5000
store i64 %70, i64* %8
br label %52
71: ; preds = %52
store i64 200000, i64* %3
store i64 100000, i64* %10
br label %72
72: ; preds = %88, %71
%73 = load i64, i64* %10
%74 = icmp ule i64 %73, 400000
br i1 %74, label %75, label %91
75: ; preds = %72
store i64 0, i64* %11
br label %76
76: ; preds = %84, %75
%77 = load i64, i64* %11
%78 = icmp ult i64 %77, 2
br i1 %78, label %79, label %87
79: ; preds = %76
%80 = load i64, i64* %10
%81 = load i64, i64* %3
%82 = load i32*, i32** %2
%83 = call i32 @bench_a_copy(i64 %80, i64 %81, i32* %82)
br label %84
84: ; preds = %79
%85 = load i64, i64* %11
%86 = add i64 %85, 1
store i64 %86, i64* %11
br label %76
87: ; preds = %76
br label %88
88: ; preds = %87
%89 = load i64, i64* %10
%90 = add i64 %89, 10000
store i64 %90, i64* %10
br label %72
91: ; preds = %72
ret void
}

LLVM IR (-O2):
define void @_bench_copy(i32* %0) {
%2 = tail call i32 @bench_a_copy(i64 400, i64 30000, i32* %0)
%3 = tail call i32 @bench_a_copy(i64 400, i64 30000, i32* %0)
%4 = tail call i32 @bench_a_copy(i64 600, i64 30000, i32* %0)
%5 = tail call i32 @bench_a_copy(i64 600, i64 30000, i32* %0)
%6 = tail call i32 @bench_a_copy(i64 800, i64 30000, i32* %0)
%7 = tail call i32 @bench_a_copy(i64 800, i64 30000, i32* %0)
%8 = tail call i32 @bench_a_copy(i64 1000, i64 30000, i32* %0)
%9 = tail call i32 @bench_a_copy(i64 1000, i64 30000, i32* %0)
%10 = tail call i32 @bench_a_copy(i64 1200, i64 30000, i32* %0)
%11 = tail call i32 @bench_a_copy(i64 1200, i64 30000, i32* %0)
%12 = tail call i32 @bench_a_copy(i64 1400, i64 30000, i32* %0)
%13 = tail call i32 @bench_a_copy(i64 1400, i64 30000, i32* %0)
%14 = tail call i32 @bench_a_copy(i64 1600, i64 30000, i32* %0)
%15 = tail call i32 @bench_a_copy(i64 1600, i64 30000, i32* %0)
%16 = tail call i32 @bench_a_copy(i64 1800, i64 30000, i32* %0)
%17 = tail call i32 @bench_a_copy(i64 1800, i64 30000, i32* %0)
br label %18
18: ; preds = %1, %18
%19 = phi i64 [ %22, %18 ], [ 2000, %1 ]
%20 = tail call i32 @bench_a_copy(i64 %19, i64 30000, i32* %0)
%21 = tail call i32 @bench_a_copy(i64 %19, i64 30000, i32* %0)
%22 = add nuw nsw i64 %19, 1000
%23 = icmp ult i64 %19, 19000
br i1 %23, label %18, label %24
24: ; preds = %18
%25 = tail call i32 @bench_a_copy(i64 20000, i64 100000, i32* %0)
%26 = tail call i32 @bench_a_copy(i64 20000, i64 100000, i32* %0)
%27 = tail call i32 @bench_a_copy(i64 25000, i64 100000, i32* %0)
%28 = tail call i32 @bench_a_copy(i64 25000, i64 100000, i32* %0)
%29 = tail call i32 @bench_a_copy(i64 30000, i64 100000, i32* %0)
%30 = tail call i32 @bench_a_copy(i64 30000, i64 100000, i32* %0)
%31 = tail call i32 @bench_a_copy(i64 35000, i64 100000, i32* %0)
%32 = tail call i32 @bench_a_copy(i64 35000, i64 100000, i32* %0)
%33 = tail call i32 @bench_a_copy(i64 40000, i64 100000, i32* %0)
%34 = tail call i32 @bench_a_copy(i64 40000, i64 100000, i32* %0)
%35 = tail call i32 @bench_a_copy(i64 45000, i64 100000, i32* %0)
%36 = tail call i32 @bench_a_copy(i64 45000, i64 100000, i32* %0)
%37 = tail call i32 @bench_a_copy(i64 50000, i64 100000, i32* %0)
%38 = tail call i32 @bench_a_copy(i64 50000, i64 100000, i32* %0)
%39 = tail call i32 @bench_a_copy(i64 55000, i64 100000, i32* %0)
%40 = tail call i32 @bench_a_copy(i64 55000, i64 100000, i32* %0)
%41 = tail call i32 @bench_a_copy(i64 60000, i64 100000, i32* %0)
%42 = tail call i32 @bench_a_copy(i64 60000, i64 100000, i32* %0)
%43 = tail call i32 @bench_a_copy(i64 65000, i64 100000, i32* %0)
%44 = tail call i32 @bench_a_copy(i64 65000, i64 100000, i32* %0)
%45 = tail call i32 @bench_a_copy(i64 70000, i64 100000, i32* %0)
%46 = tail call i32 @bench_a_copy(i64 70000, i64 100000, i32* %0)
%47 = tail call i32 @bench_a_copy(i64 75000, i64 100000, i32* %0)
%48 = tail call i32 @bench_a_copy(i64 75000, i64 100000, i32* %0)
%49 = tail call i32 @bench_a_copy(i64 80000, i64 100000, i32* %0)
%50 = tail call i32 @bench_a_copy(i64 80000, i64 100000, i32* %0)
%51 = tail call i32 @bench_a_copy(i64 85000, i64 100000, i32* %0)
%52 = tail call i32 @bench_a_copy(i64 85000, i64 100000, i32* %0)
%53 = tail call i32 @bench_a_copy(i64 90000, i64 100000, i32* %0)
%54 = tail call i32 @bench_a_copy(i64 90000, i64 100000, i32* %0)
%55 = tail call i32 @bench_a_copy(i64 95000, i64 100000, i32* %0)
%56 = tail call i32 @bench_a_copy(i64 95000, i64 100000, i32* %0)
br label %57
57: ; preds = %24, %57
%58 = phi i64 [ %61, %57 ], [ 100000, %24 ]
%59 = tail call i32 @bench_a_copy(i64 %58, i64 200000, i32* %0)
%60 = tail call i32 @bench_a_copy(i64 %58, i64 200000, i32* %0)
%61 = add nuw nsw i64 %58, 10000
%62 = icmp ult i64 %58, 390001
br i1 %62, label %57, label %63
63: ; preds = %57
ret void
}