#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*/ strfree(char *);
scalar_t__ strgrow(char *, char *);
scalar_t__ strsave(char *);
int system(char *);
int file_copy(char *from, char *to) {
  char *cmd = (char *)strsave("cp \"");
  int i;
  ;
  cmd = (char *)strgrow(cmd, from);
  cmd = (char *)strgrow(cmd, "\" \"");
  cmd = (char *)strgrow(cmd, to);
  cmd = (char *)strgrow(cmd, "\"");
  i = system(cmd);
  strfree(cmd);
  return i;
}


x86 assembly (clang, -O0):
<file_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea9(%rip),%rdi
call   1060 <strsave@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strgrow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1040 <strgrow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strgrow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strgrow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strfree@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeaf(%rip),%rdi
call   1060 <strsave@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <strgrow@plt>
lea    0xe9d(%rip),%rsi
mov    %rax,%rdi
call   1040 <strgrow@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strgrow@plt>
lea    0xe85(%rip),%rsi
mov    %rax,%rdi
call   1040 <strgrow@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <system@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strfree@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"cp \22\00"
@.str.1 = [4 x i8] c"\22 \22\00"
@.str.2 = [2 x i8] c"\22\00"
define i32 @file_copy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = call i64 @strsave(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = call i64 @strgrow(i8* %9, i8* %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = call i64 @strgrow(i8* %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %5
%16 = load i8*, i8** %5
%17 = load i8*, i8** %4
%18 = call i64 @strgrow(i8* %16, i8* %17)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = call i64 @strgrow(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %5
%23 = load i8*, i8** %5
%24 = call i32 @system(i8* %23)
store i32 %24, i32* %6
%25 = load i8*, i8** %5
%26 = call i32 @strfree(i8* %25)
%27 = load i32, i32* %6
ret i32 %27
}

LLVM IR (-O2):
@.str = [5 x i8] c"cp \22\00"
@.str.1 = [4 x i8] c"\22 \22\00"
@.str.2 = [2 x i8] c"\22\00"
define i32 @file_copy(i8* %0, i8* %1) {
%3 = tail call i64 @strsave(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @strgrow(i8* %4, i8* %0)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i64 @strgrow(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @strgrow(i8* %8, i8* %1)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i64 @strgrow(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = inttoptr i64 %11 to i8*
%13 = tail call i32 @system(i8* %12)
%14 = tail call i32 @strfree(i8* %12)
ret i32 %13
}