type(p) register char *p;
{
  while (*p == ' ' || *p == '?')
    ++p;
  if (*p == 'N')
    return (02);
  if (strncmp(p, ">From ", 6) == 0)
    return (01);
  if (strncmp(p, "From ", 5) == 0)
    return (01);
  return (04);
}


x86 assembly (clang, -O0):
<type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     1141 <type+0x31>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3f,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1151 <type+0x41>
jmp    1162 <type+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <type+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4e,%eax
jne    117e <type+0x6e>
movl   $0x2,-0x4(%rbp)
jmp    11d9 <type+0xc9>
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11a8 <type+0x98>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <type+0xc9>
mov    -0x10(%rbp),%rdi
lea    0xe4e(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11d2 <type+0xc2>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <type+0xc9>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type>:
push   %rbx
mov    %rdi,%rbx
jmp    1124 <type+0x14>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1120 <type+0x10>
cmp    $0x3f,%al
je     1120 <type+0x10>
cmp    $0x4e,%al
jne    113a <type+0x2a>
mov    $0x2,%eax
pop    %rbx
ret
lea    0xebf(%rip),%rsi
mov    $0x6,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1175 <type+0x65>
lea    0xea8(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
lea    (%rcx,%rcx,2),%eax
add    $0x1,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c">From \00"
@.str.1 = [6 x i8] c"From \00"
define i32 @type(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %16, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 32
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 63
br label %14
14: ; preds = %9, %4
%15 = phi i1 [ true, %4 ], [ %13, %9 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %3
br label %4
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 78
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 2, i32* %2
br label %36
25: ; preds = %19
%26 = load i8*, i8** %3
%27 = call i32 @strncmp(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 1, i32* %2
br label %36
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = call i32 @strncmp(i8* %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 5)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 1, i32* %2
br label %36
35: ; preds = %30
store i32 4, i32* %2
br label %36
36: ; preds = %35, %34, %29, %24
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@.str = [7 x i8] c">From \00"
@.str.1 = [6 x i8] c"From \00"
define i32 @type(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 63, label %5
i8 78, label %14
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = tail call i32 @strncmp(i8* %3, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @strncmp(i8* %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 5)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 1, i32 4
br label %14
14: ; preds = %2, %10, %7
%15 = phi i32 [ 1, %7 ], [ %13, %10 ], [ 2, %2 ]
ret i32 %15
}