#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*/ display(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ isspace(char);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void parse_cmd(char *command) {
  char *p = command, *arg;
  while (isspace(*p) && *p != '\0')
    p++;
  if (*p == '\0')
    return;
  command = p;
  while (!isspace(*p) && *p != '\0')
    p++;
  if (*p != '\0')
    *p++ = '\0';
  while (isspace(*p) && *p != '\0')
    p++;
  arg = p;
  if (strcmp(command, "display") == 0) {
    if (*arg != '\0')
      display(arg);
    else
      fprintf(stderr, "usage: display locator\n");
  } else if (strcmp(command, "help") == 0) {
    fprintf(stderr, "You think you need help?\n");
    fprintf(stderr, "  (hint: try the display command)\n");
  } else if (strcmp(command, "quit") == 0) {
    exit(0);
  } else
    fprintf(stderr, "unknown command: %s\n", command);
}


x86 assembly (clang, -O0):
<parse_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
je     1192 <parse_cmd+0x42>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11a2 <parse_cmd+0x52>
jmp    11b3 <parse_cmd+0x63>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1164 <parse_cmd+0x14>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11c8 <parse_cmd+0x78>
jmp    1384 <parse_cmd+0x234>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
jne    11fe <parse_cmd+0xae>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    120e <parse_cmd+0xbe>
jmp    121f <parse_cmd+0xcf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11d0 <parse_cmd+0x80>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1241 <parse_cmd+0xf1>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
jmp    1246 <parse_cmd+0xf6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1b(%rbp)
je     1274 <parse_cmd+0x124>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1b(%rbp)
mov    -0x1b(%rbp),%al
test   $0x1,%al
jne    1284 <parse_cmd+0x134>
jmp    1295 <parse_cmd+0x145>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1246 <parse_cmd+0xf6>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12f1 <parse_cmd+0x1a1>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12d5 <parse_cmd+0x185>
mov    -0x18(%rbp),%rdi
call   1030 <display@plt>
jmp    12ec <parse_cmd+0x19c>
mov    0x2d04(%rip),%rax
mov    (%rax),%edi
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1384 <parse_cmd+0x234>
mov    -0x8(%rbp),%rdi
lea    0xd24(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    133e <parse_cmd+0x1ee>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
lea    0xd0a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2cb7(%rip),%rax
mov    (%rax),%edi
lea    0xd0d(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    137f <parse_cmd+0x22f>
mov    -0x8(%rbp),%rdi
lea    0xd19(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    135f <parse_cmd+0x20f>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xcf4(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    137f <parse_cmd+0x22f>
jmp    1384 <parse_cmd+0x234>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cmd>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
movsbl (%rdi),%edi
nopw   0x0(%rax,%rax,1)
call   1040 <isspace@plt>
test   %rax,%rax
je     117b <parse_cmd+0x2b>
cmpb   $0x0,(%r14)
je     11c8 <parse_cmd+0x78>
movsbl 0x1(%r14),%edi
add    $0x1,%r14
jmp    1160 <parse_cmd+0x10>
mov    (%r14),%al
test   %al,%al
je     11c8 <parse_cmd+0x78>
movsbl %al,%edi
call   1040 <isspace@plt>
mov    %r14,%rbx
test   %rax,%rax
jne    11b7 <parse_cmd+0x67>
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x0,(%rbx)
je     11d0 <parse_cmd+0x80>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %rax,%rax
je     11a0 <parse_cmd+0x50>
cmpb   $0x0,(%rbx)
je     11d0 <parse_cmd+0x80>
movb   $0x0,(%rbx)
mov    0x1(%rbx),%al
add    $0x1,%rbx
jmp    11d2 <parse_cmd+0x82>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
movsbl %al,%edi
cs nopw 0x0(%rax,%rax,1)
nop
call   1040 <isspace@plt>
test   %rax,%rax
je     11f9 <parse_cmd+0xa9>
cmpb   $0x0,(%rbx)
je     11f9 <parse_cmd+0xa9>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    11e0 <parse_cmd+0x90>
lea    0xe00(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1256 <parse_cmd+0x106>
lea    0xe0c(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     126a <parse_cmd+0x11a>
lea    0xe3a(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     12aa <parse_cmd+0x15a>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fprintf@plt>
cmpb   $0x0,(%rbx)
je     128c <parse_cmd+0x13c>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <display@plt>
mov    0x2d6f(%rip),%rbx
mov    (%rbx),%edi
lea    0xdab(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xdb5(%rip),%rsi
jmp    129c <parse_cmd+0x14c>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
lea    0xd6c(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"display\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"usage: display locator\0A\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [26 x i8] c"You think you need help?\0A\00"
@.str.4 = [35 x i8] c" (hint: try the display command)\0A\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [21 x i8] c"unknown command: %s\0A\00"
define void @parse_cmd(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = call i64 @isspace(i8 signext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ false, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %6
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
br label %106
27: ; preds = %21
%28 = load i8*, i8** %3
store i8* %28, i8** %2
br label %29
29: ; preds = %41, %27
%30 = load i8*, i8** %3
%31 = load i8, i8* %30
%32 = call i64 @isspace(i8 signext %31)
%33 = icmp ne i64 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %29
%35 = load i8*, i8** %3
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 0
br label %39
39: ; preds = %34, %29
%40 = phi i1 [ false, %29 ], [ %38, %34 ]
br i1 %40, label %41, label %44
41: ; preds = %39
%42 = load i8*, i8** %3
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %3
br label %29
44: ; preds = %39
%45 = load i8*, i8** %3
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %44
%50 = load i8*, i8** %3
%51 = getelementptr inbounds i8, i8* %50, i32 1
store i8* %51, i8** %3
store i8 0, i8* %50
br label %52
52: ; preds = %49, %44
br label %53
53: ; preds = %65, %52
%54 = load i8*, i8** %3
%55 = load i8, i8* %54
%56 = call i64 @isspace(i8 signext %55)
%57 = icmp ne i64 %56, 0
br i1 %57, label %58, label %63
58: ; preds = %53
%59 = load i8*, i8** %3
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 0
br label %63
63: ; preds = %58, %53
%64 = phi i1 [ false, %53 ], [ %62, %58 ]
br i1 %64, label %65, label %68
65: ; preds = %63
%66 = load i8*, i8** %3
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %3
br label %53
68: ; preds = %63
%69 = load i8*, i8** %3
store i8* %69, i8** %4
%70 = load i8*, i8** %2
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %85
73: ; preds = %68
%74 = load i8*, i8** %4
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %73
%79 = load i8*, i8** %4
%80 = call i32 @display(i8* %79)
br label %84
81: ; preds = %73
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %84
84: ; preds = %81, %78
br label %106
85: ; preds = %68
%86 = load i8*, i8** %2
%87 = call i64 @strcmp(i8* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %94
89: ; preds = %85
%90 = load i32, i32* @stderr
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%92 = load i32, i32* @stderr
%93 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %105
94: ; preds = %85
%95 = load i8*, i8** %2
%96 = call i64 @strcmp(i8* %95, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %94
%99 = call i32 @exit(i32 0)
unreachable
100: ; preds = %94
%101 = load i32, i32* @stderr
%102 = load i8*, i8** %2
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %102)
br label %104
104: ; preds = %100
br label %105
105: ; preds = %104, %89
br label %106
106: ; preds = %26, %105, %84
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"display\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"usage: display locator\0A\00"
@.str.2 = [5 x i8] c"help\00"
@.str.3 = [26 x i8] c"You think you need help?\0A\00"
@.str.4 = [35 x i8] c" (hint: try the display command)\0A\00"
@.str.5 = [5 x i8] c"quit\00"
@.str.6 = [21 x i8] c"unknown command: %s\0A\00"
define void @parse_cmd(i8* %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isspace(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %9
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %79, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = tail call i64 @isspace(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %9, %1
%15 = phi i8* [ %0, %1 ], [ %10, %9 ]
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %79, label %18
18: ; preds = %14
%19 = tail call i64 @isspace(i8 signext %16)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %18, %25
%22 = phi i8* [ %26, %25 ], [ %15, %18 ]
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %37, label %25
25: ; preds = %21
%26 = getelementptr inbounds i8, i8* %22, i64 1
%27 = load i8, i8* %26
%28 = tail call i64 @isspace(i8 signext %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %21, label %30
30: ; preds = %25, %18
%31 = phi i8* [ %15, %18 ], [ %26, %25 ]
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = getelementptr inbounds i8, i8* %31, i64 1
store i8 0, i8* %31
%36 = load i8, i8* %35
br label %37
37: ; preds = %21, %34, %30
%38 = phi i8 [ %36, %34 ], [ 0, %30 ], [ 0, %21 ]
%39 = phi i8* [ %35, %34 ], [ %31, %30 ], [ %22, %21 ]
%40 = tail call i64 @isspace(i8 signext %38)
%41 = icmp eq i64 %40, 0
br i1 %41, label %51, label %42
42: ; preds = %37, %46
%43 = phi i8* [ %47, %46 ], [ %39, %37 ]
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %42
%47 = getelementptr inbounds i8, i8* %43, i64 1
%48 = load i8, i8* %47
%49 = tail call i64 @isspace(i8 signext %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %42
51: ; preds = %42, %46, %37
%52 = phi i8* [ %39, %37 ], [ %47, %46 ], [ %43, %42 ]
%53 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %63
55: ; preds = %51
%56 = load i8, i8* %52
%57 = icmp eq i8 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %55
%59 = tail call i32 @display(i8* %52)
br label %79
60: ; preds = %55
%61 = load i32, i32* @stderr
%62 = tail call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %79
63: ; preds = %51
%64 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %71
66: ; preds = %63
%67 = load i32, i32* @stderr
%68 = tail call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%69 = load i32, i32* @stderr
%70 = tail call i32 (i32, i8*, ...) @fprintf(i32 %69, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %79
71: ; preds = %63
%72 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = tail call i32 @exit(i32 0)
unreachable
76: ; preds = %71
%77 = load i32, i32* @stderr
%78 = tail call i32 (i32, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %15)
br label %79
79: ; preds = %5, %60, %58, %76, %66, %14
ret void
}