void _lexer_append_string(char **inString1, const char *inString2) {
  assert(inString1);
  assert(inString2);
  long len;
  if (*inString1)
    len = strlen(*inString1);
  else
    len = 0;
  *inString1 = safe_realloc(*inString1, len + strlen(inString2) + 1);
  strcpy(*inString1 + len, inString2);
}


x86 assembly (clang, -O0):
<_lexer_append_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1189 <_lexer_append_string+0x49>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
jmp    1191 <_lexer_append_string+0x51>
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdi
add    %rax,%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1060 <safe_realloc@plt>
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
add    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_lexer_append_string>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
xor    %r15d,%r15d
xor    %eax,%eax
call   1050 <assert@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    (%r12),%rbx
test   %rbx,%rbx
je     1176 <_lexer_append_string+0x36>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rsi
add    $0x1,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <safe_realloc@plt>
movslq %eax,%rdi
mov    %rdi,(%r12)
add    %r15,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define void @_lexer_append_string(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i64
store i8** %0, i8*** %3
store i8* %1, i8** %4
%6 = load i8**, i8*** %3
%7 = call i32 (i8**, ...) bitcast (i32 (...)* @assert to i32 (i8**, ...)*)(i8** %6)
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %8)
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = call i64 @strlen(i8* %15)
store i64 %16, i64* %5
br label %18
17: ; preds = %2
store i64 0, i64* %5
br label %18
18: ; preds = %17, %13
%19 = load i8**, i8*** %3
%20 = load i8*, i8** %19
%21 = load i64, i64* %5
%22 = load i8*, i8** %4
%23 = call i64 @strlen(i8* %22)
%24 = add i64 %21, %23
%25 = add i64 %24, 1
%26 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @safe_realloc to i32 (i8*, i64, ...)*)(i8* %20, i64 %25)
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i8*
%29 = load i8**, i8*** %3
store i8* %28, i8** %29
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = load i64, i64* %5
%33 = getelementptr inbounds i8, i8* %31, i64 %32
%34 = load i8*, i8** %4
%35 = call i8* @strcpy(i8* %33, i8* %34)
ret void
}

LLVM IR (-O2):
define void @_lexer_append_string(i8** %0, i8* %1) {
%3 = tail call i32 (i8**, ...) bitcast (i32 (...)* @assert to i32 (i8**, ...)*)(i8** %0)
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %1)
%5 = load i8*, i8** %0
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i64 @strlen(i8* %5)
br label %9
9: ; preds = %2, %7
%10 = phi i64 [ %8, %7 ], [ 0, %2 ]
%11 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%12 = add i64 %10, 1
%13 = add i64 %12, %11
%14 = tail call i32 (i8*, i64, ...) bitcast (i32 (...)* @safe_realloc to i32 (i8*, i64, ...)*)(i8* %5, i64 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %0
%17 = getelementptr inbounds i8, i8* %16, i64 %10
%18 = tail call i8* @strcpy(i8* dereferenceable(1) %17, i8* dereferenceable(1) %1)
ret void
}