#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__ isalpha(char);
scalar_t__ isdigit(char);
void getSymbol(char *des, char *src, char **end) {
  while (isalpha(*src) || isdigit(*src) || *src == '_') {
    *des++ = *src++;
  }
  *des = 0;
  if (end)
    *end = src;
}


x86 assembly (clang, -O0):
<getSymbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
jne    1180 <getSymbol+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x19(%rbp)
jne    1180 <getSymbol+0x60>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1190 <getSymbol+0x70>
jmp    11b7 <getSymbol+0x97>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1134 <getSymbol+0x14>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     11d4 <getSymbol+0xb4>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSymbol>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
jmp    113e <getSymbol+0x1e>
movzbl (%rbx),%eax
add    $0x1,%rbx
mov    %al,(%r15)
add    $0x1,%r15
movsbl (%rbx),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    1130 <getSymbol+0x10>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1130 <getSymbol+0x10>
cmpb   $0x5f,(%rbx)
je     1130 <getSymbol+0x10>
movb   $0x0,(%r15)
test   %r14,%r14
je     1169 <getSymbol+0x49>
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @getSymbol(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
br label %7
7: ; preds = %24, %3
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = call i64 @isalpha(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %22, label %12
12: ; preds = %7
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = call i64 @isdigit(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %22, label %17
17: ; preds = %12
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 95
br label %22
22: ; preds = %17, %12, %7
%23 = phi i1 [ true, %12 ], [ true, %7 ], [ %21, %17 ]
br i1 %23, label %24, label %30
24: ; preds = %22
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
%27 = load i8, i8* %25
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
store i8 %27, i8* %28
br label %7
30: ; preds = %22
%31 = load i8*, i8** %4
store i8 0, i8* %31
%32 = load i8**, i8*** %6
%33 = icmp ne i8** %32, null
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = load i8**, i8*** %6
store i8* %35, i8** %36
br label %37
37: ; preds = %34, %30
ret void
}

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