#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*/ alpha(int /*<<< orphan*/);
scalar_t__ alphanumeric(int /*<<< orphan*/);
int /*<<< orphan*/ blanks();
int /*<<< orphan*/ ch();
char gch();
int symname(char *sname) {
  int k;
  blanks();
  if (!alpha(ch()))
    return (0);
  k = 0;
  while (alphanumeric(ch()))
    if (k < 32)
      sname[k++] = gch();
    else
      gch();
  sname[k] = 0;
  return (1);
}


x86 assembly (clang, -O0):
<symname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <blanks@plt>
mov    $0x0,%al
call   1030 <ch@plt>
mov    %eax,%edi
call   1040 <alpha@plt>
cmp    $0x0,%eax
jne    1186 <symname+0x36>
movl   $0x0,-0x4(%rbp)
jmp    11f1 <symname+0xa1>
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <ch@plt>
mov    %eax,%edi
call   1060 <alphanumeric@plt>
cmp    $0x0,%rax
je     11de <symname+0x8e>
cmpl   $0x20,-0x14(%rbp)
jge    11d2 <symname+0x82>
mov    $0x0,%al
call   1070 <gch@plt>
mov    %al,%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    11d9 <symname+0x89>
mov    $0x0,%al
call   1070 <gch@plt>
jmp    118d <symname+0x3d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symname>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <blanks@plt>
xor    %eax,%eax
call   1030 <ch@plt>
mov    %eax,%edi
call   1040 <alpha@plt>
test   %eax,%eax
je     11c6 <symname+0x76>
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <ch@plt>
mov    %eax,%edi
call   1060 <alphanumeric@plt>
test   %rax,%rax
je     11ba <symname+0x6a>
xor    %ebp,%ebp
jmp    11a3 <symname+0x53>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <ch@plt>
mov    %eax,%edi
call   1060 <alphanumeric@plt>
test   %rax,%rax
je     11ba <symname+0x6a>
xor    %eax,%eax
call   1070 <gch@plt>
cmp    $0x1f,%ebp
jg     1190 <symname+0x40>
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,(%rbx,%rcx,1)
jmp    1190 <symname+0x40>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @symname(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = call i32 (...) @blanks()
%6 = call i32 (...) @ch()
%7 = call i32 @alpha(i32 %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %33
10: ; preds = %1
store i32 0, i32* %4
br label %11
11: ; preds = %27, %10
%12 = call i32 (...) @ch()
%13 = call i64 @alphanumeric(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %28
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 32
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = call signext i8 (...) @gch()
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
store i8 %19, i8* %24
br label %27
25: ; preds = %15
%26 = call signext i8 (...) @gch()
br label %27
27: ; preds = %25, %18
br label %11
28: ; preds = %11
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
store i32 1, i32* %2
br label %33
33: ; preds = %28, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @symname(i8* nocapture writeonly %0) {
%2 = tail call i32 (...) @blanks()
%3 = tail call i32 (...) @ch()
%4 = tail call i32 @alpha(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %27, label %6
6: ; preds = %1
%7 = tail call i32 (...) @ch()
%8 = tail call i64 @alphanumeric(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %6, %18
%11 = phi i32 [ %19, %18 ], [ 0, %6 ]
%12 = icmp slt i32 %11, 32
%13 = tail call signext i8 (...) @gch()
br i1 %12, label %14, label %18
14: ; preds = %10
%15 = add nsw i32 %11, 1
%16 = sext i32 %11 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 %13, i8* %17
br label %18
18: ; preds = %10, %14
%19 = phi i32 [ %15, %14 ], [ %11, %10 ]
%20 = tail call i32 (...) @ch()
%21 = tail call i64 @alphanumeric(i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %10
23: ; preds = %18, %6
%24 = phi i32 [ 0, %6 ], [ %19, %18 ]
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
store i8 0, i8* %26
br label %27
27: ; preds = %1, %23
%28 = phi i32 [ 1, %23 ], [ 0, %1 ]
ret i32 %28
}