#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(unsigned char);
int /*<<< orphan*/ toupper(unsigned char);
int get_name(char *src, char *dst) {
  int l = 0;
  while ((isalnum((unsigned char)(*src))) || (*src == '_') || (*src == '?') ||
         (*src == '@')) {
    *dst++ = toupper((unsigned char)(*src++));
    l++;
  }
  *dst = 0;
  return l;
}


x86 assembly (clang, -O0):
<get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
jne    118f <get_name+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x5f,%ecx
mov    %al,-0x15(%rbp)
je     118f <get_name+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x3f,%ecx
mov    %al,-0x15(%rbp)
je     118f <get_name+0x6f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    119f <get_name+0x7f>
jmp    11d7 <get_name+0xb7>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <get_name+0x17>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_name>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
movabs $0x100000003,%r12
jmp    1150 <get_name+0x30>
nopl   0x0(%rax)
movzbl %cl,%edi
call   1030 <toupper@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
movzbl (%r15,%rbx,1),%edi
call   1040 <isalnum@plt>
movzbl (%r15,%rbx,1),%ecx
test   %rax,%rax
jne    1140 <get_name+0x20>
lea    -0x3f(%rcx),%eax
cmp    $0x20,%al
ja     1174 <get_name+0x54>
movzbl %al,%eax
bt     %rax,%r12
jb     1140 <get_name+0x20>
movb   $0x0,(%r14,%rbx,1)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @get_name(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 = %28, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = call i64 @isalnum(i8 zeroext %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %26, 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, 95
br i1 %15, label %26, label %16
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 63
br i1 %20, label %26, label %21
21: ; preds = %16
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 64
br label %26
26: ; preds = %21, %16, %11, %6
%27 = phi i1 [ true, %16 ], [ true, %11 ], [ true, %6 ], [ %25, %21 ]
br i1 %27, label %28, label %38
28: ; preds = %26
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
%31 = load i8, i8* %29
%32 = call i32 @toupper(i8 zeroext %31)
%33 = trunc i32 %32 to i8
%34 = load i8*, i8** %4
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %4
store i8 %33, i8* %34
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %6
38: ; preds = %26
%39 = load i8*, i8** %4
store i8 0, i8* %39
%40 = load i32, i32* %5
ret i32 %40
}

LLVM IR (-O2):
define i32 @get_name(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %12, %2
%4 = phi i8* [ %0, %2 ], [ %13, %12 ]
%5 = phi i8* [ %1, %2 ], [ %16, %12 ]
%6 = phi i32 [ 0, %2 ], [ %17, %12 ]
%7 = load i8, i8* %4
%8 = tail call i64 @isalnum(i8 zeroext %7)
%9 = icmp eq i64 %8, 0
%10 = load i8, i8* %4
br i1 %9, label %11, label %12
11: ; preds = %3
switch i8 %10, label %18 [
i8 95, label %12
i8 63, label %12
i8 64, label %12
]
12: ; preds = %3, %11, %11, %11
%13 = getelementptr inbounds i8, i8* %4, i64 1
%14 = tail call i32 @toupper(i8 zeroext %10)
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %15, i8* %5
%17 = add nuw nsw i32 %6, 1
br label %3
18: ; preds = %11
store i8 0, i8* %5
ret i32 %6
}