int lace_builtin_main(const char *name, unsigned argc, char **argv) {
  int (*f)(unsigned, char **);
  f = lace_specific_util(name);
  if (!f) {
    lace_log_errorf("Unknown builtin: %s", name);
    return -1;
  }
  return f(argc, argv);
}


x86 assembly (clang, -O0):
<lace_builtin_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <lace_specific_util@plt>
cltq
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116d <lace_builtin_main+0x4d>
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <lace_log_errorf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117d <lace_builtin_main+0x5d>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   *%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lace_builtin_main>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <lace_specific_util@plt>
test   %eax,%eax
je     1144 <lace_builtin_main+0x24>
cltq
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    *%rax
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <lace_log_errorf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Unknown builtin: %s\00"
define i32 @lace_builtin_main(i8* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32 (i32, i8**)*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%9 = load i8*, i8** %5
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @lace_specific_util to i32 (i8*, ...)*)(i8* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32 (i32, i8**)*
store i32 (i32, i8**)* %12, i32 (i32, i8**)** %8
%13 = load i32 (i32, i8**)*, i32 (i32, i8**)** %8
%14 = icmp ne i32 (i32, i8**)* %13, null
br i1 %14, label %18, label %15
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @lace_log_errorf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 -1, i32* %4
br label %23
18: ; preds = %3
%19 = load i32 (i32, i8**)*, i32 (i32, i8**)** %8
%20 = load i32, i32* %6
%21 = load i8**, i8*** %7
%22 = call i32 %19(i32 %20, i8** %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %18, %15
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@.str = [20 x i8] c"Unknown builtin: %s\00"
define i32 @lace_builtin_main(i8* %0, i32 %1, i8** %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @lace_specific_util to i32 (i8*, ...)*)(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @lace_log_errorf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
8: ; preds = %3
%9 = sext i32 %4 to i64
%10 = inttoptr i64 %9 to i32 (i32, i8**)*
%11 = tail call i32 %10(i32 %1, i8** %2)
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ %11, %8 ], [ -1, %6 ]
ret i32 %13
}