#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 BUFSIZ;
int /*<<< orphan*/ printf(char *, ...);
char *regcmp(char const *, int /*<<< orphan*/ *);
char *regex(char const *, char *, ...);
int /*<<< orphan*/ strncpy(char *, char *, int);
main(int argc, char **argv) {
  const char *wsre = "^[ \t]*";
  const char *cwsre = NULL;
  if ((cwsre = regcmp(wsre, NULL)) == NULL)
    printf("regcmp failed ...\n");
  else
    printf("regcmp succeeded ...\n");
  const char *conre = "[^;:\'\"]*([;:\'\"])$0";
  const char *cconre = NULL;
  if ((cconre = regcmp(conre, NULL)) == NULL)
    printf("regcmp failed ...\n");
  else
    printf("regcmp succeeded ...\n");
  for (int arg = 1; arg < argc; arg++) {
    char *cursor = argv[arg];
    char *newcursor = NULL;
    char strval[BUFSIZ];
    if ((newcursor = regex(cwsre, cursor)) != NULL) {
      cursor = newcursor;
    }
    char *startname = cursor;
    char *endname = cursor;
    int found = 0;
    for (int done = 0;
         !done && (newcursor = regex(cconre, cursor, strval)) != NULL;) {
      if (*strval == ':' && *newcursor == ':') {
        cursor = newcursor + 1;
      } else {
        endname = newcursor - 1;
        strncpy(strval, startname, endname - startname);
        strval[endname - startname] = '\0';
        printf("FOUND A NAME ... <%s>\n", strval);
        found = done = 1;
        continue;
      }
    }
    if (!found)
      printf("NOT A NAME ... %s\n", startname);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <regcmp@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    119a <main+0x5a>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11a8 <main+0x68>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe81(%rip),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <regcmp@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11e9 <main+0xa9>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    11f7 <main+0xb7>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1392 <main+0x252>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    0x2db7(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1030 <regex@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     1273 <main+0x133>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x70(%rbp)
mov    %al,-0x79(%rbp)
jne    12c1 <main+0x181>
mov    -0x78(%rbp),%rdx
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1030 <regex@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    12d1 <main+0x191>
jmp    1361 <main+0x221>
mov    -0x78(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1302 <main+0x1c2>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1302 <main+0x1c2>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    135c <main+0x21c>
mov    -0x78(%rbp),%rdi
mov    -0x48(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rax
mov    -0x60(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1040 <strncpy@plt>
mov    -0x78(%rbp),%rsi
mov    -0x68(%rbp),%rax
mov    -0x60(%rbp),%rcx
sub    %rcx,%rax
movb   $0x0,(%rsi,%rax,1)
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x70(%rbp)
movl   $0x1,-0x6c(%rbp)
jmp    1291 <main+0x151>
jmp    1291 <main+0x151>
cmpl   $0x0,-0x6c(%rbp)
jne    137d <main+0x23d>
mov    -0x60(%rbp),%rsi
lea    0xce4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x50(%rbp),%rax
mov    %rax,%rsp
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11fe <main+0xbe>
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,-0x40(%rbp)
mov    %edi,%r12d
lea    0xe91(%rip),%rdi
xor    %esi,%esi
call   1060 <regcmp@plt>
mov    %rax,-0x48(%rbp)
test   %rax,%rax
lea    0xed5(%rip),%r14
lea    0xeb9(%rip),%r13
mov    %r13,%rdi
cmove  %r14,%rdi
call   1050 <puts@plt>
lea    0xe69(%rip),%rdi
xor    %esi,%esi
call   1060 <regcmp@plt>
mov    %rax,-0x38(%rbp)
test   %rax,%rax
cmove  %r14,%r13
mov    %r13,%rdi
call   1050 <puts@plt>
cmp    $0x2,%r12d
jl     12ab <main+0x15b>
mov    %r12d,%eax
mov    %rax,-0x30(%rbp)
mov    $0x1,%r15d
jmp    1203 <main+0xb3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe4a(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x50(%rbp),%rsp
add    $0x1,%r15
cmp    -0x30(%rbp),%r15
je     12ab <main+0x15b>
mov    %rsp,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax,%r15,8),%r14
mov    0x2dca(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x48(%rbp),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <regex@plt>
mov    %rax,%r12
test   %rax,%rax
cmove  %r14,%r12
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdx
xor    %eax,%eax
call   1030 <regex@plt>
test   %rax,%rax
je     11e0 <main+0x90>
cmpb   $0x3a,0x0(%r13)
jne    1280 <main+0x130>
cmpb   $0x3a,(%rax)
jne    1280 <main+0x130>
add    $0x1,%rax
mov    %rbx,%rdi
mov    %rax,%rsi
jmp    1250 <main+0x100>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rbx
not    %rbx
add    %rax,%rbx
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <strncpy@plt>
movb   $0x0,0x0(%r13,%rbx,1)
lea    0xd77(%rip),%rdi
mov    %r13,%rsi
jmp    11ea <main+0x9a>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"^[ \09]*\00"
@.str.1 = [19 x i8] c"regcmp failed ...\0A\00"
@.str.2 = [22 x i8] c"regcmp succeeded ...\0A\00"
@.str.3 = [19 x i8] c"[^;:'\22]*([;:'\22])$0\00"
@BUFSIZ = global i32 0
@.str.4 = [23 x i8] c"FOUND A NAME ... <%s>\0A\00"
@.str.5 = [19 x i8] c"NOT A NAME ... %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
store i8* null, i8** %7
%19 = load i8*, i8** %6
%20 = call i8* @regcmp(i8* %19, i32* null)
store i8* %20, i8** %7
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %26
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8** %8
store i8* null, i8** %9
%27 = load i8*, i8** %8
%28 = call i8* @regcmp(i8* %27, i32* null)
store i8* %28, i8** %9
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %34
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
store i32 1, i32* %10
br label %35
35: ; preds = %107, %34
%36 = load i32, i32* %10
%37 = load i32, i32* %4
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %110
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
store i8* %44, i8** %11
store i8* null, i8** %12
%45 = load i32, i32* @BUFSIZ
%46 = zext i32 %45 to i64
%47 = call i8* @llvm.stacksave()
store i8* %47, i8** %13
%48 = alloca i8, i64 %46
store i64 %46, i64* %14
%49 = load i8*, i8** %7
%50 = load i8*, i8** %11
%51 = call i8* (i8*, i8*, ...) @regex(i8* %49, i8* %50)
store i8* %51, i8** %12
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %55
53: ; preds = %39
%54 = load i8*, i8** %12
store i8* %54, i8** %11
br label %55
55: ; preds = %53, %39
%56 = load i8*, i8** %11
store i8* %56, i8** %15
%57 = load i8*, i8** %11
store i8* %57, i8** %16
store i32 0, i32* %17
store i32 0, i32* %18
br label %58
58: ; preds = %98, %80, %55
%59 = load i32, i32* %18
%60 = icmp ne i32 %59, 0
br i1 %60, label %66, label %61
61: ; preds = %58
%62 = load i8*, i8** %9
%63 = load i8*, i8** %11
%64 = call i8* (i8*, i8*, ...) @regex(i8* %62, i8* %63, i8* %48)
store i8* %64, i8** %12
%65 = icmp ne i8* %64, null
br label %66
66: ; preds = %61, %58
%67 = phi i1 [ false, %58 ], [ %65, %61 ]
br i1 %67, label %68, label %99
68: ; preds = %66
%69 = load i8, i8* %48
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 58
br i1 %71, label %72, label %80
72: ; preds = %68
%73 = load i8*, i8** %12
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 58
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = load i8*, i8** %12
%79 = getelementptr inbounds i8, i8* %78, i64 1
store i8* %79, i8** %11
br label %98
80: ; preds = %72, %68
%81 = load i8*, i8** %12
%82 = getelementptr inbounds i8, i8* %81, i64 -1
store i8* %82, i8** %16
%83 = load i8*, i8** %15
%84 = load i8*, i8** %16
%85 = load i8*, i8** %15
%86 = ptrtoint i8* %84 to i64
%87 = ptrtoint i8* %85 to i64
%88 = sub i64 %86, %87
%89 = trunc i64 %88 to i32
%90 = call i32 @strncpy(i8* %48, i8* %83, i32 %89)
%91 = load i8*, i8** %16
%92 = load i8*, i8** %15
%93 = ptrtoint i8* %91 to i64
%94 = ptrtoint i8* %92 to i64
%95 = sub i64 %93, %94
%96 = getelementptr inbounds i8, i8* %48, i64 %95
store i8 0, i8* %96
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %48)
store i32 1, i32* %18
store i32 1, i32* %17
br label %58
98: ; preds = %77
br label %58
99: ; preds = %66
%100 = load i32, i32* %17
%101 = icmp ne i32 %100, 0
br i1 %101, label %105, label %102
102: ; preds = %99
%103 = load i8*, i8** %15
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %103)
br label %105
105: ; preds = %102, %99
%106 = load i8*, i8** %13
br label %107
107: ; preds = %105
%108 = load i32, i32* %10
%109 = add nsw i32 %108, 1
store i32 %109, i32* %10
br label %35
110: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"^[ \09]*\00"
@.str.3 = [19 x i8] c"[^;:'\22]*([;:'\22])$0\00"
@BUFSIZ = global i32 0
@.str.4 = [23 x i8] c"FOUND A NAME ... <%s>\0A\00"
@.str.5 = [19 x i8] c"NOT A NAME ... %s\0A\00"
@str.6 = [21 x i8] c"regcmp succeeded ...\00"
@str.8 = [18 x i8] c"regcmp failed ...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i8* @regcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* null)
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = tail call i8* @regcmp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32* null)
%8 = icmp eq i8* %7, null
%9 = select i1 %8, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0)
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
%11 = icmp sgt i32 %0, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = zext i32 %0 to i64
br label %15
14: ; preds = %50, %2
ret i32 0
15: ; preds = %12, %50
%16 = phi i64 [ 1, %12 ], [ %51, %50 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = load i32, i32* @BUFSIZ
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
%22 = alloca i8, i64 %20
%23 = call i8* (i8*, i8*, ...) @regex(i8* %3, i8* %18)
%24 = icmp eq i8* %23, null
%25 = select i1 %24, i8* %18, i8* %23
%26 = ptrtoint i8* %25 to i64
%27 = call i8* (i8*, i8*, ...) @regex(i8* %7, i8* %25, i8* %22)
%28 = icmp eq i8* %27, null
br i1 %28, label %48, label %37
29: ; preds = %37, %41
%30 = getelementptr inbounds i8, i8* %38, i64 -1
%31 = ptrtoint i8* %30 to i64
%32 = sub i64 %31, %26
%33 = trunc i64 %32 to i32
%34 = call i32 @strncpy(i8* %22, i8* %25, i32 %33)
%35 = getelementptr inbounds i8, i8* %22, i64 %32
store i8 0, i8* %35
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %22)
br label %50
37: ; preds = %15, %44
%38 = phi i8* [ %46, %44 ], [ %27, %15 ]
%39 = load i8, i8* %22
%40 = icmp eq i8 %39, 58
br i1 %40, label %41, label %29
41: ; preds = %37
%42 = load i8, i8* %38
%43 = icmp eq i8 %42, 58
br i1 %43, label %44, label %29
44: ; preds = %41
%45 = getelementptr inbounds i8, i8* %38, i64 1
%46 = call i8* (i8*, i8*, ...) @regex(i8* %7, i8* %45, i8* %22)
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %37
48: ; preds = %44, %15
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %25)
br label %50
50: ; preds = %29, %48
%51 = add nuw nsw i64 %16, 1
%52 = icmp eq i64 %51, %13
br i1 %52, label %14, label %15
}