#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 */
struct tms {
  int dummy;
};
struct stat {
  int st_size;
};
typedef double clock_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ _SC_CLK_TCK;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ cp_map(int, int, int);
int /*<<< orphan*/ cp_rw(int, int, char *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fstat(int, struct stat *);
int lseek(int, int, int /*<<< orphan*/);
int open(char *, int, ...);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
int sysconf(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
double times(struct tms *);
int write(int, char *, int);
int main(int argc, char **argv) {
  char buf[8192];
  int srcfd, dstfd;
  clock_t start, end;
  struct tms stm, ntm;
  struct stat filestat;
  int tck;
  char cmdline[30];
  if (argc != 3) {
    printf("usage: cmd <src> <dst>");
    exit(20);
  }
  tck = sysconf(_SC_CLK_TCK);
  start = times(&stm);
  if ((srcfd = open(argv[1], O_RDONLY)) == -1) {
    printf("open %s error", argv[1]);
    printf(":%s\n", strerror(errno));
    exit(0);
  }
  if ((dstfd = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) {
    printf("creat %s error", argv[2]);
    printf(":%s\n", strerror(errno));
    exit(0);
  }
  fstat(srcfd, &filestat);
  if (lseek(dstfd, filestat.st_size, SEEK_SET) == -1) {
    printf("lseek error");
    printf(":%s\n", strerror(errno));
    exit(0);
  }
  if (write(dstfd, " ", 1) != 1) {
    printf("write error");
    printf(":%s\n", strerror(errno));
    exit(0);
  }
  cp_map(srcfd, dstfd, filestat.st_size);
  close(srcfd);
  close(dstfd);
  end = times(&ntm);
  printf("copying %s to %s using cp_map:filesize=%lu MBytes Using %f seconds\n",
         argv[1], argv[2], filestat.st_size >> 20, (end - start) / (double)tck);
  sprintf(cmdline, "rm -f %s", argv[2]);
  system(cmdline);
  start = times(&stm);
  if ((srcfd = open(argv[1], O_RDONLY)) == -1) {
    printf("open %s error", argv[1]);
    printf(":%s\n", strerror(errno));
  }
  if ((dstfd = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) {
    printf("creat %s error", argv[2]);
    printf(":%s\n", strerror(errno));
  }
  cp_rw(srcfd, dstfd, buf, sizeof(buf));
  fstat(srcfd, &filestat);
  close(srcfd);
  close(dstfd);
  end = times(&ntm);
  printf("copying %s to %s using cp_rw:filesize=%lu MBytes Using %f seconds\n",
         argv[1], argv[2], filestat.st_size >> 20, (end - start) / (double)tck);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2070,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     121b <main+0x3b>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x14,%edi
call   10e0 <exit@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
call   10b0 <sysconf@plt>
mov    %eax,-0x2044(%rbp)
lea    -0x2030(%rbp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,-0x2020(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x2014(%rbp)
cmp    $0xffffffff,%eax
jne    12a6 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d23(%rip),%rax
mov    (%rax),%esi
mov    0x2d3a(%rip),%rax
or     (%rax),%esi
mov    0x2d29(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x2018(%rbp)
cmp    $0xffffffff,%eax
jne    1320 <main+0x140>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x2014(%rbp),%edi
lea    -0x2040(%rbp),%rsi
call   1100 <fstat@plt>
mov    -0x2018(%rbp),%edi
mov    -0x2040(%rbp),%esi
mov    0x2c6b(%rip),%rax
mov    (%rax),%edx
call   1060 <lseek@plt>
cmp    $0xffffffff,%eax
jne    1389 <main+0x1a9>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c4e(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x2018(%rbp),%edi
lea    0xcaf(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     13dd <main+0x1fd>
lea    0xc97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xc56(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x2014(%rbp),%edi
mov    -0x2018(%rbp),%esi
mov    -0x2040(%rbp),%edx
call   1080 <cp_map@plt>
mov    -0x2014(%rbp),%edi
call   1070 <close@plt>
mov    -0x2018(%rbp),%edi
call   1070 <close@plt>
lea    -0x2038(%rbp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,-0x2028(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x2040(%rbp),%ecx
sar    $0x14,%ecx
movsd  -0x2028(%rbp),%xmm0
ff
subsd  -0x2020(%rbp),%xmm0
ff
cvtsi2sdl -0x2044(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
lea    0xbf9(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x2070(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xc20(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0x2070(%rbp),%rdi
call   1040 <system@plt>
lea    -0x2030(%rbp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,-0x2020(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2b25(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x2014(%rbp)
cmp    $0xffffffff,%eax
jne    14f8 <main+0x318>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xb45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2ad8(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xb34(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2ad1(%rip),%rax
mov    (%rax),%esi
mov    0x2ae8(%rip),%rax
or     (%rax),%esi
mov    0x2ad7(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
mov    $0x0,%al
call   1090 <open@plt>
mov    %eax,-0x2018(%rbp)
cmp    $0xffffffff,%eax
jne    156b <main+0x38b>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xae5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2a65(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    %rax,%rsi
lea    0xac1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x2014(%rbp),%edi
mov    -0x2018(%rbp),%esi
lea    -0x2010(%rbp),%rdx
mov    $0x2000,%ecx
call   10c0 <cp_rw@plt>
mov    -0x2014(%rbp),%edi
lea    -0x2040(%rbp),%rsi
call   1100 <fstat@plt>
mov    -0x2014(%rbp),%edi
call   1070 <close@plt>
mov    -0x2018(%rbp),%edi
call   1070 <close@plt>
lea    -0x2038(%rbp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,-0x2028(%rbp)
ff
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x2040(%rbp),%ecx
sar    $0x14,%ecx
movsd  -0x2028(%rbp),%xmm0
ff
subsd  -0x2020(%rbp),%xmm0
ff
cvtsi2sdl -0x2044(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
lea    0xaa0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x2070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2058,%rsp
cmp    $0x3,%edi
jne    1461 <main+0x281>
mov    %rsi,%r15
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
call   10b0 <sysconf@plt>
mov    %eax,%r14d
lea    0x20(%rsp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x8(%r15),%rdi
mov    0x2da7(%rip),%r13
mov    0x0(%r13),%esi
xor    %eax,%eax
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1479 <main+0x299>
mov    %eax,%r12d
mov    0x2d91(%rip),%rax
mov    0x2daa(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x10(%r15),%rdi
mov    0x2d93(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
xor    %eax,%eax
call   1090 <open@plt>
cmp    $0xffffffff,%eax
je     1486 <main+0x2a6>
mov    %eax,%ebp
lea    0x8(%rsp),%rsi
mov    %r12d,%edi
call   1100 <fstat@plt>
mov    0x8(%rsp),%ebx
mov    0x2d22(%rip),%rax
mov    (%rax),%edx
mov    %ebp,%edi
mov    %ebx,%esi
call   1060 <lseek@plt>
cmp    $0xffffffff,%eax
je     149a <main+0x2ba>
lea    0xd9c(%rip),%rsi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
jne    14a3 <main+0x2c3>
mov    %r12d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1080 <cp_map@plt>
mov    %r12d,%edi
call   1070 <close@plt>
mov    %ebp,%edi
call   1070 <close@plt>
lea    0x18(%rsp),%rdi
call   10a0 <times@plt>
mov    0x8(%r15),%rsi
mov    0x10(%r15),%rdx
sar    $0x14,%ebx
subsd  0x10(%rsp),%xmm0
cvtsi2sd %r14d,%xmm1
movsd  %xmm1,0x10(%rsp)
divsd  %xmm1,%xmm0
lea    0xd49(%rip),%rdi
mov    %ebx,%ecx
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x10(%r15),%rdx
lea    0xd79(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
call   10d0 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0x20(%rsp),%rdi
call   10a0 <times@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x8(%r15),%rdi
mov    0x0(%r13),%esi
xor    %eax,%eax
call   1090 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    138a <main+0x1aa>
mov    0x8(%r15),%rsi
lea    0xcb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c46(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xca5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%r15),%rdi
mov    0x2c63(%rip),%rax
mov    (%rax),%esi
mov    0x2c3a(%rip),%rax
or     (%rax),%esi
mov    0x2c49(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
xor    %eax,%eax
call   1090 <open@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    13ed <main+0x20d>
mov    0x10(%r15),%rsi
lea    0xc63(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2be3(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc42(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x50(%rsp),%rdx
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x2000,%ecx
call   10c0 <cp_rw@plt>
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
call   1100 <fstat@plt>
mov    %ebp,%edi
call   1070 <close@plt>
mov    %ebx,%edi
call   1070 <close@plt>
lea    0x18(%rsp),%rdi
call   10a0 <times@plt>
mov    0x8(%r15),%rsi
mov    0x10(%r15),%rdx
mov    0x8(%rsp),%ecx
sar    $0x14,%ecx
subsd  0x28(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
lea    0xc5a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x2058,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x14,%edi
call   10e0 <exit@plt>
mov    0x8(%r15),%rsi
lea    0xb93(%rip),%rdi
jmp    1491 <main+0x2b1>
mov    0x10(%r15),%rsi
lea    0xb99(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    14b1 <main+0x2d1>
lea    0xb98(%rip),%rdi
jmp    14aa <main+0x2ca>
lea    0xb9d(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2b00(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xb5f(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.tms = type { i32 }
%struct.stat = type { i32 }
@.str = [23 x i8] c"usage: cmd <src> <dst>\00"
@_SC_CLK_TCK = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [14 x i8] c"open %s error\00"
@.str.2 = [5 x i8] c":%s\0A\00"
@errno = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [15 x i8] c"creat %s error\00"
@SEEK_SET = global i32 0
@.str.4 = [12 x i8] c"lseek error\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [12 x i8] c"write error\00"
@.str.7 = [68 x i8] c"copying %s to %s using cp_map:filesize=%lu MBytes Using %f seconds\0A\00"
@.str.8 = [9 x i8] c"rm -f %s\00"
@.str.9 = [67 x i8] c"copying %s to %s using cp_rw:filesize=%lu MBytes Using %f seconds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [8192 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca %struct.tms
%12 = alloca %struct.tms
%13 = alloca %struct.stat
%14 = alloca i32
%15 = alloca [30 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 3
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 20)
unreachable
21: ; preds = %2
%22 = load i32, i32* @_SC_CLK_TCK
%23 = call i32 @sysconf(i32 %22)
store i32 %23, i32* %14
%24 = call double @times(%struct.tms* %11)
store double %24, double* %9
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = load i32, i32* @O_RDONLY
%29 = call i32 (i8*, i32, ...) @open(i8* %27, i32 %28)
store i32 %29, i32* %7
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %40
31: ; preds = %21
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %37)
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %21
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = load i32, i32* @O_RDWR
%45 = load i32, i32* @O_CREAT
%46 = or i32 %44, %45
%47 = load i32, i32* @O_TRUNC
%48 = or i32 %46, %47
%49 = call i32 (i8*, i32, ...) @open(i8* %43, i32 %48, i32 438)
store i32 %49, i32* %8
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %60
51: ; preds = %40
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %54)
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 0)
unreachable
60: ; preds = %40
%61 = load i32, i32* %7
%62 = call i32 @fstat(i32 %61, %struct.stat* %13)
%63 = load i32, i32* %8
%64 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%65 = load i32, i32* %64
%66 = load i32, i32* @SEEK_SET
%67 = call i32 @lseek(i32 %63, i32 %65, i32 %66)
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %75
69: ; preds = %60
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%71 = load i32, i32* @errno
%72 = call i8* @strerror(i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %72)
%74 = call i32 @exit(i32 0)
unreachable
75: ; preds = %60
%76 = load i32, i32* %8
%77 = call i32 @write(i32 %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%78 = icmp ne i32 %77, 1
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%81 = load i32, i32* @errno
%82 = call i8* @strerror(i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %82)
%84 = call i32 @exit(i32 0)
unreachable
85: ; preds = %75
%86 = load i32, i32* %7
%87 = load i32, i32* %8
%88 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%89 = load i32, i32* %88
%90 = call i32 @cp_map(i32 %86, i32 %87, i32 %89)
%91 = load i32, i32* %7
%92 = call i32 @close(i32 %91)
%93 = load i32, i32* %8
%94 = call i32 @close(i32 %93)
%95 = call double @times(%struct.tms* %12)
store double %95, double* %10
%96 = load i8**, i8*** %5
%97 = getelementptr inbounds i8*, i8** %96, i64 1
%98 = load i8*, i8** %97
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 2
%101 = load i8*, i8** %100
%102 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%103 = load i32, i32* %102
%104 = ashr i32 %103, 20
%105 = load double, double* %10
%106 = load double, double* %9
%107 = fsub double %105, %106
%108 = load i32, i32* %14
%109 = sitofp i32 %108 to double
%110 = fdiv double %107, %109
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.7, i64 0, i64 0), i8* %98, i8* %101, i32 %104, double %110)
%112 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 2
%115 = load i8*, i8** %114
%116 = call i32 @sprintf(i8* %112, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* %115)
%117 = getelementptr inbounds [30 x i8], [30 x i8]* %15, i64 0, i64 0
%118 = call i32 @system(i8* %117)
%119 = call double @times(%struct.tms* %11)
store double %119, double* %9
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 1
%122 = load i8*, i8** %121
%123 = load i32, i32* @O_RDONLY
%124 = call i32 (i8*, i32, ...) @open(i8* %122, i32 %123)
store i32 %124, i32* %7
%125 = icmp eq i32 %124, -1
br i1 %125, label %126, label %134
126: ; preds = %85
%127 = load i8**, i8*** %5
%128 = getelementptr inbounds i8*, i8** %127, i64 1
%129 = load i8*, i8** %128
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %129)
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %132)
br label %134
134: ; preds = %126, %85
%135 = load i8**, i8*** %5
%136 = getelementptr inbounds i8*, i8** %135, i64 2
%137 = load i8*, i8** %136
%138 = load i32, i32* @O_RDWR
%139 = load i32, i32* @O_CREAT
%140 = or i32 %138, %139
%141 = load i32, i32* @O_TRUNC
%142 = or i32 %140, %141
%143 = call i32 (i8*, i32, ...) @open(i8* %137, i32 %142, i32 438)
store i32 %143, i32* %8
%144 = icmp eq i32 %143, -1
br i1 %144, label %145, label %153
145: ; preds = %134
%146 = load i8**, i8*** %5
%147 = getelementptr inbounds i8*, i8** %146, i64 2
%148 = load i8*, i8** %147
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %148)
%150 = load i32, i32* @errno
%151 = call i8* @strerror(i32 %150)
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %151)
br label %153
153: ; preds = %145, %134
%154 = load i32, i32* %7
%155 = load i32, i32* %8
%156 = getelementptr inbounds [8192 x i8], [8192 x i8]* %6, i64 0, i64 0
%157 = call i32 @cp_rw(i32 %154, i32 %155, i8* %156, i32 8192)
%158 = load i32, i32* %7
%159 = call i32 @fstat(i32 %158, %struct.stat* %13)
%160 = load i32, i32* %7
%161 = call i32 @close(i32 %160)
%162 = load i32, i32* %8
%163 = call i32 @close(i32 %162)
%164 = call double @times(%struct.tms* %12)
store double %164, double* %10
%165 = load i8**, i8*** %5
%166 = getelementptr inbounds i8*, i8** %165, i64 1
%167 = load i8*, i8** %166
%168 = load i8**, i8*** %5
%169 = getelementptr inbounds i8*, i8** %168, i64 2
%170 = load i8*, i8** %169
%171 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 0
%172 = load i32, i32* %171
%173 = ashr i32 %172, 20
%174 = load double, double* %10
%175 = load double, double* %9
%176 = fsub double %174, %175
%177 = load i32, i32* %14
%178 = sitofp i32 %177 to double
%179 = fdiv double %176, %178
%180 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.9, i64 0, i64 0), i8* %167, i8* %170, i32 %173, double %179)
ret i32 0
}

LLVM IR (-O2):
%struct.tms = type { i32 }
%struct.stat = type { i32 }
@.str = [23 x i8] c"usage: cmd <src> <dst>\00"
@_SC_CLK_TCK = global i32 0
@O_RDONLY = global i32 0
@.str.1 = [14 x i8] c"open %s error\00"
@.str.2 = [5 x i8] c":%s\0A\00"
@errno = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@.str.3 = [15 x i8] c"creat %s error\00"
@SEEK_SET = global i32 0
@.str.4 = [12 x i8] c"lseek error\00"
@.str.5 = [2 x i8] c" \00"
@.str.6 = [12 x i8] c"write error\00"
@.str.7 = [68 x i8] c"copying %s to %s using cp_map:filesize=%lu MBytes Using %f seconds\0A\00"
@.str.8 = [9 x i8] c"rm -f %s\00"
@.str.9 = [67 x i8] c"copying %s to %s using cp_rw:filesize=%lu MBytes Using %f seconds\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [8192 x i8]
%4 = alloca %struct.tms
%5 = alloca %struct.tms
%6 = alloca %struct.stat
%7 = alloca [30 x i8]
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%9 = bitcast %struct.tms* %4 to i8*
%10 = bitcast %struct.tms* %5 to i8*
%11 = bitcast %struct.stat* %6 to i8*
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%13 = icmp eq i32 %0, 3
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 20)
unreachable
17: ; preds = %2
%18 = load i32, i32* @_SC_CLK_TCK
%19 = tail call i32 @sysconf(i32 %18)
%20 = call double @times(%struct.tms* %4)
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = load i32, i32* @O_RDONLY
%24 = tail call i32 (i8*, i32, ...) @open(i8* %22, i32 %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %33
26: ; preds = %17
%27 = load i8*, i8** %21
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @errno
%30 = tail call i8* @strerror(i32 %29)
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = tail call i32 @exit(i32 0)
unreachable
33: ; preds = %17
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = load i32, i32* @O_RDWR
%37 = load i32, i32* @O_CREAT
%38 = or i32 %37, %36
%39 = load i32, i32* @O_TRUNC
%40 = or i32 %38, %39
%41 = tail call i32 (i8*, i32, ...) @open(i8* %35, i32 %40, i32 438)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %50
43: ; preds = %33
%44 = load i8*, i8** %34
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @errno
%47 = tail call i8* @strerror(i32 %46)
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = tail call i32 @exit(i32 0)
unreachable
50: ; preds = %33
%51 = call i32 @fstat(i32 %24, %struct.stat* %6)
%52 = getelementptr inbounds %struct.stat, %struct.stat* %6, i64 0, i32 0
%53 = load i32, i32* %52
%54 = load i32, i32* @SEEK_SET
%55 = tail call i32 @lseek(i32 %41, i32 %53, i32 %54)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %63
57: ; preds = %50
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%59 = load i32, i32* @errno
%60 = tail call i8* @strerror(i32 %59)
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %60)
%62 = tail call i32 @exit(i32 0)
unreachable
63: ; preds = %50
%64 = tail call i32 @write(i32 %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%65 = icmp eq i32 %64, 1
br i1 %65, label %72, label %66
66: ; preds = %63
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%68 = load i32, i32* @errno
%69 = tail call i8* @strerror(i32 %68)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %69)
%71 = tail call i32 @exit(i32 0)
unreachable
72: ; preds = %63
%73 = tail call i32 @cp_map(i32 %24, i32 %41, i32 %53)
%74 = tail call i32 @close(i32 %24)
%75 = tail call i32 @close(i32 %41)
%76 = call double @times(%struct.tms* %5)
%77 = load i8*, i8** %21
%78 = load i8*, i8** %34
%79 = ashr i32 %53, 20
%80 = fsub double %76, %20
%81 = sitofp i32 %19 to double
%82 = fdiv double %80, %81
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.7, i64 0, i64 0), i8* %77, i8* %78, i32 %79, double %82)
%84 = load i8*, i8** %34
%85 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* %84)
%86 = call i32 @system(i8* %12)
%87 = call double @times(%struct.tms* %4)
%88 = load i8*, i8** %21
%89 = load i32, i32* @O_RDONLY
%90 = tail call i32 (i8*, i32, ...) @open(i8* %88, i32 %89)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %98
92: ; preds = %72
%93 = load i8*, i8** %21
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %93)
%95 = load i32, i32* @errno
%96 = tail call i8* @strerror(i32 %95)
%97 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %96)
br label %98
98: ; preds = %92, %72
%99 = load i8*, i8** %34
%100 = load i32, i32* @O_RDWR
%101 = load i32, i32* @O_CREAT
%102 = or i32 %101, %100
%103 = load i32, i32* @O_TRUNC
%104 = or i32 %102, %103
%105 = tail call i32 (i8*, i32, ...) @open(i8* %99, i32 %104, i32 438)
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %113
107: ; preds = %98
%108 = load i8*, i8** %34
%109 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %108)
%110 = load i32, i32* @errno
%111 = tail call i8* @strerror(i32 %110)
%112 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %111)
br label %113
113: ; preds = %107, %98
%114 = call i32 @cp_rw(i32 %90, i32 %105, i8* %8, i32 8192)
%115 = call i32 @fstat(i32 %90, %struct.stat* %6)
%116 = call i32 @close(i32 %90)
%117 = call i32 @close(i32 %105)
%118 = call double @times(%struct.tms* %5)
%119 = load i8*, i8** %21
%120 = load i8*, i8** %34
%121 = load i32, i32* %52
%122 = ashr i32 %121, 20
%123 = fsub double %118, %87
%124 = fdiv double %123, %81
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.9, i64 0, i64 0), i8* %119, i8* %120, i32 %122, double %124)
ret i32 0
}