#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*/ strcat(char *, char const *);
int strlen(char const *);
int /*<<< orphan*/ system(char *);
void results_to_editor(const char *file1, const char *file2) {
  const char *seperator = " ", *cmd_prefix = "vim -d ";
  unsigned total_len = strlen(cmd_prefix) + strlen(file1) + strlen(file2) +
                       strlen(seperator) + 1;
  char editor_cmd[total_len];
  *editor_cmd = '\0';
  strcat(editor_cmd, cmd_prefix);
  strcat(editor_cmd, file1);
  strcat(editor_cmd, seperator);
  strcat(editor_cmd, file2);
  system(editor_cmd);
  return;
}


x86 assembly (clang, -O0):
<results_to_editor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeae(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
mov    -0x44(%rbp),%eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1(%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
movb   $0x0,(%rdi)
mov    -0x20(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x40(%rbp),%rdi
call   1040 <system@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<results_to_editor>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r13
lea    0xeb5(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
lea    0xe97(%rip),%rdi
call   1030 <strlen@plt>
add    %ebx,%r15d
add    %r12d,%r15d
add    %r15d,%eax
add    $0x1,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
mov    %rcx,%rbx
sub    %rax,%rbx
neg    %rax
mov    %rbx,%rsp
movb   $0x0,(%rcx,%rax,1)
mov    %rbx,%rdi
lea    0xe5b(%rip),%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
lea    0xe47(%rip),%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [8 x i8] c"vim -d \00"
define void @results_to_editor(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @strlen(i8* %12)
%14 = add nsw i32 %11, %13
%15 = load i8*, i8** %4
%16 = call i32 @strlen(i8* %15)
%17 = add nsw i32 %14, %16
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* %18)
%20 = add nsw i32 %17, %19
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %8
%25 = alloca i8, i64 %23
store i64 %23, i64* %9
store i8 0, i8* %25
%26 = load i8*, i8** %6
%27 = call i32 @strcat(i8* %25, i8* %26)
%28 = load i8*, i8** %3
%29 = call i32 @strcat(i8* %25, i8* %28)
%30 = load i8*, i8** %5
%31 = call i32 @strcat(i8* %25, i8* %30)
%32 = load i8*, i8** %4
%33 = call i32 @strcat(i8* %25, i8* %32)
%34 = call i32 @system(i8* %25)
%35 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [8 x i8] c"vim -d \00"
define void @results_to_editor(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = add i32 %3, 1
%8 = add i32 %7, %4
%9 = add i32 %8, %5
%10 = add i32 %9, %6
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
store i8 0, i8* %12
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @strcat(i8* %12, i8* %0)
%15 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @strcat(i8* %12, i8* %1)
%17 = call i32 @system(i8* %12)
ret void
}