#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 */
typedef int /*<<< orphan*/ prefix;
typedef int /*<<< orphan*/ domain;

/* Variables and functions */
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
char *hideemail_push_token(void *userdata, char *token, int *extra,
                           int *delta) {
  const char *s;
  char *dst = (char *)userdata;
  char domain[] = "space.io";
  char prefix[] = "mailto:";
  char *pos0;
  char *pos1;
  int len0, len1 = (sizeof(domain) - 1), cmp, lenprefix = (sizeof(prefix) - 1);
  *delta = 1;
  if (!token || !*token)
    return token;
  pos0 = strchr(token, '@');
  pos1 = (pos0 != 0 ? strchr(pos0, '.') : 0);
  if (pos0 == 0 || pos1 == 0)
    return token;
  len0 = strlen(token);
  if (len0 - (pos0 + 1 - token) != len1)
    return 0;
  if (strncmp(pos0 + 1, domain, len1) != 0)
    return 0;
  strcpy(dst, prefix);
  strcpy(dst + lenprefix, token);
  dst[lenprefix + len0] = '\0';
  return dst;
}


x86 assembly (clang, -O0):
<hideemail_push_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0xe96(%rip),%rax
mov    %rax,-0x41(%rbp)
mov    0xe94(%rip),%al
mov    %al,-0x39(%rbp)
mov    0xe8b(%rip),%rax
mov    %rax,-0x49(%rbp)
movl   $0x8,-0x68(%rbp)
movl   $0x7,-0x70(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     11b2 <hideemail_push_token+0x72>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    11bf <hideemail_push_token+0x7f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12ca <hideemail_push_token+0x18a>
mov    -0x18(%rbp),%rdi
mov    $0x40,%esi
call   1060 <strchr@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     11f3 <hideemail_push_token+0xb3>
mov    -0x58(%rbp),%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
mov    %rax,-0x78(%rbp)
jmp    11fe <hideemail_push_token+0xbe>
xor    %eax,%eax
mov    %rax,-0x78(%rbp)
jmp    11fe <hideemail_push_token+0xbe>
mov    -0x78(%rbp),%rax
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     121c <hideemail_push_token+0xdc>
cmpq   $0x0,-0x60(%rbp)
jne    1229 <hideemail_push_token+0xe9>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    12ca <hideemail_push_token+0x18a>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x64(%rbp)
movslq -0x64(%rbp),%rax
mov    -0x58(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
movslq -0x68(%rbp),%rcx
cmp    %rcx,%rax
je     1265 <hideemail_push_token+0x125>
movq   $0x0,-0x8(%rbp)
jmp    12ca <hideemail_push_token+0x18a>
mov    -0x58(%rbp),%rdi
add    $0x1,%rdi
lea    -0x41(%rbp),%rsi
mov    -0x68(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1290 <hideemail_push_token+0x150>
movq   $0x0,-0x8(%rbp)
jmp    12ca <hideemail_push_token+0x18a>
mov    -0x38(%rbp),%rdi
lea    -0x49(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rdi
movslq -0x70(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x38(%rbp),%rax
mov    -0x70(%rbp),%ecx
add    -0x64(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hideemail_push_token>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movabs $0x6f692e6563617073,%rax
2e 69 6f
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
movabs $0x3a6f746c69616d,%rax
mov    %rax,0x10(%rsp)
movl   $0x1,(%rcx)
test   %rsi,%rsi
je     11dd <hideemail_push_token+0x9d>
mov    %rsi,%rbx
cmpb   $0x0,(%rsi)
je     11e2 <hideemail_push_token+0xa2>
mov    %rdi,%r14
mov    %rbx,%rdi
mov    $0x40,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11e2 <hideemail_push_token+0xa2>
mov    %rax,%r15
mov    %rax,%rdi
mov    $0x2e,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11e2 <hideemail_push_token+0xa2>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%r12
add    $0x1,%r15
mov    %rbx,%rax
sub    %r15,%rax
add    %r12,%rax
cmp    $0x8,%rax
jne    11dd <hideemail_push_token+0x9d>
mov    %rsp,%rsi
mov    %r15,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f4 <hideemail_push_token+0xb4>
xor    %r14d,%r14d
jmp    11e5 <hideemail_push_token+0xa5>
mov    %rbx,%r14
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
lea    0x7(%r14),%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
movb   $0x0,0x7(%r12,%r14,1)
jmp    11e5 <hideemail_push_token+0xa5>

LLVM IR (-O0):
@__const.hideemail_push_token.domain = [9 x i8] c"space.io\00"
@__const.hideemail_push_token.prefix = [8 x i8] c"mailto:\00"
define i8* @hideemail_push_token(i8* %0, i8* %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [9 x i8]
%13 = alloca [8 x i8]
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%20 = load i8*, i8** %6
store i8* %20, i8** %11
%21 = bitcast [9 x i8]* %12 to i8*
%22 = bitcast [8 x i8]* %13 to i8*
store i32 8, i32* %17
store i32 7, i32* %19
%23 = load i32*, i32** %9
store i32 1, i32* %23
%24 = load i8*, i8** %7
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %30
26: ; preds = %4
%27 = load i8*, i8** %7
%28 = load i8, i8* %27
%29 = icmp ne i8 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %26, %4
%31 = load i8*, i8** %7
store i8* %31, i8** %5
br label %91
32: ; preds = %26
%33 = load i8*, i8** %7
%34 = call i8* @strchr(i8* %33, i8 signext 64)
store i8* %34, i8** %14
%35 = load i8*, i8** %14
%36 = icmp ne i8* %35, null
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i8*, i8** %14
%39 = call i8* @strchr(i8* %38, i8 signext 46)
br label %41
40: ; preds = %32
br label %41
41: ; preds = %40, %37
%42 = phi i8* [ %39, %37 ], [ null, %40 ]
store i8* %42, i8** %15
%43 = load i8*, i8** %14
%44 = icmp eq i8* %43, null
br i1 %44, label %48, label %45
45: ; preds = %41
%46 = load i8*, i8** %15
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %50
48: ; preds = %45, %41
%49 = load i8*, i8** %7
store i8* %49, i8** %5
br label %91
50: ; preds = %45
%51 = load i8*, i8** %7
%52 = call i32 @strlen(i8* %51)
store i32 %52, i32* %16
%53 = load i32, i32* %16
%54 = sext i32 %53 to i64
%55 = load i8*, i8** %14
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8*, i8** %7
%58 = ptrtoint i8* %56 to i64
%59 = ptrtoint i8* %57 to i64
%60 = sub i64 %58, %59
%61 = sub nsw i64 %54, %60
%62 = load i32, i32* %17
%63 = sext i32 %62 to i64
%64 = icmp ne i64 %61, %63
br i1 %64, label %65, label %66
65: ; preds = %50
store i8* null, i8** %5
br label %91
66: ; preds = %50
%67 = load i8*, i8** %14
%68 = getelementptr inbounds i8, i8* %67, i64 1
%69 = getelementptr inbounds [9 x i8], [9 x i8]* %12, i64 0, i64 0
%70 = load i32, i32* %17
%71 = call i64 @strncmp(i8* %68, i8* %69, i32 %70)
%72 = icmp ne i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %66
store i8* null, i8** %5
br label %91
74: ; preds = %66
%75 = load i8*, i8** %11
%76 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%77 = call i32 @strcpy(i8* %75, i8* %76)
%78 = load i8*, i8** %11
%79 = load i32, i32* %19
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
%82 = load i8*, i8** %7
%83 = call i32 @strcpy(i8* %81, i8* %82)
%84 = load i8*, i8** %11
%85 = load i32, i32* %19
%86 = load i32, i32* %16
%87 = add nsw i32 %85, %86
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %84, i64 %88
store i8 0, i8* %89
%90 = load i8*, i8** %11
store i8* %90, i8** %5
br label %91
91: ; preds = %74, %73, %65, %48, %30
%92 = load i8*, i8** %5
ret i8* %92
}

LLVM IR (-O2):
@__const.hideemail_push_token.domain = [9 x i8] c"space.io\00"
define i8* @hideemail_push_token(i8* %0, i8* %1, i32* nocapture readnone %2, i32* nocapture writeonly %3) {
%5 = alloca [9 x i8]
%6 = alloca i64
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%8 = bitcast i64* %6 to i8*
store i64 16448094474953069, i64* %6
store i32 1, i32* %3
%9 = icmp eq i8* %1, null
br i1 %9, label %38, label %10
10: ; preds = %4
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 0
br i1 %12, label %38, label %13
13: ; preds = %10
%14 = tail call i8* @strchr(i8* %1, i8 signext 64)
%15 = icmp eq i8* %14, null
br i1 %15, label %38, label %16
16: ; preds = %13
%17 = tail call i8* @strchr(i8* %14, i8 signext 46)
%18 = icmp eq i8* %17, null
br i1 %18, label %38, label %19
19: ; preds = %16
%20 = tail call i32 @strlen(i8* %1)
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %14, i64 1
%23 = ptrtoint i8* %22 to i64
%24 = ptrtoint i8* %1 to i64
%25 = sub i64 %24, %23
%26 = add i64 %25, %21
%27 = icmp eq i64 %26, 8
br i1 %27, label %28, label %38
28: ; preds = %19
%29 = call i64 @strncmp(i8* %22, i8* %7, i32 8)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = call i32 @strcpy(i8* %0, i8* %8)
%33 = getelementptr inbounds i8, i8* %0, i64 7
%34 = call i32 @strcpy(i8* %33, i8* %1)
%35 = add nsw i32 %20, 7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %0, i64 %36
store i8 0, i8* %37
br label %38
38: ; preds = %13, %28, %19, %16, %4, %10, %31
%39 = phi i8* [ %0, %31 ], [ %1, %10 ], [ null, %4 ], [ %1, %16 ], [ null, %19 ], [ null, %28 ], [ %1, %13 ]
ret i8* %39
}