#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*/ DEBUG(char *);
int /*<<< orphan*/ cmp(char *, char *);
int /*<<< orphan*/ get_string(char *, char *, int);
int /*<<< orphan*/ locate_room(char *, int, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
void parse_pursue(char *line) {
  char buf[512], buf2[512], name[512];
  char *p;
  static int pursue_message;
  DEBUG("parse_pursue");
  if (!cmp("You sense that ^ has entered *", line)) {
    pursue_message = 1;
    get_string(line + 15, name, 512);
    buf[0] = 0;
  }
  if (!pursue_message)
    return;
  if (buf[0] && buf[strlen(buf) - 1] != ' ')
    strcat(buf, " ");
  strcat(buf, line);
  if (strstr(buf, ".")) {
    pursue_message = 0;
    p = strstr(buf, " has entered ");
    if (!p)
      return;
    strcpy(buf2, p + 13);
    p = buf2 + strlen(buf2);
    while (p > buf2) {
      if (*p == ',') {
        *(p++) = '.';
        *p = 0;
        break;
      }
      p--;
    }
    locate_room(buf2, 1, name);
  }
}


x86 assembly (clang, -O0):
<parse_pursue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x620,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe6a(%rip),%rdi
call   1030 <DEBUG@plt>
mov    -0x8(%rbp),%rsi
lea    0xe67(%rip),%rdi
call   1070 <cmp@plt>
cmp    $0x0,%eax
jne    11de <parse_pursue+0x5e>
movl   $0x1,0x2ea6(%rip)
mov    -0x8(%rbp),%rdi
add    $0xf,%rdi
lea    -0x610(%rbp),%rsi
mov    $0x200,%edx
call   1060 <get_string@plt>
movb   $0x0,-0x210(%rbp)
cmpl   $0x0,0x2e7f(%rip)
jne    11f0 <parse_pursue+0x70>
jmp    1360 <parse_pursue+0x1e0>
movsbl -0x210(%rbp),%eax
cmp    $0x0,%eax
je     1235 <parse_pursue+0xb5>
lea    -0x210(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
je     1235 <parse_pursue+0xb5>
lea    -0x210(%rbp),%rdi
lea    0xe0a(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x210(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x210(%rbp),%rdi
lea    0xdd9(%rip),%rsi
call   10a0 <strstr@plt>
cmp    $0x0,%rax
je     1360 <parse_pursue+0x1e0>
movl   $0x0,0x2df8(%rip)
lea    -0x210(%rbp),%rdi
lea    0xdb4(%rip),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x618(%rbp)
cmpq   $0x0,-0x618(%rbp)
jne    1299 <parse_pursue+0x119>
jmp    1360 <parse_pursue+0x1e0>
lea    -0x410(%rbp),%rdi
mov    -0x618(%rbp),%rsi
add    $0xd,%rsi
call   1040 <strcpy@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x620(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x620(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x618(%rbp)
mov    -0x618(%rbp),%rax
lea    -0x410(%rbp),%rcx
cmp    %rcx,%rax
jbe    1348 <parse_pursue+0x1c8>
mov    -0x618(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    1331 <parse_pursue+0x1b1>
mov    -0x618(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x618(%rbp)
movb   $0x2e,(%rax)
mov    -0x618(%rbp),%rax
movb   $0x0,(%rax)
jmp    1348 <parse_pursue+0x1c8>
mov    -0x618(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x618(%rbp)
jmp    12e0 <parse_pursue+0x160>
lea    -0x410(%rbp),%rdi
lea    -0x610(%rbp),%rdx
mov    $0x1,%esi
call   1090 <locate_room@plt>
add    $0x620,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_pursue>:
push   %r14
push   %rbx
sub    $0x608,%rsp
mov    %rdi,%rbx
lea    0xe5c(%rip),%rdi
call   1030 <DEBUG@plt>
lea    0xe5d(%rip),%rdi
mov    %rbx,%rsi
call   1080 <cmp@plt>
test   %eax,%eax
je     11ca <parse_pursue+0x3a>
cmpb   $0x1,0x2ea9(%rip)
je     11fc <parse_pursue+0x6c>
jmp    129a <parse_pursue+0x10a>
movb   $0x1,0x2e9b(%rip)
lea    0xf(%rbx),%rdi
lea    0x400(%rsp),%rsi
mov    $0x200,%edx
call   1060 <get_string@plt>
movb   $0x0,0x200(%rsp)
cmpb   $0x1,0x2e76(%rip)
jne    129a <parse_pursue+0x10a>
lea    0x200(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <strcat@plt>
mov    %r14,%rdi
mov    $0x2e,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     129a <parse_pursue+0x10a>
movb   $0x0,0x2e44(%rip)
lea    0xdfd(%rip),%rsi
lea    0x200(%rsp),%rdi
call   10b0 <strstr@plt>
test   %rax,%rax
je     129a <parse_pursue+0x10a>
add    $0xd,%rax
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1285 <parse_pursue+0xf5>
mov    %eax,%eax
add    %rsp,%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x2c,(%rax)
je     1280 <parse_pursue+0xf0>
add    $0xffffffffffffffff,%rax
cmp    %rbx,%rax
ja     1270 <parse_pursue+0xe0>
jmp    1285 <parse_pursue+0xf5>
movw   $0x2e,(%rax)
mov    %rsp,%rdi
lea    0x400(%rsp),%rdx
mov    $0x1,%esi
call   10a0 <locate_room@plt>
add    $0x608,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@parse_pursue.pursue_message = internal global i32 0
@.str = [13 x i8] c"parse_pursue\00"
@.str.1 = [31 x i8] c"You sense that ^ has entered *\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [14 x i8] c" has entered \00"
define void @parse_pursue(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = alloca [512 x i8]
%6 = alloca i8*
store i8* %0, i8** %2
%7 = call i32 @DEBUG(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 @cmp(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %1
store i32 1, i32* @parse_pursue.pursue_message
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 15
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%15 = call i32 @get_string(i8* %13, i8* %14, i32 512)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
store i8 0, i8* %16
br label %17
17: ; preds = %11, %1
%18 = load i32, i32* @parse_pursue.pursue_message
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %17
br label %81
21: ; preds = %17
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %38
26: ; preds = %21
%27 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 32
br i1 %34, label %35, label %38
35: ; preds = %26
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %35, %26, %21
%39 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%40 = load i8*, i8** %2
%41 = call i32 @strcat(i8* %39, i8* %40)
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%43 = call i8* @strstr(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%44 = icmp ne i8* %43, null
br i1 %44, label %45, label %81
45: ; preds = %38
store i32 0, i32* @parse_pursue.pursue_message
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%47 = call i8* @strstr(i8* %46, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i8* %47, i8** %6
%48 = load i8*, i8** %6
%49 = icmp ne i8* %48, null
br i1 %49, label %51, label %50
50: ; preds = %45
br label %81
51: ; preds = %45
%52 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%53 = load i8*, i8** %6
%54 = getelementptr inbounds i8, i8* %53, i64 13
%55 = call i32 @strcpy(i8* %52, i8* %54)
%56 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%57 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
store i8* %60, i8** %6
br label %61
61: ; preds = %74, %51
%62 = load i8*, i8** %6
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%64 = icmp ugt i8* %62, %63
br i1 %64, label %65, label %77
65: ; preds = %61
%66 = load i8*, i8** %6
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 44
br i1 %69, label %70, label %74
70: ; preds = %65
%71 = load i8*, i8** %6
%72 = getelementptr inbounds i8, i8* %71, i32 1
store i8* %72, i8** %6
store i8 46, i8* %71
%73 = load i8*, i8** %6
store i8 0, i8* %73
br label %77
74: ; preds = %65
%75 = load i8*, i8** %6
%76 = getelementptr inbounds i8, i8* %75, i32 -1
store i8* %76, i8** %6
br label %61
77: ; preds = %70, %61
%78 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%80 = call i32 @locate_room(i8* %78, i32 1, i8* %79)
br label %81
81: ; preds = %20, %50, %77, %38
ret void
}

LLVM IR (-O2):
@parse_pursue.pursue_message = internal unnamed_addr global i1 false
@.str = [13 x i8] c"parse_pursue\00"
@.str.1 = [31 x i8] c"You sense that ^ has entered *\00"
@.str.4 = [14 x i8] c" has entered \00"
define void @parse_pursue(i8* %0) {
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @DEBUG(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @cmp(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
store i1 true, i1* @parse_pursue.pursue_message
%12 = getelementptr inbounds i8, i8* %0, i64 15
%13 = call i32 @get_string(i8* %12, i8* %7, i32 512)
store i8 0, i8* %5
br label %14
14: ; preds = %11, %1
%15 = load i1, i1* @parse_pursue.pursue_message
br i1 %15, label %16, label %42
16: ; preds = %14
%17 = call i32 @strcat(i8* %5, i8* %0)
%18 = call i8* @strchr(i8* %5, i32 46)
%19 = icmp eq i8* %18, null
br i1 %19, label %42, label %20
20: ; preds = %16
store i1 false, i1* @parse_pursue.pursue_message
%21 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %42, label %23
23: ; preds = %20
%24 = getelementptr inbounds i8, i8* %21, i64 13
%25 = call i32 @strcpy(i8* %6, i8* %24)
%26 = call i32 @strlen(i8* %6)
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %40
28: ; preds = %23
%29 = zext i32 %26 to i64
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %29
br label %31
31: ; preds = %28, %37
%32 = phi i8* [ %38, %37 ], [ %30, %28 ]
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 44
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = getelementptr inbounds i8, i8* %32, i64 1
store i8 46, i8* %32
store i8 0, i8* %36
br label %40
37: ; preds = %31
%38 = getelementptr inbounds i8, i8* %32, i64 -1
%39 = icmp ugt i8* %38, %6
br i1 %39, label %31, label %40
40: ; preds = %37, %23, %35
%41 = call i32 @locate_room(i8* %6, i32 1, i8* %7)
br label %42
42: ; preds = %16, %40, %20, %14
ret void
}