#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 */
typedef int /*<<< orphan*/ text;
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int /*<<< orphan*/ G_SpawnBot(char *);
int /*<<< orphan*/ Q_strcat(char *, int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
scalar_t__ strchr(char *, char);
int trap_Argc();
int /*<<< orphan*/ trap_Argv(int, char *, int);
void Svcmd_SpawnBot() {
  char text[1024];
  char cmd[1024];
  int i;
  memset(text, 0, sizeof(text));
  for (i = 1; i < trap_Argc(); i++) {
    trap_Argv(i, cmd, sizeof(cmd));
    if (i > 1)
      Q_strcat(text, sizeof(text), " ");
    if (strchr(cmd, ' '))
      Q_strcat(text, sizeof(text), "\"");
    Q_strcat(text, sizeof(text), cmd);
    if (strchr(cmd, ' '))
      Q_strcat(text, sizeof(text), "\"");
  }
  G_SpawnBot(text);
}


x86 assembly (clang, -O0):
<Svcmd_SpawnBot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movl   $0x1,-0x804(%rbp)
mov    -0x804(%rbp),%eax
mov    %eax,-0x808(%rbp)
mov    $0x0,%al
call   1050 <trap_Argc@plt>
mov    %eax,%ecx
mov    -0x808(%rbp),%eax
cmp    %ecx,%eax
jge    127e <Svcmd_SpawnBot+0x11e>
mov    -0x804(%rbp),%edi
lea    -0x800(%rbp),%rsi
mov    $0x400,%edx
call   1060 <trap_Argv@plt>
cmpl   $0x1,-0x804(%rbp)
jle    11e7 <Svcmd_SpawnBot+0x87>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
lea    0xe1e(%rip),%rdx
call   1080 <Q_strcat@plt>
lea    -0x800(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     121a <Svcmd_SpawnBot+0xba>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
lea    0xded(%rip),%rdx
call   1080 <Q_strcat@plt>
lea    -0x400(%rbp),%rdi
lea    -0x800(%rbp),%rdx
mov    $0x400,%esi
call   1080 <Q_strcat@plt>
lea    -0x800(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1265 <Svcmd_SpawnBot+0x105>
lea    -0x400(%rbp),%rdi
mov    $0x400,%esi
lea    0xda2(%rip),%rdx
call   1080 <Q_strcat@plt>
jmp    126a <Svcmd_SpawnBot+0x10a>
mov    -0x804(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x804(%rbp)
jmp    1188 <Svcmd_SpawnBot+0x28>
lea    -0x400(%rbp),%rdi
call   1070 <G_SpawnBot@plt>
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Svcmd_SpawnBot>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
xor    %eax,%eax
call   1050 <trap_Argc@plt>
cmp    $0x2,%eax
jl     12c6 <Svcmd_SpawnBot+0x166>
lea    0x400(%rsp),%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1060 <trap_Argv@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     11cf <Svcmd_SpawnBot+0x6f>
lea    0xe40(%rip),%rdx
mov    %rsp,%rdi
mov    $0x400,%esi
call   1080 <Q_strcat@plt>
mov    %rsp,%rdi
lea    0x400(%rsp),%rbx
mov    $0x400,%esi
mov    %rbx,%rdx
call   1080 <Q_strcat@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     120d <Svcmd_SpawnBot+0xad>
lea    0xe02(%rip),%rdx
mov    %rsp,%rdi
mov    $0x400,%esi
call   1080 <Q_strcat@plt>
xor    %eax,%eax
call   1050 <trap_Argc@plt>
cmp    $0x3,%eax
jl     12c6 <Svcmd_SpawnBot+0x166>
mov    $0x2,%ebx
lea    0x400(%rsp),%r14
lea    0xdcf(%rip),%r15
mov    %rsp,%r12
lea    0xdc7(%rip),%r13
jmp    124e <Svcmd_SpawnBot+0xee>
nopl   (%rax)
add    $0x1,%ebx
xor    %eax,%eax
call   1050 <trap_Argc@plt>
cmp    %eax,%ebx
jge    12c6 <Svcmd_SpawnBot+0x166>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1060 <trap_Argv@plt>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1080 <Q_strcat@plt>
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     128f <Svcmd_SpawnBot+0x12f>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1080 <Q_strcat@plt>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1080 <Q_strcat@plt>
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1240 <Svcmd_SpawnBot+0xe0>
mov    %r12,%rdi
mov    $0x400,%esi
mov    %r13,%rdx
call   1080 <Q_strcat@plt>
jmp    1240 <Svcmd_SpawnBot+0xe0>
mov    %rsp,%rdi
call   1070 <G_SpawnBot@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\22\00"
define void @Svcmd_SpawnBot() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 1024)
store i32 1, i32* %3
br label %6
6: ; preds = %37, %0
%7 = load i32, i32* %3
%8 = call i32 (...) @trap_Argc()
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %40
10: ; preds = %6
%11 = load i32, i32* %3
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%13 = call i32 @trap_Argv(i32 %11, i8* %12, i32 1024)
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%18 = call i32 @Q_strcat(i8* %17, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %16, %10
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%21 = call i64 @strchr(i8* %20, i8 signext 32)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%25 = call i32 @Q_strcat(i8* %24, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23, %19
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%29 = call i32 @Q_strcat(i8* %27, i32 1024, i8* %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%31 = call i64 @strchr(i8* %30, i8 signext 32)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%35 = call i32 @Q_strcat(i8* %34, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %33, %26
br label %37
37: ; preds = %36
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %6
40: ; preds = %6
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%42 = call i32 @G_SpawnBot(i8* %41)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"\22\00"
define void @Svcmd_SpawnBot() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %3, i32 0, i32 1024)
%6 = call i32 (...) @trap_Argc()
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %41
8: ; preds = %0
%9 = call i32 @trap_Argv(i32 1, i8* %4, i32 1024)
%10 = call i64 @strchr(i8* %4, i8 signext 32)
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @Q_strcat(i8* %3, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = call i32 @Q_strcat(i8* %3, i32 1024, i8* %4)
%16 = call i64 @strchr(i8* %4, i8 signext 32)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = call i32 @Q_strcat(i8* %3, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = call i32 (...) @trap_Argc()
%22 = icmp sgt i32 %21, 2
br i1 %22, label %23, label %41
23: ; preds = %20, %37
%24 = phi i32 [ %38, %37 ], [ 2, %20 ]
%25 = call i32 @trap_Argv(i32 %24, i8* %4, i32 1024)
%26 = call i32 @Q_strcat(i8* %3, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%27 = call i64 @strchr(i8* %4, i8 signext 32)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %23
%30 = call i32 @Q_strcat(i8* %3, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %23
%32 = call i32 @Q_strcat(i8* %3, i32 1024, i8* %4)
%33 = call i64 @strchr(i8* %4, i8 signext 32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = call i32 @Q_strcat(i8* %3, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %37
37: ; preds = %31, %35
%38 = add nuw nsw i32 %24, 1
%39 = call i32 (...) @trap_Argc()
%40 = icmp slt i32 %38, %39
br i1 %40, label %23, label %41
41: ; preds = %37, %20, %0
%42 = call i32 @G_SpawnBot(i8* %3)
ret void
}