#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 /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strstr(char *, char *);
int /*<<< orphan*/ trim(char *);
int splitobjective(char *line, char *regexp, int *excludematchflag) {
  char *startmatch, *regexpStart;
  if (line == (char *)NULL || regexp == (char *)NULL) {
    return (-1);
  }
  if (!strlen(line)) {
    return (-1);
  }
  startmatch = strstr(line, "match=");
  if (startmatch) {
    *excludematchflag = 0;
  } else {
    startmatch = strstr(line, "match!=");
    if (startmatch) {
      *excludematchflag = 1;
    } else {
      return -1;
    }
  }
  regexpStart = startmatch + strlen("match=") + *excludematchflag;
  strcpy(regexp, regexpStart);
  trim(regexp);
  return 1;
}


x86 assembly (clang, -O0):
<splitobjective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116a <splitobjective+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1176 <splitobjective+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    124c <splitobjective+0x10c>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jne    1194 <splitobjective+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    124c <splitobjective+0x10c>
mov    -0x10(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11c2 <splitobjective+0x82>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
jmp    1201 <splitobjective+0xc1>
mov    -0x10(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1060 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11f0 <splitobjective+0xb0>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
jmp    11fc <splitobjective+0xbc>
movl   $0xffffffff,-0x4(%rbp)
jmp    124c <splitobjective+0x10c>
jmp    1201 <splitobjective+0xc1>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xdf0(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
movslq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
call   1050 <trim@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<splitobjective>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     11cf <splitobjective+0x8f>
mov    %rsi,%r12
test   %rsi,%rsi
je     11cf <splitobjective+0x8f>
mov    %rdx,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
je     11cf <splitobjective+0x8f>
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     1184 <splitobjective+0x44>
mov    %rax,%r15
xor    %eax,%eax
jmp    11a0 <splitobjective+0x60>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     11cf <splitobjective+0x8f>
mov    %rax,%r15
mov    $0x1,%eax
mov    %eax,(%r14)
lea    0xe56(%rip),%rdi
call   1040 <strlen@plt>
cltq
add    %r15,%rax
movslq (%r14),%rsi
add    %rax,%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   1050 <trim@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"match=\00"
@.str.1 = [8 x i8] c"match!=\00"
define i32 @splitobjective(i8* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %3
%13 = load i8*, i8** %6
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %12, %3
store i32 -1, i32* %4
br label %51
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = call i32 @strlen(i8* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
store i32 -1, i32* %4
br label %51
21: ; preds = %16
%22 = load i8*, i8** %5
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = load i32*, i32** %7
store i32 0, i32* %27
br label %37
28: ; preds = %21
%29 = load i8*, i8** %5
%30 = call i8* @strstr(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i8* %30, i8** %8
%31 = load i8*, i8** %8
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = load i32*, i32** %7
store i32 1, i32* %34
br label %36
35: ; preds = %28
store i32 -1, i32* %4
br label %51
36: ; preds = %33
br label %37
37: ; preds = %36, %26
%38 = load i8*, i8** %8
%39 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i32*, i32** %7
%43 = load i32, i32* %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %41, i64 %44
store i8* %45, i8** %9
%46 = load i8*, i8** %6
%47 = load i8*, i8** %9
%48 = call i32 @strcpy(i8* %46, i8* %47)
%49 = load i8*, i8** %6
%50 = call i32 @trim(i8* %49)
store i32 1, i32* %4
br label %51
51: ; preds = %37, %35, %20, %15
%52 = load i32, i32* %4
ret i32 %52
}

LLVM IR (-O2):
@.str = [7 x i8] c"match=\00"
@.str.1 = [8 x i8] c"match!=\00"
define i32 @splitobjective(i8* %0, i8* %1, i32* nocapture %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %1, null
%6 = or i1 %4, %5
br i1 %6, label %27, label %7
7: ; preds = %3
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %27, label %10
10: ; preds = %7
%11 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i8* %14, null
br i1 %15, label %27, label %16
16: ; preds = %13, %10
%17 = phi i32 [ 0, %10 ], [ 1, %13 ]
%18 = phi i8* [ %11, %10 ], [ %14, %13 ]
store i32 %17, i32* %2
%19 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = tail call i32 @strcpy(i8* %1, i8* %24)
%26 = tail call i32 @trim(i8* %1)
br label %27
27: ; preds = %13, %7, %3, %16
%28 = phi i32 [ 1, %16 ], [ -1, %3 ], [ -1, %7 ], [ -1, %13 ]
ret i32 %28
}