#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 */
char *CG_Argv(int);
int /*<<< orphan*/ Q_strcat(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ Q_strncpyz(char *, int /*<<< orphan*/, int);
int strlen(char const *);
int /*<<< orphan*/ trap_SendConsoleCommand(char *);
int /*<<< orphan*/ va(char *, char const *);
void CG_ParseMappage(void) {
  char command[1024];
  const char *temp;
  const char *c;
  int i;
  temp = CG_Argv(1);
  for (c = temp; *c; ++c) {
    switch (*c) {
    case '\n':
    case '\r':
    case ';':
      return;
      break;
    }
  }
  Q_strncpyz(command, va("ui_mappage %s", temp), 1024);
  for (i = 2; i < 12; i++) {
    temp = CG_Argv(i);
    for (c = temp; *c; ++c) {
      switch (*c) {
      case '\n':
      case '\r':
      case ';':
        return;
        break;
      }
    }
    if (strlen(temp) < 1) {
      temp = "---";
    }
    Q_strcat(command, 1024, va(" %s ", temp));
  }
  trap_SendConsoleCommand(command);
}


x86 assembly (clang, -O0):
<CG_ParseMappage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    $0x1,%edi
call   1040 <CG_Argv@plt>
mov    %rax,-0x408(%rbp)
mov    -0x408(%rbp),%rax
mov    %rax,-0x410(%rbp)
mov    -0x410(%rbp),%rax
cmpb   $0x0,(%rax)
je     1201 <CG_ParseMappage+0xa1>
mov    -0x410(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x418(%rbp)
sub    $0xa,%eax
je     11e0 <CG_ParseMappage+0x80>
jmp    11b8 <CG_ParseMappage+0x58>
mov    -0x418(%rbp),%eax
sub    $0xd,%eax
je     11e0 <CG_ParseMappage+0x80>
jmp    11cc <CG_ParseMappage+0x6c>
mov    -0x418(%rbp),%eax
sub    $0x3b,%eax
jne    11e5 <CG_ParseMappage+0x85>
jmp    11e0 <CG_ParseMappage+0x80>
jmp    135a <CG_ParseMappage+0x1fa>
jmp    11ea <CG_ParseMappage+0x8a>
mov    -0x410(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x410(%rbp)
jmp    118a <CG_ParseMappage+0x2a>
lea    -0x400(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    -0x408(%rbp),%rsi
lea    0xde3(%rip),%rdi
call   1050 <va@plt>
mov    -0x420(%rbp),%rdi
mov    %eax,%esi
mov    $0x400,%edx
call   1080 <Q_strncpyz@plt>
movl   $0x2,-0x414(%rbp)
cmpl   $0xc,-0x414(%rbp)
jge    134e <CG_ParseMappage+0x1ee>
mov    -0x414(%rbp),%edi
call   1040 <CG_Argv@plt>
mov    %rax,-0x408(%rbp)
mov    -0x408(%rbp),%rax
mov    %rax,-0x410(%rbp)
mov    -0x410(%rbp),%rax
cmpb   $0x0,(%rax)
je     12e3 <CG_ParseMappage+0x183>
mov    -0x410(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x424(%rbp)
sub    $0xa,%eax
je     12c2 <CG_ParseMappage+0x162>
jmp    129a <CG_ParseMappage+0x13a>
mov    -0x424(%rbp),%eax
sub    $0xd,%eax
je     12c2 <CG_ParseMappage+0x162>
jmp    12ae <CG_ParseMappage+0x14e>
mov    -0x424(%rbp),%eax
sub    $0x3b,%eax
jne    12c7 <CG_ParseMappage+0x167>
jmp    12c2 <CG_ParseMappage+0x162>
jmp    135a <CG_ParseMappage+0x1fa>
jmp    12cc <CG_ParseMappage+0x16c>
mov    -0x410(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x410(%rbp)
jmp    126c <CG_ParseMappage+0x10c>
mov    -0x408(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jge    1306 <CG_ParseMappage+0x1a6>
lea    0xd0f(%rip),%rax
mov    %rax,-0x408(%rbp)
lea    -0x400(%rbp),%rax
mov    %rax,-0x430(%rbp)
mov    -0x408(%rbp),%rsi
lea    0xcf0(%rip),%rdi
call   1050 <va@plt>
mov    -0x430(%rbp),%rdi
mov    %eax,%edx
mov    $0x400,%esi
call   1060 <Q_strcat@plt>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    123f <CG_ParseMappage+0xdf>
lea    -0x400(%rbp),%rdi
call   1070 <trap_SendConsoleCommand@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_ParseMappage>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    $0x1,%edi
call   1040 <CG_Argv@plt>
mov    (%rax),%dl
movabs $0x800000000002400,%r12
test   %dl,%dl
je     11be <CG_ParseMappage+0x5e>
lea    0x1(%rax),%rcx
jmp    11ab <CG_ParseMappage+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
je     11be <CG_ParseMappage+0x5e>
movsbl %dl,%edx
cmp    $0x3b,%edx
ja     11a0 <CG_ParseMappage+0x40>
bt     %rdx,%r12
jae    11a0 <CG_ParseMappage+0x40>
jmp    1269 <CG_ParseMappage+0x109>
lea    0xe3b(%rip),%rdi
mov    %rax,%rsi
call   1050 <va@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %eax,%esi
mov    $0x400,%edx
call   1080 <Q_strncpyz@plt>
mov    $0x2,%ebp
lea    0xe23(%rip),%r13
lea    0xe20(%rip),%r14
jmp    1230 <CG_ParseMappage+0xd0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
cmovle %r13,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <va@plt>
mov    %r15,%rdi
mov    $0x400,%esi
mov    %eax,%edx
call   1060 <Q_strcat@plt>
add    $0x1,%ebp
cmp    $0xc,%ebp
je     127b <CG_ParseMappage+0x11b>
mov    %ebp,%edi
call   1040 <CG_Argv@plt>
mov    %rax,%rbx
mov    (%rax),%cl
test   %cl,%cl
je     1200 <CG_ParseMappage+0xa0>
lea    0x1(%rbx),%rax
jmp    125b <CG_ParseMappage+0xfb>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
je     1200 <CG_ParseMappage+0xa0>
movsbl %cl,%ecx
cmp    $0x3b,%ecx
ja     1250 <CG_ParseMappage+0xf0>
bt     %rcx,%r12
jae    1250 <CG_ParseMappage+0xf0>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsp,%rdi
call   1070 <trap_SendConsoleCommand@plt>
jmp    1269 <CG_ParseMappage+0x109>

LLVM IR (-O0):
@.str = [14 x i8] c"ui_mappage %s\00"
@.str.1 = [4 x i8] c"---\00"
@.str.2 = [5 x i8] c" %s \00"
define void @CG_ParseMappage() {
%1 = alloca [1024 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = call i8* @CG_Argv(i32 1)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
store i8* %6, i8** %3
br label %7
7: ; preds = %17, %0
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
switch i32 %14, label %16 [
i32 10, label %15
i32 13, label %15
i32 59, label %15
]
15: ; preds = %11, %11, %11
br label %61
16: ; preds = %11
br label %17
17: ; preds = %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %7
20: ; preds = %7
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%22 = load i8*, i8** %2
%23 = call i32 @va(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = call i32 @Q_strncpyz(i8* %21, i32 %23, i32 1024)
store i32 2, i32* %4
br label %25
25: ; preds = %55, %20
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 12
br i1 %27, label %28, label %58
28: ; preds = %25
%29 = load i32, i32* %4
%30 = call i8* @CG_Argv(i32 %29)
store i8* %30, i8** %2
%31 = load i8*, i8** %2
store i8* %31, i8** %3
br label %32
32: ; preds = %42, %28
%33 = load i8*, i8** %3
%34 = load i8, i8* %33
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = load i8*, i8** %3
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
switch i32 %39, label %41 [
i32 10, label %40
i32 13, label %40
i32 59, label %40
]
40: ; preds = %36, %36, %36
br label %61
41: ; preds = %36
br label %42
42: ; preds = %41
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i32 1
store i8* %44, i8** %3
br label %32
45: ; preds = %32
%46 = load i8*, i8** %2
%47 = call i32 @strlen(i8* %46)
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %50
49: ; preds = %45
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %50
50: ; preds = %49, %45
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%52 = load i8*, i8** %2
%53 = call i32 @va(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %52)
%54 = call i32 @Q_strcat(i8* %51, i32 1024, i32 %53)
br label %55
55: ; preds = %50
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %25
58: ; preds = %25
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%60 = call i32 @trap_SendConsoleCommand(i8* %59)
br label %61
61: ; preds = %58, %40, %15
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"ui_mappage %s\00"
@.str.1 = [4 x i8] c"---\00"
@.str.2 = [5 x i8] c" %s \00"
define void @CG_ParseMappage() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i8* @CG_Argv(i32 1)
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %0, %10
%7 = phi i8 [ %12, %10 ], [ %4, %0 ]
%8 = phi i8* [ %11, %10 ], [ %3, %0 ]
%9 = sext i8 %7 to i32
switch i32 %9, label %10 [
i32 10, label %40
i32 13, label %40
i32 59, label %40
]
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %10, %0
%15 = tail call i32 @va(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
%16 = call i32 @Q_strncpyz(i8* %2, i32 %15, i32 1024)
br label %17
17: ; preds = %14, %30
%18 = phi i32 [ 2, %14 ], [ %36, %30 ]
%19 = call i8* @CG_Argv(i32 %18)
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %17, %26
%23 = phi i8 [ %28, %26 ], [ %20, %17 ]
%24 = phi i8* [ %27, %26 ], [ %19, %17 ]
%25 = sext i8 %23 to i32
switch i32 %25, label %26 [
i32 10, label %40
i32 13, label %40
i32 59, label %40
]
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %24, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 0
br i1 %29, label %30, label %22
30: ; preds = %26, %17
%31 = call i32 @strlen(i8* %19)
%32 = icmp slt i32 %31, 1
%33 = select i1 %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19
%34 = call i32 @va(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %33)
%35 = call i32 @Q_strcat(i8* %2, i32 1024, i32 %34)
%36 = add nuw nsw i32 %18, 1
%37 = icmp eq i32 %36, 12
br i1 %37, label %38, label %17
38: ; preds = %30
%39 = call i32 @trap_SendConsoleCommand(i8* %2)
br label %40
40: ; preds = %6, %6, %6, %22, %22, %22, %38
ret void
}