void copyfile(pfile1, pfile2) char *pfile1, *pfile2;
{
  int ret;
  char *pcmd;
  int slen;
  slen = strlen(pfile1) + strlen(pfile2) + 8;
  pcmd = (char *)malloc(slen);
  ret = snprintf(pcmd, slen, "cp %s %s", pfile1, pfile2);
  ret = system(pcmd);
  ret = snprintf(pcmd, slen, "touch %s", pfile2);
  ret = system(pcmd);
}


x86 assembly (clang, -O0):
<copyfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    %rcx,%rax
add    $0x8,%rax
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rdi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rsi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe65(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe43(%rip),%rdx
mov    $0x0,%al
call   1050 <snprintf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyfile>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1030 <strlen@plt>
add    %r15d,%eax
add    $0x8,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe87(%rip),%rdx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1050 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <system@plt>
lea    0xe6c(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"cp %s %s\00"
@.str.1 = [9 x i8] c"touch %s\00"
define void @copyfile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = add i64 %9, %11
%13 = add i64 %12, 8
%14 = trunc i64 %13 to i32
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = call i8* @malloc(i64 %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = load i8*, i8** %3
%22 = load i8*, i8** %4
%23 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %18, i64 %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
store i32 %23, i32* %5
%24 = load i8*, i8** %6
%25 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %24)
store i32 %25, i32* %5
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = load i8*, i8** %4
%30 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %26, i64 %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %29)
store i32 %30, i32* %5
%31 = load i8*, i8** %6
%32 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %31)
store i32 %32, i32* %5
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"cp %s %s\00"
@.str.1 = [9 x i8] c"touch %s\00"
define void @copyfile(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %4, %3
%6 = shl i64 %5, 32
%7 = add i64 %6, 34359738368
%8 = ashr exact i64 %7, 32
%9 = tail call i8* @malloc(i64 %8)
%10 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* %9, i64 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
%12 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* %9, i64 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
ret void
}