#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;

/* Variables and functions */
int /*<<< orphan*/ compile_regex(int /*<<< orphan*/ *, char const *);
int match_regex(int /*<<< orphan*/ *, char const *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int hola;
  regex_t r;
  const char *regex_text;
  const char *find_text;
  if (argc != 3) {
    regex_text = "(/media|/mnt)";
    find_text = "/home 455719.0MB 144368.0MB /mnt 2707.0MB 0.0MB /sdc1 0.0MB "
                "0.0MB /sdd1 1880.0MB 41.0MB";
  } else {
    regex_text = argv[1];
    find_text = argv[2];
  }
  printf("Trying to find '%s' in '%s'\n", regex_text, find_text);
  compile_regex(&r, regex_text);
  hola = match_regex(&r, find_text);
  printf("%d\n", hola);
  regfree(&r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     117b <main+0x3b>
lea    0xe99(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe9c(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1193 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    -0x18(%rbp),%rdi
call   1060 <compile_regex@plt>
mov    -0x28(%rbp),%rsi
lea    -0x18(%rbp),%rdi
call   1050 <match_regex@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1030 <regfree@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jne    1158 <main+0x18>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
jmp    1166 <main+0x26>
lea    0xeaf(%rip),%r14
lea    0xe9a(%rip),%rbx
lea    0xef9(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <compile_regex@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <match_regex@plt>
lea    0xee7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <regfree@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"(/media|/mnt)\00"
@.str.1 = [88 x i8] c"/home 455719.0MB 144368.0MB /mnt 2707.0MB 0.0MB /sdc1 0.0MB 0.0MB /sdd1 1880.0MB 41.0MB\00"
@.str.2 = [29 x i8] c"Trying to find '%s' in '%s'\0A\00"
@.str.3 = [4 x i8] c"%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 i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %2
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %20
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %8
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
store i8* %19, i8** %9
br label %20
20: ; preds = %13, %12
%21 = load i8*, i8** %8
%22 = load i8*, i8** %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22)
%24 = load i8*, i8** %8
%25 = call i32 @compile_regex(i32* %7, i8* %24)
%26 = load i8*, i8** %9
%27 = call i32 @match_regex(i32* %7, i8* %26)
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = call i32 @regfree(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"(/media|/mnt)\00"
@.str.1 = [88 x i8] c"/home 455719.0MB 144368.0MB /mnt 2707.0MB 0.0MB /sdc1 0.0MB 0.0MB /sdd1 1880.0MB 41.0MB\00"
@.str.2 = [29 x i8] c"Trying to find '%s' in '%s'\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
br label %11
11: ; preds = %2, %6
%12 = phi i8* [ %8, %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %2 ]
%13 = phi i8* [ %10, %6 ], [ getelementptr inbounds ([88 x i8], [88 x i8]* @.str.1, i64 0, i64 0), %2 ]
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %13)
%15 = call i32 @compile_regex(i32* %3, i8* %12)
%16 = call i32 @match_regex(i32* %3, i8* %13)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 @regfree(i32* %3)
ret i32 0
}