#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*/ free(char *);
int /*<<< orphan*/ zcc_asprintf(char **, char *, char *, char *);
void BuildOptions_start(char **list, char *arg) {
  char *val;
  char *orig = *list;
  zcc_asprintf(&val, "%s %s", arg, orig ? orig : "");
  free(orig);
  *list = val;
}


x86 assembly (clang, -O0):
<BuildOptions_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115b <BuildOptions_start+0x3b>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    116b <BuildOptions_start+0x4b>
lea    0xea3(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    116b <BuildOptions_start+0x4b>
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1040 <zcc_asprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BuildOptions_start>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rdx
mov    %rdi,%r14
mov    (%rdi),%rbx
test   %rbx,%rbx
lea    0xece(%rip),%rcx
cmovne %rbx,%rcx
lea    0xebe(%rip),%rsi
mov    %rsp,%rdi
call   1040 <zcc_asprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    (%rsp),%rax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [1 x i8] zeroinitializer
define void @BuildOptions_start(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
store i8* %8, i8** %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i8*, i8** %6
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %12
%16 = phi i8* [ %13, %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %14 ]
%17 = call i32 @zcc_asprintf(i8** %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %16)
%18 = load i8*, i8** %6
%19 = call i32 @free(i8* %18)
%20 = load i8*, i8** %5
%21 = load i8**, i8*** %3
store i8* %20, i8** %21
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [1 x i8] zeroinitializer
define void @BuildOptions_start(i8** nocapture %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, null
%7 = select i1 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %5
%8 = call i32 @zcc_asprintf(i8** %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %7)
%9 = call i32 @free(i8* %5)
%10 = load i8*, i8** %3
store i8* %10, i8** %0
ret void
}