char *expand_history(command_line)
char *command_line;
{
  static char *expanded_line = 0;
  char *temp;
  int expand_res;
  ;
  if (!expanded_line)
    expanded_line = safe_malloc(2 * 1000 + 1);
  expand_res = history_expand(command_line, &expanded_line);
  ;
  if (expand_res == 0)
    return 0;
  else if (expand_res == -1)
    return command_line;
  else {
    ;
    temp = expanded_line;
    expanded_line = 0;
    return temp;
  }
}


x86 assembly (clang, -O0):
<expand_history>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,0x2f04(%rip)
jne    114f <expand_history+0x2f>
mov    $0x7d1,%edi
mov    $0x0,%al
call   1030 <safe_malloc@plt>
cltq
mov    %rax,0x2ee9(%rip)
mov    -0x10(%rbp),%rdi
lea    0x2ede(%rip),%rsi
mov    $0x0,%al
call   1040 <history_expand@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    117b <expand_history+0x5b>
movq   $0x0,-0x8(%rbp)
jmp    11b0 <expand_history+0x90>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1192 <expand_history+0x72>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11b0 <expand_history+0x90>
mov    0x2e9f(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,0x2e90(%rip)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_history>:
push   %rbx
mov    %rdi,%rbx
cmpq   $0x0,0x2f0c(%rip)
jne    1143 <expand_history+0x23>
mov    $0x7d1,%edi
xor    %eax,%eax
call   1030 <safe_malloc@plt>
cltq
mov    %rax,0x2ef5(%rip)
lea    0x2eee(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <history_expand@plt>
test   %eax,%eax
je     1171 <expand_history+0x51>
cmp    $0xffffffff,%eax
je     1173 <expand_history+0x53>
mov    0x2ed4(%rip),%rbx
movq   $0x0,0x2ec9(%rip)
jmp    1173 <expand_history+0x53>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@expand_history.expanded_line = internal global i8* null
define i8* @expand_history(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** @expand_history.expanded_line
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = call i32 (i32, ...) bitcast (i32 (...)* @safe_malloc to i32 (i32, ...)*)(i32 2001)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** @expand_history.expanded_line
br label %12
12: ; preds = %8, %1
%13 = load i8*, i8** %3
%14 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @history_expand to i32 (i8*, i8**, ...)*)(i8* %13, i8** @expand_history.expanded_line)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
store i8* null, i8** %2
br label %26
18: ; preds = %12
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i8*, i8** %3
store i8* %22, i8** %2
br label %26
23: ; preds = %18
%24 = load i8*, i8** @expand_history.expanded_line
store i8* %24, i8** %4
store i8* null, i8** @expand_history.expanded_line
%25 = load i8*, i8** %4
store i8* %25, i8** %2
br label %26
26: ; preds = %23, %21, %17
%27 = load i8*, i8** %2
ret i8* %27
}

LLVM IR (-O2):
@expand_history.expanded_line = internal global i8* null
define i8* @expand_history(i8* %0) {
%2 = load i8*, i8** @expand_history.expanded_line
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @safe_malloc to i32 (i32, ...)*)(i32 2001)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** @expand_history.expanded_line
br label %8
8: ; preds = %4, %1
%9 = tail call i32 (i8*, i8**, ...) bitcast (i32 (...)* @history_expand to i32 (i8*, i8**, ...)*)(i8* %0, i8** @expand_history.expanded_line)
switch i32 %9, label %11 [
i32 0, label %13
i32 -1, label %10
]
10: ; preds = %8
br label %13
11: ; preds = %8
%12 = load i8*, i8** @expand_history.expanded_line
store i8* null, i8** @expand_history.expanded_line
br label %13
13: ; preds = %8, %11, %10
%14 = phi i8* [ %0, %10 ], [ %12, %11 ], [ null, %8 ]
ret i8* %14
}