#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int rm_so;
  int rm_eo;
};
typedef TYPE_1__ regmatch_t;
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int REG_EXTENDED;
int REG_NOMATCH;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int get_regex(char *);
int get_string(char *);
int /*<<< orphan*/ printf(char *, ...);
int regcomp(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ regerror(int, int /*<<< orphan*/ *, char *, int);
int regexec(int /*<<< orphan*/ *, char *, size_t, TYPE_1__ *, int);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int ret = 0;
  regex_t preg;
  char regex[128];
  char errbuf[64];
  int cflags = REG_EXTENDED;
  char string[256];
  size_t nmatch = 10;
  regmatch_t pmatch[10];
  int eflags = 0;
  int error_code = 0;
  int i;
  if (get_regex(regex) == -1) {
    fprintf(stderr, "Error: cannot get a regex\n");
    ret = -1;
    goto error_status;
  }
  printf("The regex is:  %s\n", regex);
  error_code = regcomp(&preg, regex, cflags);
  if (error_code != 0) {
    regerror(error_code, &preg, errbuf, 64);
    fprintf(stderr, "Error: Failed to compile regex!\n");
    fprintf(stderr, "Error: error_code: %d,  error_msg: %s\n", error_code,
            errbuf);
    ret = -1;
    goto error_status;
  }
  printf("Compile sucess!\n");
  while (1) {
    if (get_string(string) == -1) {
      fprintf(stderr, "Error: cannot get a string!\n");
      ret = -1;
      goto error_status;
    }
    printf("The string is: %s\n", string);
    error_code = regexec(&preg, string, nmatch, pmatch, eflags);
    if (error_code == REG_NOMATCH) {
      printf("No Match!\n");
      continue;
    }
    if (error_code != 0) {
      regerror(error_code, &preg, errbuf, 64);
      fprintf(stderr, "Error: Failed to exec regexec!\n");
      fprintf(stderr, "Error: error_code: %d, error_msg: %s\n", error_code,
              errbuf);
      ret = -1;
      goto error_status;
    }
    printf("Success: Matched!\n");
    for (i = 0; i < nmatch && pmatch[i].rm_so != -1; ++i) {
      printf("Position: %d~%d\n", pmatch[i].rm_so, pmatch[i].rm_eo);
    }
  }
error_status:
  regfree(&preg);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xe4(%rbp)
movq   $0xa,-0x1f8(%rbp)
movl   $0x0,-0x254(%rbp)
movl   $0x0,-0x258(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <get_regex@plt>
cmp    $0xffffffff,%eax
jne    1206 <main+0x86>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1465 <main+0x2e5>
lea    -0xa0(%rbp),%rsi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xa0(%rbp),%rsi
mov    -0xe4(%rbp),%edx
lea    -0x18(%rbp),%rdi
call   1070 <regcomp@plt>
mov    %eax,-0x258(%rbp)
cmpl   $0x0,-0x258(%rbp)
je     12a6 <main+0x126>
mov    -0x258(%rbp),%edi
lea    -0xe0(%rbp),%rdx
lea    -0x18(%rbp),%rsi
mov    $0x40,%ecx
call   1090 <regerror@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%edx
lea    -0xe0(%rbp),%rcx
lea    0xdbc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1465 <main+0x2e5>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1f0(%rbp),%rdi
call   1040 <get_string@plt>
cmp    $0xffffffff,%eax
jne    12ec <main+0x16c>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
lea    0xdae(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1465 <main+0x2e5>
lea    -0x1f0(%rbp),%rsi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1f0(%rbp),%rsi
mov    -0x1f8(%rbp),%rdx
lea    -0x250(%rbp),%rcx
mov    -0x254(%rbp),%r8d
lea    -0x18(%rbp),%rdi
call   10a0 <regexec@plt>
mov    %eax,-0x258(%rbp)
mov    -0x258(%rbp),%eax
mov    0x2caf(%rip),%rcx
cmp    (%rcx),%eax
jne    1354 <main+0x1d4>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12b4 <main+0x134>
cmpl   $0x0,-0x258(%rbp)
je     13c3 <main+0x243>
mov    -0x258(%rbp),%edi
lea    -0xe0(%rbp),%rdx
lea    -0x18(%rbp),%rsi
mov    $0x40,%ecx
call   1090 <regerror@plt>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
mov    -0x258(%rbp),%edx
lea    -0xe0(%rbp),%rcx
lea    0xd32(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x14(%rbp)
jmp    1465 <main+0x2e5>
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x25c(%rbp)
movslq -0x25c(%rbp),%rcx
xor    %eax,%eax
cmp    -0x1f8(%rbp),%rcx
mov    %al,-0x25d(%rbp)
jae    140f <main+0x28f>
movslq -0x25c(%rbp),%rax
cmpl   $0xffffffff,-0x250(%rbp,%rax,8)
ff
setne  %al
mov    %al,-0x25d(%rbp)
mov    -0x25d(%rbp),%al
test   $0x1,%al
jne    1422 <main+0x2a2>
jmp    1460 <main+0x2e0>
movslq -0x25c(%rbp),%rax
mov    -0x250(%rbp,%rax,8),%esi
movslq -0x25c(%rbp),%rax
mov    -0x24c(%rbp,%rax,8),%edx
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x25c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x25c(%rbp)
jmp    13db <main+0x25b>
jmp    12b4 <main+0x134>
lea    -0x18(%rbp),%rdi
call   1030 <regfree@plt>
mov    -0x14(%rbp),%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    0x2e28(%rip),%rax
mov    (%rax),%ebx
lea    0xa0(%rsp),%rdi
call   1070 <get_regex@plt>
cmp    $0xffffffff,%eax
je     1236 <main+0xa6>
lea    0xe58(%rip),%rdi
lea    0xa0(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc(%rsp),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
call   1080 <regcomp@plt>
test   %eax,%eax
je     124b <main+0xbb>
mov    %eax,%ebx
lea    0xc(%rsp),%rsi
lea    0x60(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rdx
mov    $0x40,%ecx
call   10a0 <regerror@plt>
mov    0x2dce(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe1a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe2a(%rip),%rsi
mov    %ebx,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1436 <main+0x2a6>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdba(%rip),%rsi
jmp    142f <main+0x29f>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
lea    0x120(%rsp),%rdi
call   1050 <get_string@plt>
cmp    $0xffffffff,%eax
je     141f <main+0x28f>
lea    0xe1f(%rip),%r14
lea    0x120(%rsp),%rbx
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
mov    0x2d5b(%rip),%rbp
jmp    12ad <main+0x11d>
nop
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <get_string@plt>
cmp    $0xffffffff,%eax
je     141f <main+0x28f>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r12,%rcx
xor    %r8d,%r8d
call   10b0 <regexec@plt>
cmp    0x0(%rbp),%eax
je     1290 <main+0x100>
mov    %eax,%r13d
test   %eax,%eax
jne    1457 <main+0x2c7>
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x14(%rsp),%edx
lea    0xdec(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x1c(%rsp),%edx
lea    0xdd1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x20(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x24(%rsp),%edx
lea    0xdb2(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x28(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x2c(%rsp),%edx
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x30(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x34(%rsp),%edx
lea    0xd74(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x38(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x3c(%rsp),%edx
lea    0xd55(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x40(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x44(%rsp),%edx
lea    0xd36(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x48(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x4c(%rsp),%edx
lea    0xd17(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x50(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x54(%rsp),%edx
lea    0xcf8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x58(%rsp),%esi
cmp    $0xffffffff,%esi
je     129c <main+0x10c>
mov    0x5c(%rsp),%edx
lea    0xcd9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    129c <main+0x10c>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
lea    0xc47(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
lea    0xc(%rsp),%rdi
call   1040 <regfree@plt>
mov    $0xffffffff,%eax
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc(%rsp),%rsi
lea    0x60(%rsp),%rbx
mov    %r13d,%edi
mov    %rbx,%rdx
mov    $0x40,%ecx
call   10a0 <regerror@plt>
mov    0x2b60(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xc24(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc33(%rip),%rsi
mov    %r13d,%edx
mov    %rbx,%rcx
jmp    122a <main+0x9a>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Error: cannot get a regex\0A\00"
@.str.1 = [19 x i8] c"The regex is: %s\0A\00"
@.str.2 = [33 x i8] c"Error: Failed to compile regex!\0A\00"
@.str.3 = [39 x i8] c"Error: error_code: %d, error_msg: %s\0A\00"
@.str.4 = [17 x i8] c"Compile sucess!\0A\00"
@.str.5 = [29 x i8] c"Error: cannot get a string!\0A\00"
@.str.6 = [19 x i8] c"The string is: %s\0A\00"
@REG_NOMATCH = global i32 0
@.str.7 = [11 x i8] c"No Match!\0A\00"
@.str.8 = [32 x i8] c"Error: Failed to exec regexec!\0A\00"
@.str.9 = [38 x i8] c"Error: error_code: %d, error_msg: %s\0A\00"
@.str.10 = [19 x i8] c"Success: Matched!\0A\00"
@.str.11 = [17 x i8] c"Position: %d~%d\0A\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 [128 x i8]
%9 = alloca [64 x i8]
%10 = alloca i32
%11 = alloca [256 x i8]
%12 = alloca i64
%13 = alloca [10 x %struct.TYPE_3__]
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%17 = load i32, i32* @REG_EXTENDED
store i32 %17, i32* %10
store i64 10, i64* %12
store i32 0, i32* %14
store i32 0, i32* %15
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%19 = call i32 @get_regex(i8* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %6
br label %109
24: ; preds = %2
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%28 = load i32, i32* %10
%29 = call i32 @regcomp(i32* %7, i8* %27, i32 %28)
store i32 %29, i32* %15
%30 = load i32, i32* %15
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %42
32: ; preds = %24
%33 = load i32, i32* %15
%34 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%35 = call i32 @regerror(i32 %33, i32* %7, i8* %34, i32 64)
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @stderr
%39 = load i32, i32* %15
%40 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %39, i8* %40)
store i32 -1, i32* %6
br label %109
42: ; preds = %24
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %62, %108
%45 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%46 = call i32 @get_string(i8* %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %6
br label %109
51: ; preds = %44
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %52)
%54 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%55 = load i64, i64* %12
%56 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %13, i64 0, i64 0
%57 = load i32, i32* %14
%58 = call i32 @regexec(i32* %7, i8* %54, i64 %55, %struct.TYPE_3__* %56, i32 %57)
store i32 %58, i32* %15
%59 = load i32, i32* %15
%60 = load i32, i32* @REG_NOMATCH
%61 = icmp eq i32 %59, %60
br i1 %61, label %62, label %64
62: ; preds = %51
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %44
64: ; preds = %51
%65 = load i32, i32* %15
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %77
67: ; preds = %64
%68 = load i32, i32* %15
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%70 = call i32 @regerror(i32 %68, i32* %7, i8* %69, i32 64)
%71 = load i32, i32* @stderr
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
%73 = load i32, i32* @stderr
%74 = load i32, i32* %15
%75 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %74, i8* %75)
store i32 -1, i32* %6
br label %109
77: ; preds = %64
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %16
br label %79
79: ; preds = %105, %77
%80 = load i32, i32* %16
%81 = sext i32 %80 to i64
%82 = load i64, i64* %12
%83 = icmp ult i64 %81, %82
br i1 %83, label %84, label %91
84: ; preds = %79
%85 = load i32, i32* %16
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %13, i64 0, i64 %86
%88 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %87, i32 0, i32 0
%89 = load i32, i32* %88
%90 = icmp ne i32 %89, -1
br label %91
91: ; preds = %84, %79
%92 = phi i1 [ false, %79 ], [ %90, %84 ]
br i1 %92, label %93, label %108
93: ; preds = %91
%94 = load i32, i32* %16
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %13, i64 0, i64 %95
%97 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %96, i32 0, i32 0
%98 = load i32, i32* %97
%99 = load i32, i32* %16
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %13, i64 0, i64 %100
%102 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %101, i32 0, i32 1
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %98, i32 %103)
br label %105
105: ; preds = %93
%106 = load i32, i32* %16
%107 = add nsw i32 %106, 1
store i32 %107, i32* %16
br label %79
108: ; preds = %91
br label %44
109: ; preds = %67, %48, %32, %21
%110 = call i32 @regfree(i32* %7)
%111 = load i32, i32* %6
ret i32 %111
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@REG_EXTENDED = global i32 0
@stderr = global i32 0
@.str = [27 x i8] c"Error: cannot get a regex\0A\00"
@.str.1 = [19 x i8] c"The regex is: %s\0A\00"
@.str.2 = [33 x i8] c"Error: Failed to compile regex!\0A\00"
@.str.3 = [39 x i8] c"Error: error_code: %d, error_msg: %s\0A\00"
@.str.5 = [29 x i8] c"Error: cannot get a string!\0A\00"
@.str.6 = [19 x i8] c"The string is: %s\0A\00"
@REG_NOMATCH = global i32 0
@.str.8 = [32 x i8] c"Error: Failed to exec regexec!\0A\00"
@.str.9 = [38 x i8] c"Error: error_code: %d, error_msg: %s\0A\00"
@.str.11 = [17 x i8] c"Position: %d~%d\0A\00"
@str = [16 x i8] c"Compile sucess!\00"
@str.12 = [18 x i8] c"Success: Matched!\00"
@str.13 = [10 x i8] c"No Match!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [128 x i8]
%5 = alloca [64 x i8]
%6 = alloca [256 x i8]
%7 = alloca [10 x %struct.TYPE_3__]
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @REG_EXTENDED
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = bitcast [10 x %struct.TYPE_3__]* %7 to i8*
%14 = call i32 @get_regex(i8* %9)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %128
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%21 = call i32 @regcomp(i32* %3, i8* %9, i32 %11)
%22 = icmp eq i32 %21, 0
br i1 %22, label %29, label %23
23: ; preds = %19
%24 = call i32 @regerror(i32 %21, i32* %3, i8* %10, i32 64)
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %21, i8* %10)
br label %128
29: ; preds = %19
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%31 = call i32 @get_string(i8* %12)
%32 = icmp eq i32 %31, -1
br i1 %32, label %55, label %33
33: ; preds = %29
%34 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 0
%35 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 0, i32 0
%36 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 0, i32 1
%37 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 1, i32 0
%38 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 1, i32 1
%39 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 2, i32 0
%40 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 2, i32 1
%41 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 3, i32 0
%42 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 3, i32 1
%43 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 4, i32 0
%44 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 4, i32 1
%45 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 5, i32 0
%46 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 5, i32 1
%47 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 6, i32 0
%48 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 6, i32 1
%49 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 7, i32 0
%50 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 7, i32 1
%51 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 8, i32 0
%52 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 8, i32 1
%53 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 9, i32 0
%54 = getelementptr inbounds [10 x %struct.TYPE_3__], [10 x %struct.TYPE_3__]* %7, i64 0, i64 9, i32 1
br label %58
55: ; preds = %65, %29
%56 = load i32, i32* @stderr
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
br label %128
58: ; preds = %33, %65
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%60 = call i32 @regexec(i32* %3, i8* %12, i64 10, %struct.TYPE_3__* %34, i32 0)
%61 = load i32, i32* @REG_NOMATCH
%62 = icmp eq i32 %60, %61
br i1 %62, label %63, label %68
63: ; preds = %58
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0))
br label %65
65: ; preds = %76, %80, %85, %90, %95, %100, %105, %110, %115, %120, %125, %63
%66 = call i32 @get_string(i8* %12)
%67 = icmp eq i32 %66, -1
br i1 %67, label %55, label %58
68: ; preds = %58
%69 = icmp eq i32 %60, 0
br i1 %69, label %76, label %70
70: ; preds = %68
%71 = call i32 @regerror(i32 %60, i32* %3, i8* %10, i32 64)
%72 = load i32, i32* @stderr
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %72, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
%74 = load i32, i32* @stderr
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i32 %60, i8* %10)
br label %128
76: ; preds = %68
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.12, i64 0, i64 0))
%78 = load i32, i32* %35
%79 = icmp eq i32 %78, -1
br i1 %79, label %65, label %80
80: ; preds = %76
%81 = load i32, i32* %36
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %78, i32 %81)
%83 = load i32, i32* %37
%84 = icmp eq i32 %83, -1
br i1 %84, label %65, label %85
85: ; preds = %80
%86 = load i32, i32* %38
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %83, i32 %86)
%88 = load i32, i32* %39
%89 = icmp eq i32 %88, -1
br i1 %89, label %65, label %90
90: ; preds = %85
%91 = load i32, i32* %40
%92 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %88, i32 %91)
%93 = load i32, i32* %41
%94 = icmp eq i32 %93, -1
br i1 %94, label %65, label %95
95: ; preds = %90
%96 = load i32, i32* %42
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %93, i32 %96)
%98 = load i32, i32* %43
%99 = icmp eq i32 %98, -1
br i1 %99, label %65, label %100
100: ; preds = %95
%101 = load i32, i32* %44
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %98, i32 %101)
%103 = load i32, i32* %45
%104 = icmp eq i32 %103, -1
br i1 %104, label %65, label %105
105: ; preds = %100
%106 = load i32, i32* %46
%107 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %103, i32 %106)
%108 = load i32, i32* %47
%109 = icmp eq i32 %108, -1
br i1 %109, label %65, label %110
110: ; preds = %105
%111 = load i32, i32* %48
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %108, i32 %111)
%113 = load i32, i32* %49
%114 = icmp eq i32 %113, -1
br i1 %114, label %65, label %115
115: ; preds = %110
%116 = load i32, i32* %50
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %113, i32 %116)
%118 = load i32, i32* %51
%119 = icmp eq i32 %118, -1
br i1 %119, label %65, label %120
120: ; preds = %115
%121 = load i32, i32* %52
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %118, i32 %121)
%123 = load i32, i32* %53
%124 = icmp eq i32 %123, -1
br i1 %124, label %65, label %125
125: ; preds = %120
%126 = load i32, i32* %54
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0), i32 %123, i32 %126)
br label %65
128: ; preds = %70, %55, %23, %16
%129 = call i32 @regfree(i32* %3)
ret i32 -1
}