void cmd_spawn(char *arg) {
  char s[4096];
  if (*(arg = skipspace(arg))) {
    arg = split_first_word(s, 4096, arg);
    if (*arg && *s) {
      tcp_spawn(s, arg);
      return;
    }
  }
  status(1), printf("#syntax: #spawn connect-id command\n");
}


x86 assembly (clang, -O0):
<cmd_spawn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <skipspace@plt>
cltq
mov    %rax,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     11d2 <cmd_spawn+0x82>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x1000,%esi
mov    $0x0,%al
call   1030 <split_first_word@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11cd <cmd_spawn+0x7d>
movsbl -0x1010(%rbp),%eax
cmp    $0x0,%eax
je     11cd <cmd_spawn+0x7d>
lea    -0x1010(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <tcp_spawn@plt>
jmp    11ec <cmd_spawn+0x9c>
jmp    11d2 <cmd_spawn+0x82>
mov    $0x1,%edi
mov    $0x0,%al
call   1050 <status@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_spawn>:
sub    $0x1008,%rsp
xor    %eax,%eax
call   1070 <skipspace@plt>
movslq %eax,%rdx
cmpb   $0x0,(%rdx)
je     1195 <cmd_spawn+0x45>
mov    %rsp,%rdi
mov    $0x1000,%esi
xor    %eax,%eax
call   1030 <split_first_word@plt>
movslq %eax,%rsi
cmpb   $0x0,(%rsi)
je     1195 <cmd_spawn+0x45>
cmpb   $0x0,(%rsp)
je     1195 <cmd_spawn+0x45>
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <tcp_spawn@plt>
add    $0x1008,%rsp
ret
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <status@plt>
lea    0xe58(%rip),%rdi
call   1040 <puts@plt>
add    $0x1008,%rsp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"#syntax: #spawn connect-id command\0A\00"
define void @cmd_spawn(i8* %0) {
%2 = alloca i8*
%3 = alloca [4096 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @skipspace to i32 (i8*, ...)*)(i8* %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %30
10: ; preds = %1
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%12 = load i8*, i8** %2
%13 = call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @split_first_word to i32 (i8*, i32, i8*, ...)*)(i8* %11, i32 4096, i8* %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %2
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %10
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%27 = load i8*, i8** %2
%28 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @tcp_spawn to i32 (i8*, i8*, ...)*)(i8* %26, i8* %27)
br label %33
29: ; preds = %20, %10
br label %30
30: ; preds = %29, %1
%31 = call i32 (i32, ...) bitcast (i32 (...)* @status to i32 (i32, ...)*)(i32 1)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %30, %25
ret void
}

LLVM IR (-O2):
@str = [35 x i8] c"#syntax: #spawn connect-id command\00"
define void @cmd_spawn(i8* %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @skipspace to i32 (i8*, ...)*)(i8* %0)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %20, label %9
9: ; preds = %1
%10 = call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @split_first_word to i32 (i8*, i32, i8*, ...)*)(i8* %3, i32 4096, i8* %6)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
%15 = load i8, i8* %3
%16 = icmp ne i8 %15, 0
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %20
18: ; preds = %9
%19 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @tcp_spawn to i32 (i8*, i8*, ...)*)(i8* %3, i8* %12)
br label %23
20: ; preds = %9, %1
%21 = call i32 (i32, ...) bitcast (i32 (...)* @status to i32 (i32, ...)*)(i32 1)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %20, %18
ret void
}