#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*/ free(char *);
char *get_token(char const *);
int lookup_meta_token(char *);
char *skip_token(char const *);
int parse_meta_handed(const char *p) {
  char *t;
  int meta;
  int ret = 0;
  if (!p)
    goto ret;
  while (*p) {
    t = get_token(p);
    if (t) {
      meta = lookup_meta_token(t);
      free(t);
    } else
      meta = -9999;
    if (meta == -9999) {
      ret = -9999;
      break;
    }
    ret |= meta;
    p = skip_token(p);
  }
ret:
  return ret;
}


x86 assembly (clang, -O0):
<parse_meta_handed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1163 <parse_meta_handed+0x23>
jmp    11e7 <parse_meta_handed+0xa7>
jmp    1168 <parse_meta_handed+0x28>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e2 <parse_meta_handed+0xa2>
mov    -0x8(%rbp),%rdi
call   1060 <get_token@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a7 <parse_meta_handed+0x67>
mov    -0x10(%rbp),%rdi
call   1040 <lookup_meta_token@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    11ae <parse_meta_handed+0x6e>
movl   $0xffffd8f1,-0x14(%rbp)
cmpl   $0xffffd8f1,-0x14(%rbp)
jne    11c7 <parse_meta_handed+0x87>
movl   $0xffffd8f1,-0x18(%rbp)
jmp    11e2 <parse_meta_handed+0xa2>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <skip_token@plt>
mov    %rax,-0x8(%rbp)
jmp    1168 <parse_meta_handed+0x28>
jmp    11e7 <parse_meta_handed+0xa7>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_meta_handed>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %r15d,%r15d
test   %rdi,%rdi
je     11a6 <parse_meta_handed+0x66>
mov    %rdi,%r14
cmpb   $0x0,(%rdi)
je     11a6 <parse_meta_handed+0x66>
xor    %r12d,%r12d
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <get_token@plt>
mov    $0xffffd8f1,%r15d
test   %rax,%rax
je     11a6 <parse_meta_handed+0x66>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <lookup_meta_token@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
cmp    $0xffffd8f1,%ebp
je     11a6 <parse_meta_handed+0x66>
or     %ebp,%r12d
mov    %r14,%rdi
call   1050 <skip_token@plt>
mov    %rax,%r14
cmpb   $0x0,(%rax)
mov    %r12d,%r15d
jne    1160 <parse_meta_handed+0x20>
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_meta_handed(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %5
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %1
br label %36
9: ; preds = %1
br label %10
10: ; preds = %29, %9
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %35
14: ; preds = %10
%15 = load i8*, i8** %2
%16 = call i8* @get_token(i8* %15)
store i8* %16, i8** %3
%17 = load i8*, i8** %3
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = call i32 @lookup_meta_token(i8* %20)
store i32 %21, i32* %4
%22 = load i8*, i8** %3
%23 = call i32 @free(i8* %22)
br label %25
24: ; preds = %14
store i32 -9999, i32* %4
br label %25
25: ; preds = %24, %19
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, -9999
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 -9999, i32* %5
br label %35
29: ; preds = %25
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = or i32 %31, %30
store i32 %32, i32* %5
%33 = load i8*, i8** %2
%34 = call i8* @skip_token(i8* %33)
store i8* %34, i8** %2
br label %10
35: ; preds = %28, %10
br label %36
36: ; preds = %35, %8
%37 = load i32, i32* %5
ret i32 %37
}

LLVM IR (-O2):
define i32 @parse_meta_handed(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %3, %15
%7 = phi i32 [ %16, %15 ], [ 0, %3 ]
%8 = phi i8* [ %17, %15 ], [ %0, %3 ]
%9 = tail call i8* @get_token(i8* %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %20, label %11
11: ; preds = %6
%12 = tail call i32 @lookup_meta_token(i8* %9)
%13 = tail call i32 @free(i8* %9)
%14 = icmp eq i32 %12, -9999
br i1 %14, label %20, label %15
15: ; preds = %11
%16 = or i32 %12, %7
%17 = tail call i8* @skip_token(i8* %8)
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %6
20: ; preds = %15, %11, %6, %3, %1
%21 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %16, %15 ], [ -9999, %11 ], [ -9999, %6 ]
ret i32 %21
}