#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ regex_match(char *, char *);
int main(void) {
  char *default_string = "C Language Programming";
  char *pattern = "gra";
  if (regex_match(pattern, default_string) == 0)
    printf("Pattern \'%s\' found into the string \'%s\'", pattern,
           default_string);
  else
    printf("Pattern \'%s\' not found into the string \'%s\'", pattern,
           default_string);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed6(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <regex_match@plt>
cmp    $0x0,%rax
jne    1175 <main+0x55>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
jmp    1189 <main+0x69>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeec(%rip),%rbx
lea    0xece(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <regex_match@plt>
test   %rax,%rax
lea    0xed4(%rip),%rax
lea    0xef5(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"C Language Programming\00"
@.str.1 = [4 x i8] c"gra\00"
@.str.2 = [40 x i8] c"Pattern '%s' found into the string '%s'\00"
@.str.3 = [44 x i8] c"Pattern '%s' not found into the string '%s'\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %2
%6 = call i64 @regex_match(i8* %4, i8* %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10)
br label %16
12: ; preds = %0
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i8* %13, i8* %14)
br label %16
16: ; preds = %12, %8
%17 = load i32, i32* @EXIT_SUCCESS
ret i32 %17
}

LLVM IR (-O2):
@.str = [23 x i8] c"C Language Programming\00"
@.str.1 = [4 x i8] c"gra\00"
@.str.2 = [40 x i8] c"Pattern '%s' found into the string '%s'\00"
@.str.3 = [44 x i8] c"Pattern '%s' not found into the string '%s'\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i64 @regex_match(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}