#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 */
int /*<<< orphan*/ *strchr(char *, char);
size_t strlen(char *);
char *strrchr(char *, char);
int /*<<< orphan*/ *strstr(char *, char *);
int e_mail_check(char *email) {
  char ch;
  char *last_arobas;
  size_t len = strlen(email);
  if (len < 3 || len > 39)
    return 0;
  if (strchr(email, '@') == NULL || email[len - 1] == '@')
    return 0;
  if (email[len - 1] == '.')
    return 0;
  last_arobas = strrchr(email, '@');
  if (strstr(last_arobas, "@.") != NULL || strstr(last_arobas, "..") != NULL)
    return 0;
  for (ch = 1; ch < 32; ch++)
    if (strchr(last_arobas, ch) != NULL)
      return 0;
  if (strchr(last_arobas, ' ') != NULL || strchr(last_arobas, ';') != NULL)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<e_mail_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x3,-0x28(%rbp)
jb     116f <e_mail_check+0x2f>
cmpq   $0x27,-0x28(%rbp)
jbe    117b <e_mail_check+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
mov    -0x10(%rbp),%rdi
mov    $0x40,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     11ac <e_mail_check+0x6c>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x40,%eax
jne    11b8 <e_mail_check+0x78>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    11dd <e_mail_check+0x9d>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
mov    -0x10(%rbp),%rdi
mov    $0x40,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
jne    1223 <e_mail_check+0xe3>
mov    -0x20(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     122f <e_mail_check+0xef>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
movb   $0x1,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jge    1275 <e_mail_check+0x135>
mov    -0x20(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1263 <e_mail_check+0x123>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
jmp    1268 <e_mail_check+0x128>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    1233 <e_mail_check+0xf3>
mov    -0x20(%rbp),%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    12a5 <e_mail_check+0x165>
mov    -0x20(%rbp),%rdi
mov    $0x3b,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     12b1 <e_mail_check+0x171>
movl   $0x0,-0x4(%rbp)
jmp    12b8 <e_mail_check+0x178>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_mail_check>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rbp
add    $0xffffffffffffffd8,%rax
xor    %r15d,%r15d
cmp    $0xffffffffffffffdb,%rax
jb     11b5 <e_mail_check+0x75>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11b5 <e_mail_check+0x75>
mov    -0x1(%rbp,%rbx,1),%al
cmp    $0x2e,%al
je     11b5 <e_mail_check+0x75>
cmp    $0x40,%al
je     11b5 <e_mail_check+0x75>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1050 <strrchr@plt>
mov    %rax,%r14
lea    0xe6c(%rip),%rsi
mov    %rax,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
jne    11b5 <e_mail_check+0x75>
lea    0xe5b(%rip),%rsi
mov    %r14,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     11c3 <e_mail_check+0x83>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%bl
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %bl,%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
jne    11b5 <e_mail_check+0x75>
add    $0x1,%bl
cmp    $0x20,%bl
jne    11d0 <e_mail_check+0x90>
mov    %r14,%rdi
mov    $0x20,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    11b5 <e_mail_check+0x75>
mov    %r14,%rdi
mov    $0x3b,%esi
call   1040 <strchr@plt>
xor    %r15d,%r15d
test   %rax,%rax
sete   %r15b
jmp    11b5 <e_mail_check+0x75>

LLVM IR (-O0):
@.str = [3 x i8] c"@.\00"
@.str.1 = [3 x i8] c"..\00"
define i32 @e_mail_check(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = icmp ult i64 %9, 3
br i1 %10, label %14, label %11
11: ; preds = %1
%12 = load i64, i64* %6
%13 = icmp ugt i64 %12, 39
br i1 %13, label %14, label %15
14: ; preds = %11, %1
store i32 0, i32* %2
br label %73
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32* @strchr(i8* %16, i8 signext 64)
%18 = icmp eq i32* %17, null
br i1 %18, label %27, label %19
19: ; preds = %15
%20 = load i8*, i8** %3
%21 = load i64, i64* %6
%22 = sub i64 %21, 1
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 64
br i1 %26, label %27, label %28
27: ; preds = %19, %15
store i32 0, i32* %2
br label %73
28: ; preds = %19
%29 = load i8*, i8** %3
%30 = load i64, i64* %6
%31 = sub i64 %30, 1
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 46
br i1 %35, label %36, label %37
36: ; preds = %28
store i32 0, i32* %2
br label %73
37: ; preds = %28
%38 = load i8*, i8** %3
%39 = call i8* @strrchr(i8* %38, i8 signext 64)
store i8* %39, i8** %5
%40 = load i8*, i8** %5
%41 = call i32* @strstr(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%42 = icmp ne i32* %41, null
br i1 %42, label %47, label %43
43: ; preds = %37
%44 = load i8*, i8** %5
%45 = call i32* @strstr(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp ne i32* %45, null
br i1 %46, label %47, label %48
47: ; preds = %43, %37
store i32 0, i32* %2
br label %73
48: ; preds = %43
store i8 1, i8* %4
br label %49
49: ; preds = %60, %48
%50 = load i8, i8* %4
%51 = sext i8 %50 to i32
%52 = icmp slt i32 %51, 32
br i1 %52, label %53, label %63
53: ; preds = %49
%54 = load i8*, i8** %5
%55 = load i8, i8* %4
%56 = call i32* @strchr(i8* %54, i8 signext %55)
%57 = icmp ne i32* %56, null
br i1 %57, label %58, label %59
58: ; preds = %53
store i32 0, i32* %2
br label %73
59: ; preds = %53
br label %60
60: ; preds = %59
%61 = load i8, i8* %4
%62 = add i8 %61, 1
store i8 %62, i8* %4
br label %49
63: ; preds = %49
%64 = load i8*, i8** %5
%65 = call i32* @strchr(i8* %64, i8 signext 32)
%66 = icmp ne i32* %65, null
br i1 %66, label %71, label %67
67: ; preds = %63
%68 = load i8*, i8** %5
%69 = call i32* @strchr(i8* %68, i8 signext 59)
%70 = icmp ne i32* %69, null
br i1 %70, label %71, label %72
71: ; preds = %67, %63
store i32 0, i32* %2
br label %73
72: ; preds = %67
store i32 1, i32* %2
br label %73
73: ; preds = %72, %71, %58, %47, %36, %27, %14
%74 = load i32, i32* %2
ret i32 %74
}

LLVM IR (-O2):
@.str = [3 x i8] c"@.\00"
@.str.1 = [3 x i8] c"..\00"
define i32 @e_mail_check(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, -40
%4 = icmp ult i64 %3, -37
br i1 %4, label %33, label %5
5: ; preds = %1
%6 = tail call i32* @strchr(i8* %0, i8 signext 64)
%7 = icmp eq i32* %6, null
br i1 %7, label %33, label %8
8: ; preds = %5
%9 = add nsw i64 %2, -1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
switch i8 %11, label %12 [
i8 64, label %33
i8 46, label %33
]
12: ; preds = %8
%13 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 64)
%14 = tail call i32* @strstr(i8* dereferenceable(1) %13, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = tail call i32* @strstr(i8* dereferenceable(1) %13, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i32* %17, null
br i1 %18, label %22, label %33
19: ; preds = %22
%20 = add nuw nsw i8 %23, 1
%21 = icmp eq i8 %20, 32
br i1 %21, label %26, label %22
22: ; preds = %16, %19
%23 = phi i8 [ %20, %19 ], [ 1, %16 ]
%24 = tail call i32* @strchr(i8* %13, i8 signext %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %19, label %33
26: ; preds = %19
%27 = tail call i32* @strchr(i8* %13, i8 signext 32)
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = tail call i32* @strchr(i8* %13, i8 signext 59)
%31 = icmp eq i32* %30, null
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %22, %29, %26, %12, %16, %8, %8, %5, %1
%34 = phi i32 [ 0, %1 ], [ 0, %8 ], [ 0, %5 ], [ 0, %8 ], [ 0, %16 ], [ 0, %12 ], [ 0, %26 ], [ %32, %29 ], [ 0, %22 ]
ret i32 %34
}