#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 */
struct testgroup_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int process_test_alias(struct testgroup_t *, char const *);
int /*<<< orphan*/ tinytest_set_flag_(struct testgroup_t *, char const *, int,
                                      int);
int process_test_option(struct testgroup_t *groups, const char *test) {
  int flag = (1 << 2);
  int n = 0;
  if (test[0] == '@') {
    return process_test_alias(groups, test + 1);
  } else if (test[0] == ':') {
    ++test;
    flag = (1 << 1);
  } else if (test[0] == '+') {
    ++test;
    ++n;
    if (!tinytest_set_flag_(groups, test, 0, (1 << 3))) {
      printf("No such test as %s!\n", test);
      return -1;
    }
  } else {
    ++n;
  }
  if (!tinytest_set_flag_(groups, test, 1, flag)) {
    printf("No such test as %s!\n", test);
    return -1;
  }
  return n;
}


x86 assembly (clang, -O0):
<process_test_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    1177 <process_test_option+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
call   1050 <process_test_alias@plt>
mov    %eax,-0x4(%rbp)
jmp    1255 <process_test_option+0x125>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    119f <process_test_option+0x6f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
jmp    1210 <process_test_option+0xe0>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    1202 <process_test_option+0xd2>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
mov    $0x8,%ecx
call   1040 <tinytest_set_flag_@plt>
cmp    $0x0,%eax
jne    11fd <process_test_option+0xcd>
mov    -0x18(%rbp),%rsi
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1255 <process_test_option+0x125>
jmp    120b <process_test_option+0xdb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1210 <process_test_option+0xe0>
jmp    1215 <process_test_option+0xe5>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%ecx
mov    $0x1,%edx
call   1040 <tinytest_set_flag_@plt>
cmp    $0x0,%eax
jne    124f <process_test_option+0x11f>
mov    -0x18(%rbp),%rsi
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1255 <process_test_option+0x125>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_test_option>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rsi),%al
mov    $0x1,%r14d
mov    $0x4,%r15d
cmp    $0x2b,%al
je     1170 <process_test_option+0x40>
cmp    $0x3a,%al
je     118c <process_test_option+0x5c>
cmp    $0x40,%al
jne    1199 <process_test_option+0x69>
add    $0x1,%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <process_test_alias@plt>
add    $0x1,%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    $0x8,%ecx
call   1040 <tinytest_set_flag_@plt>
test   %eax,%eax
jne    1199 <process_test_option+0x69>
jmp    11b0 <process_test_option+0x80>
add    $0x1,%rbx
xor    %r14d,%r14d
mov    $0x2,%r15d
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
mov    %r15d,%ecx
call   1040 <tinytest_set_flag_@plt>
test   %eax,%eax
jne    11c5 <process_test_option+0x95>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.testgroup_t = type { i32 }
@.str = [21 x i8] c"No such test as %s!\0A\00"
define i32 @process_test_option(%struct.testgroup_t* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.testgroup_t*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.testgroup_t* %0, %struct.testgroup_t** %4
store i8* %1, i8** %5
store i32 4, i32* %6
store i32 0, i32* %7
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 64
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load %struct.testgroup_t*, %struct.testgroup_t** %4
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = call i32 @process_test_alias(%struct.testgroup_t* %14, i8* %16)
store i32 %17, i32* %3
br label %62
18: ; preds = %2
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 58
br i1 %23, label %24, label %27
24: ; preds = %18
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
store i32 2, i32* %6
br label %50
27: ; preds = %18
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 43
br i1 %32, label %33, label %46
33: ; preds = %27
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %5
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
%38 = load %struct.testgroup_t*, %struct.testgroup_t** %4
%39 = load i8*, i8** %5
%40 = call i32 @tinytest_set_flag_(%struct.testgroup_t* %38, i8* %39, i32 0, i32 8)
%41 = icmp ne i32 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %33
%43 = load i8*, i8** %5
%44 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %43)
store i32 -1, i32* %3
br label %62
45: ; preds = %33
br label %49
46: ; preds = %27
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %49
49: ; preds = %46, %45
br label %50
50: ; preds = %49, %24
br label %51
51: ; preds = %50
%52 = load %struct.testgroup_t*, %struct.testgroup_t** %4
%53 = load i8*, i8** %5
%54 = load i32, i32* %6
%55 = call i32 @tinytest_set_flag_(%struct.testgroup_t* %52, i8* %53, i32 1, i32 %54)
%56 = icmp ne i32 %55, 0
br i1 %56, label %60, label %57
57: ; preds = %51
%58 = load i8*, i8** %5
%59 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %58)
store i32 -1, i32* %3
br label %62
60: ; preds = %51
%61 = load i32, i32* %7
store i32 %61, i32* %3
br label %62
62: ; preds = %60, %57, %42, %13
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
%struct.testgroup_t = type { i32 }
@.str = [21 x i8] c"No such test as %s!\0A\00"
define i32 @process_test_option(%struct.testgroup_t* %0, i8* %1) {
%3 = load i8, i8* %1
switch i8 %3, label %15 [
i8 64, label %4
i8 58, label %7
i8 43, label %9
]
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = tail call i32 @process_test_alias(%struct.testgroup_t* %0, i8* %5)
br label %23
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %1, i64 1
br label %15
9: ; preds = %2
%10 = getelementptr inbounds i8, i8* %1, i64 1
%11 = tail call i32 @tinytest_set_flag_(%struct.testgroup_t* %0, i8* %10, i32 0, i32 8)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %23
15: ; preds = %2, %7, %9
%16 = phi i8* [ %8, %7 ], [ %10, %9 ], [ %1, %2 ]
%17 = phi i32 [ 2, %7 ], [ 4, %9 ], [ 4, %2 ]
%18 = phi i32 [ 0, %7 ], [ 1, %9 ], [ 1, %2 ]
%19 = tail call i32 @tinytest_set_flag_(%struct.testgroup_t* %0, i8* %16, i32 1, i32 %17)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %15
%22 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %23
23: ; preds = %15, %21, %13, %4
%24 = phi i32 [ %6, %4 ], [ -1, %21 ], [ -1, %13 ], [ %18, %15 ]
ret i32 %24
}