void replace_plan(access_string, footer_file, header_file, home_directory,
                  plan_directory, plan_name, output_file) {
  char command_string[256 * 8];
  strcpy(command_string, "cat ");
  if (strcmp(header_file, "")) {
    strcat(command_string, header_file);
    strcat(command_string, " ");
  }
  if (strcmp(plan_name, "")) {
    strcat(command_string, plan_directory);
    strcat(command_string, "/");
    strcat(command_string, plan_name);
    strcat(command_string, " ");
  } else if (!strcmp(plan_name, "")) {
    strcat(command_string, "/dev/null ");
  }
  if (strcmp(footer_file, "")) {
    strcat(command_string, footer_file);
    strcat(command_string, " ");
  }
  strcat(command_string, "> ");
  strcat(command_string, output_file);
  strcat(command_string, " ; ");
  if (strcmp(access_string, "")) {
    strcpy(command_string, "chmod ");
    strcat(command_string, access_string);
    strcat(command_string, " ");
    strcat(command_string, output_file);
  }
  system(command_string);
}


x86 assembly (clang, -O0):
<replace_plan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
lea    -0x820(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1030 <strcpy@plt>
movslq -0xc(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     11b1 <replace_plan+0x71>
lea    -0x820(%rbp),%rdi
movslq -0xc(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1060 <strcat@plt>
movslq -0x18(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     1215 <replace_plan+0xd5>
lea    -0x820(%rbp),%rdi
movslq -0x14(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
movslq -0x18(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1060 <strcat@plt>
jmp    1246 <replace_plan+0x106>
movslq -0x18(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1241 <replace_plan+0x101>
lea    -0x820(%rbp),%rdi
lea    0xdcb(%rip),%rsi
call   1060 <strcat@plt>
jmp    1246 <replace_plan+0x106>
movslq -0x8(%rbp),%rdi
lea    0xdc7(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     1282 <replace_plan+0x142>
lea    -0x820(%rbp),%rdi
movslq -0x8(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xd82(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
movslq 0x10(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xd62(%rip),%rsi
call   1060 <strcat@plt>
movslq -0x4(%rbp),%rdi
lea    0xd55(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     1317 <replace_plan+0x1d7>
lea    -0x820(%rbp),%rdi
lea    0xd3a(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x820(%rbp),%rdi
movslq -0x4(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xd15(%rip),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
movslq 0x10(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x820(%rbp),%rdi
mov    $0x0,%al
call   1040 <system@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_plan>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %r9d,%ebp
mov    %r8d,%ebx
mov    %esi,%r15d
mov    %edi,%r14d
movb   $0x0,0x4(%rsp)
movl   $0x20746163,(%rsp)
movslq %edx,%rsi
cmpb   $0x0,(%rsi)
je     1178 <replace_plan+0x48>
mov    %rsp,%r12
mov    %r12,%rdi
call   1050 <strcat@plt>
mov    %r12,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rsp,%rax,1)
movslq %ebp,%rbp
cmpb   $0x0,0x0(%rbp)
je     11b8 <replace_plan+0x88>
movslq %ebx,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x2f,(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rsp,%rax,1)
jmp    11d6 <replace_plan+0xa6>
mov    %rsp,%rdi
call   1030 <strlen@plt>
movabs $0x6c756e2f7665642f,%rcx
6e 75 6c
mov    %rcx,(%rsp,%rax,1)
movl   $0x206c6c,0x7(%rsp,%rax,1)
mov    0x830(%rsp),%ebp
movslq %r15d,%rsi
cmpb   $0x0,(%rsi)
je     11fe <replace_plan+0xce>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rsp,%rax,1)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x203e,(%rsp,%rax,1)
movb   $0x0,0x2(%rsp,%rax,1)
movslq %ebp,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movl   $0x203b20,(%rsp,%rax,1)
movslq %r14d,%rsi
cmpb   $0x0,(%rsi)
je     126c <replace_plan+0x13c>
movl   $0x20646f,0x3(%rsp)
movl   $0x6f6d6863,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x20,(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <strcat@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <system@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"cat \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [11 x i8] c"/dev/null \00"
@.str.5 = [3 x i8] c"> \00"
@.str.6 = [4 x i8] c" ; \00"
@.str.7 = [7 x i8] c"chmod \00"
define void @replace_plan(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [2048 x i8]
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%16 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%17 = call i8* @strcpy(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i8*
%21 = call i32 @strcmp(i8* %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %7
%24 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
%28 = call i8* @strcat(i8* %24, i8* %27)
%29 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%30 = call i8* @strcat(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %23, %7
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = inttoptr i64 %33 to i8*
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %52
37: ; preds = %31
%38 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%39 = load i32, i32* %12
%40 = sext i32 %39 to i64
%41 = inttoptr i64 %40 to i8*
%42 = call i8* @strcat(i8* %38, i8* %41)
%43 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%44 = call i8* @strcat(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%45 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%46 = load i32, i32* %13
%47 = sext i32 %46 to i64
%48 = inttoptr i64 %47 to i8*
%49 = call i8* @strcat(i8* %45, i8* %48)
%50 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%51 = call i8* @strcat(i8* %50, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %62
52: ; preds = %31
%53 = load i32, i32* %13
%54 = sext i32 %53 to i64
%55 = inttoptr i64 %54 to i8*
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %52
%59 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%60 = call i8* @strcat(i8* %59, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %58, %52
br label %62
62: ; preds = %61, %37
%63 = load i32, i32* %9
%64 = sext i32 %63 to i64
%65 = inttoptr i64 %64 to i8*
%66 = call i32 @strcmp(i8* %65, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %76
68: ; preds = %62
%69 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = inttoptr i64 %71 to i8*
%73 = call i8* @strcat(i8* %69, i8* %72)
%74 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%75 = call i8* @strcat(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %76
76: ; preds = %68, %62
%77 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%78 = call i8* @strcat(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%79 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%80 = load i32, i32* %14
%81 = sext i32 %80 to i64
%82 = inttoptr i64 %81 to i8*
%83 = call i8* @strcat(i8* %79, i8* %82)
%84 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%85 = call i8* @strcat(i8* %84, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%86 = load i32, i32* %8
%87 = sext i32 %86 to i64
%88 = inttoptr i64 %87 to i8*
%89 = call i32 @strcmp(i8* %88, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %106
91: ; preds = %76
%92 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%93 = call i8* @strcpy(i8* %92, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%94 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%95 = load i32, i32* %8
%96 = sext i32 %95 to i64
%97 = inttoptr i64 %96 to i8*
%98 = call i8* @strcat(i8* %94, i8* %97)
%99 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%100 = call i8* @strcat(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%101 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%102 = load i32, i32* %14
%103 = sext i32 %102 to i64
%104 = inttoptr i64 %103 to i8*
%105 = call i8* @strcat(i8* %101, i8* %104)
br label %106
106: ; preds = %91, %76
%107 = getelementptr inbounds [2048 x i8], [2048 x i8]* %15, i64 0, i64 0
%108 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %107)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"cat \00"
@.str.4 = [11 x i8] c"/dev/null \00"
@.str.5 = [3 x i8] c"> \00"
@.str.7 = [7 x i8] c"chmod \00"
define void @replace_plan(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca [2048 x i8]
%9 = getelementptr inbounds [2048 x i8], [2048 x i8]* %8, i64 0, i64 0
%10 = sext i32 %2 to i64
%11 = inttoptr i64 %10 to i8*
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %7
%15 = call i8* @strcat(i8* %9, i8* %11)
%16 = call i64 @strlen(i8* %9)
%17 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %16
%18 = bitcast i8* %17 to i16*
store i16 32, i16* %18
br label %19
19: ; preds = %14, %7
%20 = sext i32 %5 to i64
%21 = inttoptr i64 %20 to i8*
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %35, label %24
24: ; preds = %19
%25 = sext i32 %4 to i64
%26 = inttoptr i64 %25 to i8*
%27 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %26)
%28 = call i64 @strlen(i8* %9)
%29 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %28
%30 = bitcast i8* %29 to i16*
store i16 47, i16* %30
%31 = call i8* @strcat(i8* %9, i8* %21)
%32 = call i64 @strlen(i8* %9)
%33 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %32
%34 = bitcast i8* %33 to i16*
store i16 32, i16* %34
br label %38
35: ; preds = %19
%36 = call i64 @strlen(i8* %9)
%37 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %36
br label %38
38: ; preds = %35, %24
%39 = sext i32 %1 to i64
%40 = inttoptr i64 %39 to i8*
%41 = load i8, i8* %40
%42 = icmp eq i8 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %38
%44 = call i8* @strcat(i8* %9, i8* %40)
%45 = call i64 @strlen(i8* %9)
%46 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %45
%47 = bitcast i8* %46 to i16*
store i16 32, i16* %47
br label %48
48: ; preds = %43, %38
%49 = call i64 @strlen(i8* %9)
%50 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %49
%51 = sext i32 %6 to i64
%52 = inttoptr i64 %51 to i8*
%53 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %52)
%54 = call i64 @strlen(i8* %9)
%55 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %54
%56 = bitcast i8* %55 to i32*
store i32 2112288, i32* %56
%57 = sext i32 %0 to i64
%58 = inttoptr i64 %57 to i8*
%59 = load i8, i8* %58
%60 = icmp eq i8 %59, 0
br i1 %60, label %67, label %61
61: ; preds = %48
%62 = call i8* @strcat(i8* %9, i8* %58)
%63 = call i64 @strlen(i8* %9)
%64 = getelementptr [2048 x i8], [2048 x i8]* %8, i64 0, i64 %63
%65 = bitcast i8* %64 to i16*
store i16 32, i16* %65
%66 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %52)
br label %67
67: ; preds = %61, %48
%68 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
ret void
}