#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);
scalar_t__ ispunct(char);
char *get_token(char **s) {
  static char buffer[500];
  char *buf_ptr = buffer, *skip_space();
  *s = skip_space(*s);
  if (!**s)
    return "";
  if (ispunct(**s)) {
    *buf_ptr = **s;
    buf_ptr++;
    (*s)++;
    *buf_ptr = '\0';
    return buffer;
  }
  while (**s && isalnum(**s)) {
    *buf_ptr = **s;
    buf_ptr++;
    (*s)++;
  }
  *buf_ptr = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<get_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    0x2f0d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1030 <skip_space@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
jne    117f <get_token+0x4f>
lea    0xe8a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125e <get_token+0x12e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1050 <ispunct@plt>
cmp    $0x0,%rax
je     11d8 <get_token+0xa8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e81(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    125e <get_token+0x12e>
jmp    11dd <get_token+0xad>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     120e <get_token+0xde>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1040 <isalnum@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    121e <get_token+0xee>
jmp    124c <get_token+0x11c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    11dd <get_token+0xad>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2df6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_token>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
xor    %eax,%eax
call   1030 <skip_space@plt>
mov    %rax,(%r14)
mov    (%rax),%al
test   %al,%al
je     1179 <get_token+0x49>
movsbl %al,%edi
call   1050 <ispunct@plt>
mov    (%r14),%rcx
mov    (%rcx),%cl
test   %rax,%rax
je     1188 <get_token+0x58>
mov    %cl,0x2eee(%rip)
addq   $0x1,(%r14)
lea    0x2ee4(%rip),%rbx
movb   $0x0,(%rbx)
lea    0x2ed9(%rip),%rax
jmp    1180 <get_token+0x50>
lea    0xe80(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0x2ec1(%rip),%rbx
test   %cl,%cl
je     116d <get_token+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %cl,%edi
call   1040 <isalnum@plt>
test   %rax,%rax
je     116d <get_token+0x3d>
mov    (%r14),%rax
movzbl (%rax),%eax
mov    %al,(%rbx)
add    $0x1,%rbx
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movzbl 0x1(%rax),%ecx
test   %cl,%cl
jne    11a0 <get_token+0x70>
jmp    116d <get_token+0x3d>

LLVM IR (-O0):
@get_token.buffer = internal global [500 x i8] zeroinitializer
@.str = [1 x i8] zeroinitializer
define i8* @get_token(i8** %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), i8** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = call i8* (i8*, ...) bitcast (i8* (...)* @skip_space to i8* (i8*, ...)*)(i8* %6)
%8 = load i8**, i8*** %3
store i8* %7, i8** %8
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %58
14: ; preds = %1
%15 = load i8**, i8*** %3
%16 = load i8*, i8** %15
%17 = load i8, i8* %16
%18 = call i64 @ispunct(i8 signext %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %14
%21 = load i8**, i8*** %3
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = load i8*, i8** %4
store i8 %23, i8* %24
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
%27 = load i8**, i8*** %3
%28 = load i8*, i8** %27
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %27
%30 = load i8*, i8** %4
store i8 0, i8* %30
store i8* getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), i8** %2
br label %58
31: ; preds = %14
br label %32
32: ; preds = %46, %31
%33 = load i8**, i8*** %3
%34 = load i8*, i8** %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i8**, i8*** %3
%40 = load i8*, i8** %39
%41 = load i8, i8* %40
%42 = call i64 @isalnum(i8 signext %41)
%43 = icmp ne i64 %42, 0
br label %44
44: ; preds = %38, %32
%45 = phi i1 [ false, %32 ], [ %43, %38 ]
br i1 %45, label %46, label %56
46: ; preds = %44
%47 = load i8**, i8*** %3
%48 = load i8*, i8** %47
%49 = load i8, i8* %48
%50 = load i8*, i8** %4
store i8 %49, i8* %50
%51 = load i8*, i8** %4
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %4
%53 = load i8**, i8*** %3
%54 = load i8*, i8** %53
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %53
br label %32
56: ; preds = %44
%57 = load i8*, i8** %4
store i8 0, i8* %57
store i8* getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), i8** %2
br label %58
58: ; preds = %56, %20, %13
%59 = load i8*, i8** %2
ret i8* %59
}

LLVM IR (-O2):
@get_token.buffer = internal global [500 x i8] zeroinitializer
@.str = [1 x i8] zeroinitializer
define i8* @get_token(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* (i8*, ...) bitcast (i8* (...)* @skip_space to i8* (i8*, ...)*)(i8* %2)
store i8* %3, i8** %0
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %31, label %6
6: ; preds = %1
%7 = tail call i64 @ispunct(i8 signext %4)
%8 = icmp eq i64 %7, 0
%9 = load i8*, i8** %0
%10 = load i8, i8* %9
br i1 %8, label %11, label %13
11: ; preds = %6
%12 = icmp eq i8 %10, 0
br i1 %12, label %29, label %16
13: ; preds = %6
store i8 %10, i8* getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0)
%14 = load i8*, i8** %0
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %0
br label %29
16: ; preds = %11, %21
%17 = phi i8 [ %27, %21 ], [ %10, %11 ]
%18 = phi i8* [ %24, %21 ], [ getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), %11 ]
%19 = tail call i64 @isalnum(i8 signext %17)
%20 = icmp eq i64 %19, 0
br i1 %20, label %29, label %21
21: ; preds = %16
%22 = load i8*, i8** %0
%23 = load i8, i8* %22
store i8 %23, i8* %18
%24 = getelementptr inbounds i8, i8* %18, i64 1
%25 = load i8*, i8** %0
%26 = getelementptr inbounds i8, i8* %25, i64 1
store i8* %26, i8** %0
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %16
29: ; preds = %21, %16, %11, %13
%30 = phi i8* [ getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 1), %13 ], [ getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), %11 ], [ %24, %21 ], [ %18, %16 ]
store i8 0, i8* %30
br label %31
31: ; preds = %29, %1
%32 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([500 x i8], [500 x i8]* @get_token.buffer, i64 0, i64 0), %29 ]
ret i8* %32
}