#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 */
int /*<<< orphan*/ ClientScript_ExecText(char *);
int /*<<< orphan*/ ClientScript_GetCommand(char *);
int ClientScript_LogicOperation();
char *ClientScript_NextToken();
int /*<<< orphan*/ ClientScript_PrevToken();
scalar_t__ Q_stricmp(char const *, char *);
void ClientScript_ParseIfClause(void) {
  const char *token;
  char cmd[512];
  char elseCmd[512];
  int result;
if_clause:
  result = ClientScript_LogicOperation();
  token = ClientScript_NextToken();
  if (Q_stricmp(token, "then") != 0) {
    ClientScript_PrevToken();
  }
  ClientScript_GetCommand(cmd);
  if (result) {
    ClientScript_ExecText(cmd);
    return;
  }
  if (result == 0) {
    token = ClientScript_NextToken();
    if (!token) {
      return;
    }
    if (!Q_stricmp(token, "elseif")) {
      goto if_clause;
    } else {
      ClientScript_PrevToken();
    }
  }
  token = ClientScript_NextToken();
  if (token && !Q_stricmp(token, "else")) {
    ClientScript_GetCommand(elseCmd);
    ClientScript_ExecText(elseCmd);
  }
}


x86 assembly (clang, -O0):
<ClientScript_ParseIfClause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    $0x0,%al
call   1070 <ClientScript_LogicOperation@plt>
mov    %eax,-0x414(%rbp)
mov    $0x0,%al
call   1080 <ClientScript_NextToken@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1050 <Q_stricmp@plt>
cmp    $0x0,%rax
je     11a4 <ClientScript_ParseIfClause+0x44>
mov    $0x0,%al
call   1030 <ClientScript_PrevToken@plt>
lea    -0x210(%rbp),%rdi
call   1060 <ClientScript_GetCommand@plt>
cmpl   $0x0,-0x414(%rbp)
je     11ce <ClientScript_ParseIfClause+0x6e>
lea    -0x210(%rbp),%rdi
call   1040 <ClientScript_ExecText@plt>
jmp    1269 <ClientScript_ParseIfClause+0x109>
cmpl   $0x0,-0x414(%rbp)
jne    1221 <ClientScript_ParseIfClause+0xc1>
mov    $0x0,%al
call   1080 <ClientScript_NextToken@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11f6 <ClientScript_ParseIfClause+0x96>
jmp    1269 <ClientScript_ParseIfClause+0x109>
mov    -0x8(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1050 <Q_stricmp@plt>
cmp    $0x0,%rax
jne    1215 <ClientScript_ParseIfClause+0xb5>
jmp    116b <ClientScript_ParseIfClause+0xb>
mov    $0x0,%al
call   1030 <ClientScript_PrevToken@plt>
jmp    1221 <ClientScript_ParseIfClause+0xc1>
mov    $0x0,%al
call   1080 <ClientScript_NextToken@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1269 <ClientScript_ParseIfClause+0x109>
mov    -0x8(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1050 <Q_stricmp@plt>
cmp    $0x0,%rax
jne    1269 <ClientScript_ParseIfClause+0x109>
lea    -0x410(%rbp),%rdi
call   1060 <ClientScript_GetCommand@plt>
lea    -0x410(%rbp),%rdi
call   1040 <ClientScript_ExecText@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClientScript_ParseIfClause>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xe8c(%rip),%r14
lea    0x200(%rsp),%rbx
lea    0xe82(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <ClientScript_LogicOperation@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1080 <ClientScript_NextToken@plt>
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <Q_stricmp@plt>
test   %rax,%rax
je     11b7 <ClientScript_ParseIfClause+0x57>
xor    %eax,%eax
call   1030 <ClientScript_PrevToken@plt>
mov    %rbx,%rdi
call   1060 <ClientScript_GetCommand@plt>
test   %ebp,%ebp
jne    1211 <ClientScript_ParseIfClause+0xb1>
xor    %eax,%eax
call   1080 <ClientScript_NextToken@plt>
test   %rax,%rax
je     1219 <ClientScript_ParseIfClause+0xb9>
mov    %rax,%rdi
mov    %r15,%rsi
call   1050 <Q_stricmp@plt>
test   %rax,%rax
je     1190 <ClientScript_ParseIfClause+0x30>
xor    %eax,%eax
call   1030 <ClientScript_PrevToken@plt>
xor    %eax,%eax
call   1080 <ClientScript_NextToken@plt>
test   %rax,%rax
je     1219 <ClientScript_ParseIfClause+0xb9>
lea    0xe13(%rip),%rsi
mov    %rax,%rdi
call   1050 <Q_stricmp@plt>
test   %rax,%rax
jne    1219 <ClientScript_ParseIfClause+0xb9>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <ClientScript_GetCommand@plt>
mov    %rbx,%rdi
call   1040 <ClientScript_ExecText@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"then\00"
@.str.1 = [7 x i8] c"elseif\00"
@.str.2 = [5 x i8] c"else\00"
define void @ClientScript_ParseIfClause() {
%1 = alloca i8*
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca i32
br label %5
5: ; preds = %33, %0
%6 = call i32 (...) @ClientScript_LogicOperation()
store i32 %6, i32* %4
%7 = call i8* (...) @ClientScript_NextToken()
store i8* %7, i8** %1
%8 = load i8*, i8** %1
%9 = call i64 @Q_stricmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = call i32 (...) @ClientScript_PrevToken()
br label %13
13: ; preds = %11, %5
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%15 = call i32 @ClientScript_GetCommand(i8* %14)
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%20 = call i32 @ClientScript_ExecText(i8* %19)
br label %50
21: ; preds = %13
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = call i8* (...) @ClientScript_NextToken()
store i8* %25, i8** %1
%26 = load i8*, i8** %1
%27 = icmp ne i8* %26, null
br i1 %27, label %29, label %28
28: ; preds = %24
br label %50
29: ; preds = %24
%30 = load i8*, i8** %1
%31 = call i64 @Q_stricmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp ne i64 %31, 0
br i1 %32, label %34, label %33
33: ; preds = %29
br label %5
34: ; preds = %29
%35 = call i32 (...) @ClientScript_PrevToken()
br label %36
36: ; preds = %34
br label %37
37: ; preds = %36, %21
%38 = call i8* (...) @ClientScript_NextToken()
store i8* %38, i8** %1
%39 = load i8*, i8** %1
%40 = icmp ne i8* %39, null
br i1 %40, label %41, label %50
41: ; preds = %37
%42 = load i8*, i8** %1
%43 = call i64 @Q_stricmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%44 = icmp ne i64 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %41
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%47 = call i32 @ClientScript_GetCommand(i8* %46)
%48 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%49 = call i32 @ClientScript_ExecText(i8* %48)
br label %50
50: ; preds = %18, %28, %45, %41, %37
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"then\00"
@.str.1 = [7 x i8] c"elseif\00"
@.str.2 = [5 x i8] c"else\00"
define void @ClientScript_ParseIfClause() {
%1 = alloca [512 x i8]
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %18, %0
%6 = call i32 (...) @ClientScript_LogicOperation()
%7 = call i8* (...) @ClientScript_NextToken()
%8 = call i64 @Q_stricmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = call i32 (...) @ClientScript_PrevToken()
br label %12
12: ; preds = %10, %5
%13 = call i32 @ClientScript_GetCommand(i8* %3)
%14 = icmp eq i32 %6, 0
br i1 %14, label %15, label %30
15: ; preds = %12
%16 = call i8* (...) @ClientScript_NextToken()
%17 = icmp eq i8* %16, null
br i1 %17, label %33, label %18
18: ; preds = %15
%19 = call i64 @Q_stricmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %5, label %21
21: ; preds = %18
%22 = call i32 (...) @ClientScript_PrevToken()
%23 = call i8* (...) @ClientScript_NextToken()
%24 = icmp eq i8* %23, null
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = call i64 @Q_stricmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = call i32 @ClientScript_GetCommand(i8* %4)
br label %30
30: ; preds = %12, %28
%31 = phi i8* [ %4, %28 ], [ %3, %12 ]
%32 = call i32 @ClientScript_ExecText(i8* %31)
br label %33
33: ; preds = %15, %30, %21, %25
ret void
}