#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 */
scalar_t__ isSymbol(char const);
int /*<<< orphan*/ isSymbolBeg(char const);
int parseSymbol(const char **str, char *symbol) {
  if (!isSymbolBeg(**str))
    return -1;
  while (isSymbol(**str)) {
    *symbol = **str;
    (*str)++;
    symbol++;
  }
  *symbol = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<parseSymbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1040 <isSymbolBeg@plt>
cmp    $0x0,%eax
jne    1154 <parseSymbol+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <parseSymbol+0x8e>
jmp    1159 <parseSymbol+0x39>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isSymbol@plt>
cmp    $0x0,%rax
je     11a0 <parseSymbol+0x80>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1159 <parseSymbol+0x39>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseSymbol>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rax
movsbl (%rax),%edi
call   1040 <isSymbolBeg@plt>
test   %eax,%eax
je     116d <parseSymbol+0x4d>
mov    (%r14),%rax
movsbl (%rax),%edi
nop
call   1030 <isSymbol@plt>
test   %rax,%rax
je     1166 <parseSymbol+0x46>
mov    (%r14),%rax
movzbl (%rax),%eax
mov    %al,(%rbx)
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
add    $0x1,%rbx
movsbl 0x1(%rax),%edi
jmp    1140 <parseSymbol+0x20>
movb   $0x0,(%rbx)
xor    %eax,%eax
jmp    1172 <parseSymbol+0x52>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @parseSymbol(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
%6 = load i8**, i8*** %4
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = call i32 @isSymbolBeg(i8 signext %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 -1, i32* %3
br label %31
12: ; preds = %2
br label %13
13: ; preds = %19, %12
%14 = load i8**, i8*** %4
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = call i64 @isSymbol(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %13
%20 = load i8**, i8*** %4
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
%23 = load i8*, i8** %5
store i8 %22, i8* %23
%24 = load i8**, i8*** %4
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %24
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
br label %13
29: ; preds = %13
%30 = load i8*, i8** %5
store i8 0, i8* %30
store i32 0, i32* %3
br label %31
31: ; preds = %29, %11
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @parseSymbol(i8** nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8*, i8** %0
%4 = load i8, i8* %3
%5 = tail call i32 @isSymbolBeg(i8 signext %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %24, label %7
7: ; preds = %2
%8 = load i8*, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isSymbol(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %7, %12
%13 = phi i8* [ %18, %12 ], [ %1, %7 ]
%14 = load i8*, i8** %0
%15 = load i8, i8* %14
store i8 %15, i8* %13
%16 = load i8*, i8** %0
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8* %17, i8** %0
%18 = getelementptr inbounds i8, i8* %13, i64 1
%19 = load i8, i8* %17
%20 = tail call i64 @isSymbol(i8 signext %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %12
22: ; preds = %12, %7
%23 = phi i8* [ %1, %7 ], [ %18, %12 ]
store i8 0, i8* %23
br label %24
24: ; preds = %2, %22
%25 = phi i32 [ 0, %22 ], [ -1, %2 ]
ret i32 %25
}