#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__ isalpha(char);
scalar_t__ isdigit(char);
scalar_t__ isspace(char);
int mnt(char **s) {
  char c;
  while (isspace(c = **s)) {
    s[0]++;
  }
  if (c == 0)
    return 0;
  if (c == '"')
    return 3;
  if (isdigit(c))
    return 2;
  if (isalpha(c))
    return 1;
  return 4;
}


x86 assembly (clang, -O0):
<mnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     116d <mnt+0x3d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    113c <mnt+0xc>
movsbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jne    1186 <mnt+0x56>
movl   $0x0,-0x4(%rbp)
jmp    11e4 <mnt+0xb4>
movsbl -0x11(%rbp),%eax
cmp    $0x22,%eax
jne    119f <mnt+0x6f>
movl   $0x3,-0x4(%rbp)
jmp    11e4 <mnt+0xb4>
movsbl -0x11(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11be <mnt+0x8e>
movl   $0x2,-0x4(%rbp)
jmp    11e4 <mnt+0xb4>
movsbl -0x11(%rbp),%edi
call   1050 <isalpha@plt>
cmp    $0x0,%rax
je     11dd <mnt+0xad>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <mnt+0xb4>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mnt>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rax
mov    (%rax),%bl
nopl   0x0(%rax)
movsbl %bl,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     115d <mnt+0x2d>
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
movzbl 0x1(%rax),%ebx
jmp    1140 <mnt+0x10>
test   %bl,%bl
je     116d <mnt+0x3d>
cmp    $0x22,%bl
jne    1171 <mnt+0x41>
mov    $0x3,%eax
jmp    119d <mnt+0x6d>
xor    %eax,%eax
jmp    119d <mnt+0x6d>
movsbl %bl,%ebx
mov    %ebx,%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    119d <mnt+0x6d>
mov    %ebx,%edi
call   1050 <isalpha@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
lea    (%rcx,%rcx,2),%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @mnt(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isspace(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isspace(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = phi i8 [ %3, %1 ], [ %9, %6 ]
switch i8 %13, label %15 [
i8 0, label %22
i8 34, label %14
]
14: ; preds = %12
br label %22
15: ; preds = %12
%16 = tail call i64 @isdigit(i8 signext %13)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = tail call i64 @isalpha(i8 signext %13)
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i32 4, i32 1
br label %22
22: ; preds = %18, %15, %12, %14
%23 = phi i32 [ 3, %14 ], [ 0, %12 ], [ 2, %15 ], [ %21, %18 ]
ret i32 %23
}