#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__ calloc(int, int);
int /*<<< orphan*/ isspace(char const);
char *readToken(const char **psrc) {
  char *token = (char *)calloc(64, sizeof(char));
  int i = 0;
  while ((**psrc) != '\0' && !isspace(**psrc)) {
    token[i] = **psrc;
    i++;
    (*psrc)++;
  }
  token[i] = '\0';
  return token;
}


x86 assembly (clang, -O0):
<readToken>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x40,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1178 <readToken+0x58>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1188 <readToken+0x68>
jmp    11b8 <readToken+0x98>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1146 <readToken+0x26>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readToken>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0x40,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
mov    (%r15),%rax
mov    (%rax),%al
xor    %ebx,%ebx
test   %al,%al
je     117c <readToken+0x5c>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    117c <readToken+0x5c>
mov    (%r15),%rax
movzbl (%rax),%eax
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    (%r15),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r15)
movzbl 0x1(%rax),%eax
test   %al,%al
jne    1150 <readToken+0x30>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @readToken(i8** nocapture %0) {
%2 = tail call i64 @calloc(i32 64, i32 1)
%3 = inttoptr i64 %2 to i8*
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %25, label %7
7: ; preds = %1, %13
%8 = phi i64 [ %17, %13 ], [ 0, %1 ]
%9 = phi i8 [ %21, %13 ], [ %5, %1 ]
%10 = phi i32 [ %18, %13 ], [ 0, %1 ]
%11 = tail call i32 @isspace(i8 signext %9)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %7
%14 = load i8*, i8** %0
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %3, i64 %8
store i8 %15, i8* %16
%17 = add nuw i64 %8, 1
%18 = add nuw nsw i32 %10, 1
%19 = load i8*, i8** %0
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8* %20, i8** %0
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %25, label %7
23: ; preds = %7
%24 = trunc i64 %8 to i32
br label %25
25: ; preds = %13, %23, %1
%26 = phi i32 [ 0, %1 ], [ %24, %23 ], [ %18, %13 ]
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %3, i64 %27
store i8 0, i8* %28
ret i8* %3
}