#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*/ regex_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int REG_EXTENDED;
int REG_NOSUB;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char getc(int /*<<< orphan*/ *);
char *malloc(unsigned int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
char *realloc(char *, unsigned int);
int /*<<< orphan*/ regcomp(int /*<<< orphan*/ *, char *, int);
scalar_t__ regexec(int /*<<< orphan*/ *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *fp;
  regex_t email_regex;
  unsigned sbs = 48, n = 0;
  char c;
  char *sb = malloc(sbs);
  regcomp(&email_regex,
          "^((\"[0-9A-Za-z@.+-=]+\")|([0-9A-Za-z.+-=]+))"
          "@\\w*(\\w+\\.)+\\w{2,4}$",
          REG_EXTENDED | REG_NOSUB);
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while ((c = getc(fp)) != EOF || n > 0) {
    if (c == '\n' || c == EOF) {
      sb[n] = '\0';
      puts(regexec(&email_regex, sb, 0, NULL, 0) ? "false" : "true");
      n = 0;
    } else {
      if (n == sbs - 1) {
        sbs += sbs / 2;
        sb = realloc(sb, sbs);
      }
      sb[n++] = c;
    }
  }
  free(sb);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x30,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    0x2e09(%rip),%rax
mov    (%rax),%edx
mov    0x2e08(%rip),%rax
or     (%rax),%edx
lea    -0x1c(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   1060 <regcomp@plt>
cmpl   $0x2,-0x8(%rbp)
je     120b <main+0x7b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe46(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1336 <main+0x1a6>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe2d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   10b0 <getc@plt>
mov    %al,-0x25(%rbp)
movsbl %al,%ecx
mov    0x2da4(%rip),%rax
movsbl (%rax),%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x31(%rbp)
jne    125e <main+0xce>
cmpl   $0x0,-0x24(%rbp)
seta   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    126e <main+0xde>
jmp    1326 <main+0x196>
movsbl -0x25(%rbp),%eax
cmp    $0xa,%eax
je     1291 <main+0x101>
movsbl -0x25(%rbp),%eax
mov    0x2d62(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    12dd <main+0x14d>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rsi
lea    -0x1c(%rbp),%rdi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1080 <regexec@plt>
mov    %rax,%rcx
lea    0xd9d(%rip),%rdi
lea    0xd90(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1040 <puts@plt>
movl   $0x0,-0x24(%rbp)
jmp    1321 <main+0x191>
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    130a <main+0x17a>
mov    -0x20(%rbp),%eax
shr    $0x1,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1090 <realloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x25(%rbp),%dl
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
mov    %ecx,%ecx
mov    %dl,(%rax,%rcx,1)
jmp    122e <main+0x9e>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    $0x30,%edi
call   1070 <malloc@plt>
mov    %rax,%r13
mov    0x2e19(%rip),%rax
mov    0x2e1a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0xe37(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1060 <regcomp@plt>
cmp    $0x2,%ebx
jne    12cd <main+0x13d>
mov    0x8(%r14),%rdi
lea    0xe6b(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   10b0 <getc@plt>
mov    %eax,%ebx
mov    0x2de6(%rip),%r12
mov    (%r12),%al
cmp    %al,%bl
je     12c1 <main+0x131>
mov    $0x30,%ecx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%r14d
cmp    $0xa,%bl
je     1250 <main+0xc0>
cmp    %al,%bl
je     1250 <main+0xc0>
lea    -0x1(%rcx),%eax
cmp    %eax,%r15d
jne    1290 <main+0x100>
mov    %ecx,%ebp
shr    %ebp
add    %ecx,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
call   1090 <realloc@plt>
mov    %rax,%r13
jmp    1293 <main+0x103>
nopl   0x0(%rax)
mov    %rcx,%rbp
movb   $0x0,0x0(%r13,%r14,1)
xor    %r15d,%r15d
lea    0xc(%rsp),%rdi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1080 <regexec@plt>
test   %rax,%rax
lea    0xdda(%rip),%rdi
lea    0xdd9(%rip),%rax
cmove  %rax,%rdi
call   1040 <puts@plt>
jmp    129c <main+0x10c>
nopl   0x0(%rax)
mov    %rcx,%rbp
add    $0x1,%r15d
mov    %bl,0x0(%r13,%r14,1)
mov    0x10(%rsp),%rdi
call   10b0 <getc@plt>
mov    %eax,%ebx
movzbl (%r12),%eax
cmp    %al,%bl
mov    %rbp,%rcx
jne    1220 <main+0x90>
test   %r15d,%r15d
jne    1220 <main+0x90>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    12e1 <main+0x151>
mov    (%r14),%rsi
lea    0xd69(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [64 x i8] c"^((\22[0-9A-Za-z@.+-=]+\22)|([0-9A-Za-z.+-=]+))@\\w*(\\w+\\.)+\\w{2,4}$\00"
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
@.str.1 = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.2 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.3 = [6 x i8] c"false\00"
@.str.4 = [5 x i8] c"true\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 48, i32* %8
store i32 0, i32* %9
%12 = load i32, i32* %8
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %11
%14 = load i32, i32* @REG_EXTENDED
%15 = load i32, i32* @REG_NOSUB
%16 = or i32 %14, %15
%17 = call i32 @regcomp(i32* %7, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %23)
store i32 1, i32* %3
br label %87
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %5
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %29, i32** %6
br label %30
30: ; preds = %83, %25
%31 = load i32*, i32** %6
%32 = call signext i8 @getc(i32* %31)
store i8 %32, i8* %10
%33 = sext i8 %32 to i32
%34 = load i8, i8* @EOF
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %33, %35
br i1 %36, label %40, label %37
37: ; preds = %30
%38 = load i32, i32* %9
%39 = icmp ugt i32 %38, 0
br label %40
40: ; preds = %37, %30
%41 = phi i1 [ true, %30 ], [ %39, %37 ]
br i1 %41, label %42, label %84
42: ; preds = %40
%43 = load i8, i8* %10
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 10
br i1 %45, label %52, label %46
46: ; preds = %42
%47 = load i8, i8* %10
%48 = sext i8 %47 to i32
%49 = load i8, i8* @EOF
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %48, %50
br i1 %51, label %52, label %63
52: ; preds = %46, %42
%53 = load i8*, i8** %11
%54 = load i32, i32* %9
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 0, i8* %56
%57 = load i8*, i8** %11
%58 = call i64 @regexec(i32* %7, i8* %57, i32 0, i32* null, i32 0)
%59 = icmp ne i64 %58, 0
%60 = zext i1 %59 to i64
%61 = select i1 %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0)
%62 = call i32 @puts(i8* %61)
store i32 0, i32* %9
br label %83
63: ; preds = %46
%64 = load i32, i32* %9
%65 = load i32, i32* %8
%66 = sub i32 %65, 1
%67 = icmp eq i32 %64, %66
br i1 %67, label %68, label %76
68: ; preds = %63
%69 = load i32, i32* %8
%70 = udiv i32 %69, 2
%71 = load i32, i32* %8
%72 = add i32 %71, %70
store i32 %72, i32* %8
%73 = load i8*, i8** %11
%74 = load i32, i32* %8
%75 = call i8* @realloc(i8* %73, i32 %74)
store i8* %75, i8** %11
br label %76
76: ; preds = %68, %63
%77 = load i8, i8* %10
%78 = load i8*, i8** %11
%79 = load i32, i32* %9
%80 = add i32 %79, 1
store i32 %80, i32* %9
%81 = zext i32 %79 to i64
%82 = getelementptr inbounds i8, i8* %78, i64 %81
store i8 %77, i8* %82
br label %83
83: ; preds = %76, %52
br label %30
84: ; preds = %40
%85 = load i8*, i8** %11
%86 = call i32 @free(i8* %85)
store i32 0, i32* %3
br label %87
87: ; preds = %84, %20
%88 = load i32, i32* %3
ret i32 %88
}

LLVM IR (-O2):
@.str = [64 x i8] c"^((\22[0-9A-Za-z@.+-=]+\22)|([0-9A-Za-z.+-=]+))@\\w*(\\w+\\.)+\\w{2,4}$\00"
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
@.str.1 = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.2 = [2 x i8] c"r\00"
@EOF = global i8 0
@.str.3 = [6 x i8] c"false\00"
@.str.4 = [5 x i8] c"true\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call dereferenceable_or_null(48) i8* @malloc(i32 48)
%6 = load i32, i32* @REG_EXTENDED
%7 = load i32, i32* @REG_NOSUB
%8 = or i32 %7, %6
%9 = call i32 @regcomp(i32* %3, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %0, 2
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %62
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = call signext i8 @getc(i32* %17)
%19 = load i8, i8* @EOF
%20 = icmp eq i8 %18, %19
br i1 %20, label %59, label %21
21: ; preds = %14, %50
%22 = phi i8 [ %55, %50 ], [ %19, %14 ]
%23 = phi i8 [ %54, %50 ], [ %18, %14 ]
%24 = phi i8* [ %53, %50 ], [ %5, %14 ]
%25 = phi i32 [ %52, %50 ], [ 0, %14 ]
%26 = phi i32 [ %51, %50 ], [ 48, %14 ]
%27 = icmp eq i8 %23, 10
%28 = icmp eq i8 %23, %22
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %30, label %37
30: ; preds = %21
%31 = zext i32 %25 to i64
%32 = getelementptr inbounds i8, i8* %24, i64 %31
store i8 0, i8* %32
%33 = call i64 @regexec(i32* %3, i8* %24, i32 0, i32* null, i32 0)
%34 = icmp eq i64 %33, 0
%35 = select i1 %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%36 = call i32 @puts(i8* dereferenceable(1) %35)
br label %50
37: ; preds = %21
%38 = add i32 %26, -1
%39 = icmp eq i32 %25, %38
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = lshr i32 %26, 1
%42 = add i32 %41, %26
%43 = call i8* @realloc(i8* %24, i32 %42)
br label %44
44: ; preds = %40, %37
%45 = phi i32 [ %42, %40 ], [ %26, %37 ]
%46 = phi i8* [ %43, %40 ], [ %24, %37 ]
%47 = add i32 %25, 1
%48 = zext i32 %25 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 %23, i8* %49
br label %50
50: ; preds = %44, %30
%51 = phi i32 [ %26, %30 ], [ %45, %44 ]
%52 = phi i32 [ 0, %30 ], [ %47, %44 ]
%53 = phi i8* [ %24, %30 ], [ %46, %44 ]
%54 = call signext i8 @getc(i32* %17)
%55 = load i8, i8* @EOF
%56 = icmp ne i8 %54, %55
%57 = icmp ne i32 %52, 0
%58 = select i1 %56, i1 true, i1 %57
br i1 %58, label %21, label %59
59: ; preds = %50, %14
%60 = phi i8* [ %5, %14 ], [ %53, %50 ]
%61 = call i32 @free(i8* %60)
br label %62
62: ; preds = %59, %11
%63 = phi i32 [ 1, %11 ], [ 0, %59 ]
ret i32 %63
}