#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 fgetc(int /*<<< orphan*/);
scalar_t__ is_symbol_char(int);
scalar_t__ isalpha(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
void tokenize_symbol(char *buffer) {
  int i, c;
  for (i = 0; i < 8 - 1; i++) {
    c = fgetc(stdin);
    if (!is_symbol_char(c)) {
      ungetc(c, stdin);
      buffer[i] = '\0';
      return;
    }
    if (isalpha(c)) {
      c &= 0x5f;
    }
    buffer[i] = c;
  }
  buffer[i] = '\0';
  do {
    ;
    c = fgetc(stdin);
  } while (is_symbol_char(c));
  ungetc(c, stdin);
}


x86 assembly (clang, -O0):
<tokenize_symbol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jge    11db <tokenize_symbol+0x9b>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <is_symbol_char@plt>
cmp    $0x0,%rax
jne    11a2 <tokenize_symbol+0x62>
mov    -0x10(%rbp),%edi
mov    0x2e5e(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    121b <tokenize_symbol+0xdb>
mov    -0x10(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11bd <tokenize_symbol+0x7d>
mov    -0x10(%rbp),%eax
and    $0x5f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <tokenize_symbol+0x13>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1060 <is_symbol_char@plt>
cmp    $0x0,%rax
jne    11e7 <tokenize_symbol+0xa7>
mov    -0x10(%rbp),%edi
mov    0x2dd4(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tokenize_symbol>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    0x2e97(%rip),%r14
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     12ea <tokenize_symbol+0x1aa>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     12ee <tokenize_symbol+0x1ae>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x1(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     12f5 <tokenize_symbol+0x1b5>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x2(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     12fc <tokenize_symbol+0x1bc>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x3(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     1303 <tokenize_symbol+0x1c3>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x4(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     130a <tokenize_symbol+0x1ca>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x5(%r15)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
je     1311 <tokenize_symbol+0x1d1>
mov    %ebp,%edi
call   1050 <isalpha@plt>
mov    %ebp,%ecx
and    $0x5f,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebp,%eax
mov    %al,0x6(%r15)
movb   $0x0,0x7(%r15)
cs nopw 0x0(%rax,%rax,1)
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <is_symbol_char@plt>
test   %rax,%rax
jne    12c0 <tokenize_symbol+0x180>
mov    (%r14),%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <ungetc@plt>
xor    %ebx,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x1,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x2,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x3,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x4,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x5,%ebx
jmp    1316 <tokenize_symbol+0x1d6>
mov    $0x6,%ebx
mov    (%r14),%esi
mov    %ebp,%edi
call   1040 <ungetc@plt>
movb   $0x0,(%r15,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
define void @tokenize_symbol(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %36, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 7
br i1 %7, label %8, label %39
8: ; preds = %5
%9 = load i32, i32* @stdin
%10 = call i32 @fgetc(i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i64 @is_symbol_char(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %8
%15 = load i32, i32* %4
%16 = load i32, i32* @stdin
%17 = call i32 @ungetc(i32 %15, i32 %16)
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 0, i8* %21
br label %55
22: ; preds = %8
%23 = load i32, i32* %4
%24 = call i64 @isalpha(i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %4
%28 = and i32 %27, 95
store i32 %28, i32* %4
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %4
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %2
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %29
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %5
39: ; preds = %5
%40 = load i8*, i8** %2
%41 = load i32, i32* %3
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 0, i8* %43
br label %44
44: ; preds = %47, %39
%45 = load i32, i32* @stdin
%46 = call i32 @fgetc(i32 %45)
store i32 %46, i32* %4
br label %47
47: ; preds = %44
%48 = load i32, i32* %4
%49 = call i64 @is_symbol_char(i32 %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %44, label %51
51: ; preds = %47
%52 = load i32, i32* %4
%53 = load i32, i32* @stdin
%54 = call i32 @ungetc(i32 %52, i32 %53)
br label %55
55: ; preds = %51, %14
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @tokenize_symbol(i8* nocapture writeonly %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @fgetc(i32 %2)
%4 = tail call i64 @is_symbol_char(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %66, %55, %44, %33, %22, %12, %1
%7 = phi i64 [ 0, %1 ], [ 1, %12 ], [ 2, %22 ], [ 3, %33 ], [ 4, %44 ], [ 5, %55 ], [ 6, %66 ]
%8 = phi i32 [ %3, %1 ], [ %19, %12 ], [ %30, %22 ], [ %41, %33 ], [ %52, %44 ], [ %63, %55 ], [ %74, %66 ]
%9 = load i32, i32* @stdin
%10 = tail call i32 @ungetc(i32 %8, i32 %9)
%11 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %11
br label %93
12: ; preds = %1
%13 = tail call i64 @isalpha(i32 %3)
%14 = icmp eq i64 %13, 0
%15 = and i32 %3, 95
%16 = select i1 %14, i32 %3, i32 %15
%17 = trunc i32 %16 to i8
store i8 %17, i8* %0
%18 = load i32, i32* @stdin
%19 = tail call i32 @fgetc(i32 %18)
%20 = tail call i64 @is_symbol_char(i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %6, label %22
22: ; preds = %12
%23 = tail call i64 @isalpha(i32 %19)
%24 = icmp eq i64 %23, 0
%25 = and i32 %19, 95
%26 = select i1 %24, i32 %19, i32 %25
%27 = trunc i32 %26 to i8
%28 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %27, i8* %28
%29 = load i32, i32* @stdin
%30 = tail call i32 @fgetc(i32 %29)
%31 = tail call i64 @is_symbol_char(i32 %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %6, label %33
33: ; preds = %22
%34 = tail call i64 @isalpha(i32 %30)
%35 = icmp eq i64 %34, 0
%36 = and i32 %30, 95
%37 = select i1 %35, i32 %30, i32 %36
%38 = trunc i32 %37 to i8
%39 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %38, i8* %39
%40 = load i32, i32* @stdin
%41 = tail call i32 @fgetc(i32 %40)
%42 = tail call i64 @is_symbol_char(i32 %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %6, label %44
44: ; preds = %33
%45 = tail call i64 @isalpha(i32 %41)
%46 = icmp eq i64 %45, 0
%47 = and i32 %41, 95
%48 = select i1 %46, i32 %41, i32 %47
%49 = trunc i32 %48 to i8
%50 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %49, i8* %50
%51 = load i32, i32* @stdin
%52 = tail call i32 @fgetc(i32 %51)
%53 = tail call i64 @is_symbol_char(i32 %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %6, label %55
55: ; preds = %44
%56 = tail call i64 @isalpha(i32 %52)
%57 = icmp eq i64 %56, 0
%58 = and i32 %52, 95
%59 = select i1 %57, i32 %52, i32 %58
%60 = trunc i32 %59 to i8
%61 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %60, i8* %61
%62 = load i32, i32* @stdin
%63 = tail call i32 @fgetc(i32 %62)
%64 = tail call i64 @is_symbol_char(i32 %63)
%65 = icmp eq i64 %64, 0
br i1 %65, label %6, label %66
66: ; preds = %55
%67 = tail call i64 @isalpha(i32 %63)
%68 = icmp eq i64 %67, 0
%69 = and i32 %63, 95
%70 = select i1 %68, i32 %63, i32 %69
%71 = trunc i32 %70 to i8
%72 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %71, i8* %72
%73 = load i32, i32* @stdin
%74 = tail call i32 @fgetc(i32 %73)
%75 = tail call i64 @is_symbol_char(i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %6, label %77
77: ; preds = %66
%78 = tail call i64 @isalpha(i32 %74)
%79 = icmp eq i64 %78, 0
%80 = and i32 %74, 95
%81 = select i1 %79, i32 %74, i32 %80
%82 = trunc i32 %81 to i8
%83 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %82, i8* %83
%84 = getelementptr inbounds i8, i8* %0, i64 7
store i8 0, i8* %84
br label %85
85: ; preds = %85, %77
%86 = load i32, i32* @stdin
%87 = tail call i32 @fgetc(i32 %86)
%88 = tail call i64 @is_symbol_char(i32 %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %85
90: ; preds = %85
%91 = load i32, i32* @stdin
%92 = tail call i32 @ungetc(i32 %87, i32 %91)
br label %93
93: ; preds = %90, %6
ret void
}