#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);
size_t is_mail_autolink(char *data, size_t size) {
  size_t i = 0, nb = 0;
  for (i = 0; i < size; ++i) {
    if (isalnum(data[i]))
      continue;
    switch (data[i]) {
    case '@':
      nb++;
    case '-':
    case '.':
    case '_':
      break;
    case '>':
      return (nb == 1) ? i + 1 : 0;
    default:
      return 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_mail_autolink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1221 <is_mail_autolink+0x111>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
je     1166 <is_mail_autolink+0x56>
jmp    1210 <is_mail_autolink+0x100>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x2c(%rbp)
add    $0xffffffd3,%eax
sub    $0x2,%eax
jb     11c5 <is_mail_autolink+0xb5>
jmp    1186 <is_mail_autolink+0x76>
mov    -0x2c(%rbp),%eax
sub    $0x3e,%eax
je     11ca <is_mail_autolink+0xba>
jmp    1197 <is_mail_autolink+0x87>
mov    -0x2c(%rbp),%eax
sub    $0x40,%eax
je     11b9 <is_mail_autolink+0xa9>
jmp    11a8 <is_mail_autolink+0x98>
mov    -0x2c(%rbp),%eax
sub    $0x5f,%eax
je     11c5 <is_mail_autolink+0xb5>
jmp    11fe <is_mail_autolink+0xee>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    120b <is_mail_autolink+0xfb>
cmpq   $0x1,-0x28(%rbp)
jne    11e6 <is_mail_autolink+0xd6>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11f1 <is_mail_autolink+0xe1>
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
jmp    11f1 <is_mail_autolink+0xe1>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1229 <is_mail_autolink+0x119>
movq   $0x0,-0x8(%rbp)
jmp    1229 <is_mail_autolink+0x119>
jmp    1210 <is_mail_autolink+0x100>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1138 <is_mail_autolink+0x28>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_mail_autolink>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rsi,%rsi
je     117d <is_mail_autolink+0x6d>
mov    %rsi,%r15
mov    %rdi,%r12
neg    %r15
mov    $0x1,%ebx
xor    %r14d,%r14d
xor    %r13d,%r13d
jmp    1152 <is_mail_autolink+0x42>
lea    -0x2d(%rax),%ecx
cmp    $0x2,%ecx
jae    118d <is_mail_autolink+0x7d>
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
je     1180 <is_mail_autolink+0x70>
movsbl -0x1(%r12,%rbx,1),%edi
call   1030 <isalnum@plt>
test   %rax,%rax
jne    1140 <is_mail_autolink+0x30>
movsbl -0x1(%r12,%rbx,1),%eax
cmp    $0x3f,%eax
jle    1134 <is_mail_autolink+0x24>
cmp    $0x5f,%eax
je     1140 <is_mail_autolink+0x30>
cmp    $0x40,%eax
jne    1180 <is_mail_autolink+0x70>
add    $0x1,%r13
jmp    1140 <is_mail_autolink+0x30>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
cmp    $0x3e,%eax
jne    1180 <is_mail_autolink+0x70>
xor    %r14d,%r14d
cmp    $0x1,%r13
cmove  %rbx,%r14
jmp    1180 <is_mail_autolink+0x70>

LLVM IR (-O0):
define i64 @is_mail_autolink(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 0, i64* %6
store i64 0, i64* %7
store i64 0, i64* %6
br label %8
8: ; preds = %41, %2
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %44
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = load i64, i64* %6
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8, i8* %15
%17 = call i64 @isalnum(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %12
br label %41
20: ; preds = %12
%21 = load i8*, i8** %4
%22 = load i64, i64* %6
%23 = getelementptr inbounds i8, i8* %21, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
switch i32 %25, label %39 [
i32 64, label %26
i32 45, label %29
i32 46, label %29
i32 95, label %29
i32 62, label %30
]
26: ; preds = %20
%27 = load i64, i64* %7
%28 = add i64 %27, 1
store i64 %28, i64* %7
br label %29
29: ; preds = %20, %20, %20, %26
br label %40
30: ; preds = %20
%31 = load i64, i64* %7
%32 = icmp eq i64 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i64, i64* %6
%35 = add i64 %34, 1
br label %37
36: ; preds = %30
br label %37
37: ; preds = %36, %33
%38 = phi i64 [ %35, %33 ], [ 0, %36 ]
store i64 %38, i64* %3
br label %45
39: ; preds = %20
store i64 0, i64* %3
br label %45
40: ; preds = %29
br label %41
41: ; preds = %40, %19
%42 = load i64, i64* %6
%43 = add i64 %42, 1
store i64 %43, i64* %6
br label %8
44: ; preds = %8
store i64 0, i64* %3
br label %45
45: ; preds = %44, %39, %37
%46 = load i64, i64* %3
ret i64 %46
}

LLVM IR (-O2):
define i64 @is_mail_autolink(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %24, label %4
4: ; preds = %2, %20
%5 = phi i64 [ %21, %20 ], [ 0, %2 ]
%6 = phi i64 [ %22, %20 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i64 @isalnum(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %4
%12 = load i8, i8* %7
%13 = sext i8 %12 to i32
switch i32 %13, label %24 [
i32 64, label %14
i32 45, label %20
i32 46, label %20
i32 95, label %20
i32 62, label %16
]
14: ; preds = %11
%15 = add i64 %5, 1
br label %20
16: ; preds = %11
%17 = icmp eq i64 %5, 1
%18 = add nuw i64 %6, 1
%19 = select i1 %17, i64 %18, i64 0
br label %24
20: ; preds = %11, %11, %11, %14, %4
%21 = phi i64 [ %5, %4 ], [ %5, %11 ], [ %5, %11 ], [ %5, %11 ], [ %15, %14 ]
%22 = add nuw i64 %6, 1
%23 = icmp eq i64 %22, %1
br i1 %23, label %24, label %4
24: ; preds = %11, %20, %2, %16
%25 = phi i64 [ %19, %16 ], [ 0, %2 ], [ 0, %20 ], [ 0, %11 ]
ret i64 %25
}