#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 */
struct cmd_struct {
  int dummy;
};
struct cmd_group {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ help_ambiguous_token(char const *, struct cmd_group const *);
int /*<<< orphan*/ help_unknown_token(char const *, struct cmd_group const *);
int parse_one_token(char const *, struct cmd_group const *,
                    struct cmd_struct const **);
const struct cmd_struct *parse_command_token(const char *arg,
                                             const struct cmd_group *grp) {
  const struct cmd_struct *cmd;
  switch (parse_one_token(arg, grp, &cmd)) {
  case -1:
    help_unknown_token(arg, grp);
  case -2:
    help_ambiguous_token(arg, grp);
  }
  return cmd;
}


x86 assembly (clang, -O0):
<parse_command_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <parse_one_token@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
sub    $0xfffffffe,%eax
je     1182 <parse_command_token+0x52>
jmp    1164 <parse_command_token+0x34>
mov    -0x1c(%rbp),%eax
sub    $0xffffffff,%eax
jne    118f <parse_command_token+0x5f>
jmp    1175 <parse_command_token+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <help_unknown_token@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <help_ambiguous_token@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_command_token>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rdx
call   1040 <parse_one_token@plt>
cmp    $0xfffffffe,%eax
je     1157 <parse_command_token+0x27>
cmp    $0xffffffff,%eax
jne    1162 <parse_command_token+0x32>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <help_unknown_token@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <help_ambiguous_token@plt>
mov    (%rsp),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cmd_struct = type { i32 }
%struct.cmd_group = type { i32 }
define %struct.cmd_struct* @parse_command_token(i8* %0, %struct.cmd_group* %1) {
%3 = alloca i8*
%4 = alloca %struct.cmd_group*
%5 = alloca %struct.cmd_struct*
store i8* %0, i8** %3
store %struct.cmd_group* %1, %struct.cmd_group** %4
%6 = load i8*, i8** %3
%7 = load %struct.cmd_group*, %struct.cmd_group** %4
%8 = call i32 @parse_one_token(i8* %6, %struct.cmd_group* %7, %struct.cmd_struct** %5)
switch i32 %8, label %17 [
i32 -1, label %9
i32 -2, label %13
]
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load %struct.cmd_group*, %struct.cmd_group** %4
%12 = call i32 @help_unknown_token(i8* %10, %struct.cmd_group* %11)
br label %13
13: ; preds = %2, %9
%14 = load i8*, i8** %3
%15 = load %struct.cmd_group*, %struct.cmd_group** %4
%16 = call i32 @help_ambiguous_token(i8* %14, %struct.cmd_group* %15)
br label %17
17: ; preds = %13, %2
%18 = load %struct.cmd_struct*, %struct.cmd_struct** %5
ret %struct.cmd_struct* %18
}

LLVM IR (-O2):
%struct.cmd_struct = type { i32 }
%struct.cmd_group = type { i32 }
define %struct.cmd_struct* @parse_command_token(i8* %0, %struct.cmd_group* %1) {
%3 = alloca %struct.cmd_struct*
%4 = bitcast %struct.cmd_struct** %3 to i8*
%5 = call i32 @parse_one_token(i8* %0, %struct.cmd_group* %1, %struct.cmd_struct** %3)
switch i32 %5, label %10 [
i32 -1, label %6
i32 -2, label %8
]
6: ; preds = %2
%7 = call i32 @help_unknown_token(i8* %0, %struct.cmd_group* %1)
br label %8
8: ; preds = %2, %6
%9 = call i32 @help_ambiguous_token(i8* %0, %struct.cmd_group* %1)
br label %10
10: ; preds = %8, %2
%11 = load %struct.cmd_struct*, %struct.cmd_struct** %3
ret %struct.cmd_struct* %11
}