// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/parse.c
// Function: matches_regex
int matches_regex (char *buf, const char *regular_expression) {
    pcre *regex_compiled;
    pcre_extra *pcre_optimized;
    int pcre_return;
    int pcre_error_offset;
    int substring_vec[30];
    const char *p_sub_str_match_str;
    const char *pcre_error;

    regex_compiled = pcre_compile(regular_expression, PCRE_MULTILINE,
                                  &pcre_error, &pcre_error_offset, NULL);

    if (regex_compiled == NULL) {
        fprintf(stderr, ERR "parse/matches_regex: Could not compile regular expression: %s (%s)\n",
                regular_expression, pcre_error);
        exit(1);
    }

    pcre_optimized = pcre_study(regex_compiled, 0, &pcre_error);

    if (pcre_error != NULL) {
        fprintf(stderr, ERR "parse/matches_regex: Could not optimize regular expression: %s (%s)\n", regular_expression, pcre_error);
        exit(1);
    }

    pcre_return = pcre_exec(regex_compiled, pcre_optimized, buf,
                            (int)strlen(buf), 0, PCRE_NOTEOL, substring_vec, 30);
    pcre_free(regex_compiled);
    pcre_free(pcre_optimized);

    if (pcre_return > 0) {
        int j;
        for (j=0; j<pcre_return; j++) {
            pcre_get_substring(buf, substring_vec, pcre_return, j, &(p_sub_str_match_str));
            strcpy(regex_group[j], p_sub_str_match_str);
            pcre_free_substring(p_sub_str_match_str);
        }
        //We've found a match
        return 1;
    } else {
        //We've not found a match
        return 0;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movl $0x2, %esi
leaq -0xc0(%rbp), %rdx
leaq -0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0x23b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x130f9
movq 0x12f0d(%rip), %rax     # 0x25fe0
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movq -0xc0(%rbp), %rcx
leaq 0xd25a(%rip), %rsi      # 0x20342
movb $0x0, %al
callq 0x2310
movl $0x1, %edi
callq 0x2260
movq -0x20(%rbp), %rdi
xorl %esi, %esi
leaq -0xc0(%rbp), %rdx
callq 0x23d0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x13146
movq 0x12ec0(%rip), %rax     # 0x25fe0
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movq -0xc0(%rbp), %rcx
leaq 0xd264(%rip), %rsi      # 0x20399
movb $0x0, %al
callq 0x2310
movl $0x1, %edi
callq 0x2260
movq -0x20(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20c0
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movl %eax, %ecx
leaq -0xb0(%rbp), %rax
xorl %r8d, %r8d
movl $0x100, %r9d            # imm = 0x100
movq %rax, (%rsp)
movl $0x1e, 0x8(%rsp)
callq 0x2300
movl %eax, -0x2c(%rbp)
movq 0x12e26(%rip), %rax     # 0x25fd8
movq (%rax), %rax
movq -0x20(%rbp), %rdi
callq *%rax
movq 0x12e16(%rip), %rax     # 0x25fd8
movq (%rax), %rax
movq -0x28(%rbp), %rdi
callq *%rax
cmpl $0x0, -0x2c(%rbp)
jle 0x13250
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jge 0x13247
movq -0x10(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
movl -0x2c(%rbp), %edx
movl -0xc4(%rbp), %ecx
leaq -0xb8(%rbp), %r8
callq 0x2130
movslq -0xc4(%rbp), %rax
leaq 0x140bc(%rip), %rdi     # 0x272d0
imulq $0x190, %rax, %rax      # imm = 0x190
addq %rax, %rdi
movq -0xb8(%rbp), %rsi
callq 0x21c0
movq -0xb8(%rbp), %rdi
callq 0x21a0
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x131db
movl $0x1, -0x4(%rbp)
jmp 0x13257
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)