char *allocated_variable_expand_for_file(line, file)
char *line;
struct file *file;
{
  char *save;
  char *value;
  save = save_variable_output();
  value = variable_expand_for_file(line, file);
  value = savestring(value, strlen(value));
  restore_variable_output(save);
  return value;
}


x86 assembly (clang, -O0):
<allocated_variable_expand_for_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <save_variable_output@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <variable_expand_for_file@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rsi
mov    $0x0,%al
call   1030 <savestring@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1070 <restore_variable_output@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocated_variable_expand_for_file>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <save_variable_output@plt>
movslq %eax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <variable_expand_for_file@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <savestring@plt>
movslq %eax,%rbx
mov    %r15,%rdi
xor    %eax,%eax
call   1070 <restore_variable_output@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.file = type opaque
define i8* @allocated_variable_expand_for_file(i8* %0, %struct.file* %1) {
%3 = alloca i8*
%4 = alloca %struct.file*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store %struct.file* %1, %struct.file** %4
%7 = call i32 (...) @save_variable_output()
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %3
%11 = load %struct.file*, %struct.file** %4
%12 = call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* %10, %struct.file* %11)
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = load i8*, i8** %6
%17 = call i64 @strlen(i8* %16)
%18 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i64, ...)*)(i8* %15, i64 %17)
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %6
%21 = load i8*, i8** %5
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @restore_variable_output to i32 (i8*, ...)*)(i8* %21)
%23 = load i8*, i8** %6
ret i8* %23
}

LLVM IR (-O2):
%struct.file = type opaque
define i8* @allocated_variable_expand_for_file(i8* %0, %struct.file* %1) {
%3 = tail call i32 (...) @save_variable_output()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, %struct.file*, ...) bitcast (i32 (...)* @variable_expand_for_file to i32 (i8*, %struct.file*, ...)*)(i8* %0, %struct.file* %1)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%10 = tail call i32 (i8*, i64, ...) bitcast (i32 (...)* @savestring to i32 (i8*, i64, ...)*)(i8* %8, i64 %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @restore_variable_output to i32 (i8*, ...)*)(i8* %5)
ret i8* %12
}