#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*/ locate_room(char *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
char *strstr(char *, char *);
void parse_fullsense(char *line) {
  char *p;
  char buf[256];
  char name[256];
  char room[256];
  DEBUG("parse_fullsense");
  if (strncmp(line, "You sense ", 10) || strlen(line) > 128)
    return;
  strcpy(buf, line);
  p = strstr(buf, " at ");
  if (!p)
    return;
  *p = 0;
  p += 4;
  strcpy(name, buf + 10);
  strcpy(room, p);
  locate_room(room, 0, name);
}


x86 assembly (clang, -O0):
<parse_fullsense>:
push   %rbp
mov    %rsp,%rbp
sub    $0x310,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <DEBUG@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8a(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    11ae <parse_fullsense+0x4e>
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x80,%eax
jle    11b3 <parse_fullsense+0x53>
jmp    1239 <parse_fullsense+0xd9>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x110(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11ea <parse_fullsense+0x8a>
jmp    1239 <parse_fullsense+0xd9>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
lea    -0x110(%rbp),%rsi
add    $0xa,%rsi
call   1050 <strcpy@plt>
lea    -0x310(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x310(%rbp),%rdi
lea    -0x210(%rbp),%rdx
xor    %esi,%esi
call   1070 <locate_room@plt>
add    $0x310,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_fullsense>:
push   %r15
push   %r14
push   %rbx
sub    $0x300,%rsp
mov    %rdi,%rbx
lea    0xe8a(%rip),%rdi
call   1030 <DEBUG@plt>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1204 <parse_fullsense+0xa4>
mov    %rbx,%rdi
call   1060 <strlen@plt>
cmp    $0x80,%eax
jg     1204 <parse_fullsense+0xa4>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcpy@plt>
lea    0xe63(%rip),%rsi
mov    %r14,%rdi
call   1080 <strstr@plt>
test   %rax,%rax
je     1204 <parse_fullsense+0xa4>
mov    %rax,%rbx
movb   $0x0,(%rax)
add    $0x4,%rbx
lea    0xa(%rsp),%rsi
lea    0x200(%rsp),%r14
mov    %r14,%rdi
call   1050 <strcpy@plt>
lea    0x100(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcpy@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1070 <locate_room@plt>
add    $0x300,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"parse_fullsense\00"
@.str.1 = [11 x i8] c"You sense \00"
@.str.2 = [5 x i8] c" at \00"
define void @parse_fullsense(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
store i8* %0, i8** %2
%7 = call i32 @DEBUG(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10)
%10 = icmp ne i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = icmp sgt i32 %13, 128
br i1 %14, label %15, label %16
15: ; preds = %11, %1
br label %39
16: ; preds = %11
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%18 = load i8*, i8** %2
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%21 = call i8* @strstr(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %21, i8** %3
%22 = load i8*, i8** %3
%23 = icmp ne i8* %22, null
br i1 %23, label %25, label %24
24: ; preds = %16
br label %39
25: ; preds = %16
%26 = load i8*, i8** %3
store i8 0, i8* %26
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i64 4
store i8* %28, i8** %3
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%31 = getelementptr inbounds i8, i8* %30, i64 10
%32 = call i32 @strcpy(i8* %29, i8* %31)
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%34 = load i8*, i8** %3
%35 = call i32 @strcpy(i8* %33, i8* %34)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%37 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%38 = call i32 @locate_room(i8* %36, i32 0, i8* %37)
br label %39
39: ; preds = %25, %24, %15
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"parse_fullsense\00"
@.str.1 = [11 x i8] c"You sense \00"
@.str.2 = [5 x i8] c" at \00"
define void @parse_fullsense(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @DEBUG(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%9 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 10)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %1
%12 = tail call i32 @strlen(i8* %0)
%13 = icmp sgt i32 %12, 128
br i1 %13, label %24, label %14
14: ; preds = %11
%15 = call i32 @strcpy(i8* %5, i8* %0)
%16 = call i8* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %24, label %18
18: ; preds = %14
store i8 0, i8* %16
%19 = getelementptr inbounds i8, i8* %16, i64 4
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 10
%21 = call i32 @strcpy(i8* %6, i8* %20)
%22 = call i32 @strcpy(i8* %7, i8* %19)
%23 = call i32 @locate_room(i8* %7, i32 0, i8* %6)
br label %24
24: ; preds = %14, %1, %11, %18
ret void
}