#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__ isalnum(char);
char *identifier(char *expr, char *name) {
  register int l;
  l = 0;
  while (isalnum(*expr) || *expr == '$')
    name[l++] = *expr++;
  name[l] = '\0';
  return expr;
}


x86 assembly (clang, -O0):
<identifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
jne    1155 <identifier+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1165 <identifier+0x55>
jmp    1190 <identifier+0x80>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1127 <identifier+0x17>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identifier>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1128 <identifier+0x18>
nop
mov    %cl,(%r14,%rbx,1)
add    $0x1,%rbx
movsbl (%r15,%rbx,1),%edi
call   1030 <isalnum@plt>
movzbl (%r15,%rbx,1),%ecx
test   %rax,%rax
jne    1120 <identifier+0x10>
cmp    $0x24,%cl
mov    $0x24,%cl
je     1120 <identifier+0x10>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
add    %rbx,%r15
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @identifier(i8* %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i64 [ %15, %12 ], [ 0, %2 ]
%5 = phi i8* [ %14, %12 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = tail call i64 @isalnum(i8 signext %6)
%8 = icmp eq i64 %7, 0
%9 = load i8, i8* %5
br i1 %8, label %10, label %12
10: ; preds = %3
%11 = icmp eq i8 %9, 36
br i1 %11, label %12, label %17
12: ; preds = %3, %10
%13 = phi i8 [ 36, %10 ], [ %9, %3 ]
%14 = getelementptr inbounds i8, i8* %5, i64 1
%15 = add nuw i64 %4, 1
%16 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 %13, i8* %16
br label %3
17: ; preds = %10
%18 = and i64 %4, 4294967295
%19 = getelementptr inbounds i8, i8* %1, i64 %18
store i8 0, i8* %19
ret i8* %5
}