void test_unite_sorts(void) {
  char *buf;
  do {
    seatest_assert_int_equal(0, vle_compl_add_match("ecz"), __FUNCTION__, 44);
  } while (0);
  vle_compl_finish_group();
  do {
    seatest_assert_int_equal(0, vle_compl_add_match("ecj"), __FUNCTION__, 46);
  } while (0);
  vle_compl_finish_group();
  do {
    seatest_assert_int_equal(0, vle_compl_add_match("eca"), __FUNCTION__, 48);
  } while (0);
  vle_compl_finish_group();
  do {
    seatest_assert_int_equal(3, vle_compl_get_count(), __FUNCTION__, 51);
  } while (0);
  vle_compl_unite_groups();
  do {
    seatest_assert_int_equal(3, vle_compl_get_count(), __FUNCTION__, 55);
  } while (0);
  buf = vle_compl_next();
  do {
    seatest_assert_string_equal("eca", buf, __FUNCTION__, 58);
  } while (0);
  free(buf);
  buf = vle_compl_next();
  do {
    seatest_assert_string_equal("ecj", buf, __FUNCTION__, 62);
  } while (0);
  free(buf);
  buf = vle_compl_next();
  do {
    seatest_assert_string_equal("ecz", buf, __FUNCTION__, 66);
  } while (0);
  free(buf);
}


x86 assembly (clang, -O0):
<test_unite_sorts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1090 <vle_compl_add_match@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe63(%rip),%rdx
mov    $0x2c,%ecx
mov    $0x0,%al
call   1080 <seatest_assert_int_equal@plt>
mov    $0x0,%al
call   1050 <vle_compl_finish_group@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1090 <vle_compl_add_match@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe37(%rip),%rdx
mov    $0x2e,%ecx
mov    $0x0,%al
call   1080 <seatest_assert_int_equal@plt>
mov    $0x0,%al
call   1050 <vle_compl_finish_group@plt>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1090 <vle_compl_add_match@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe0b(%rip),%rdx
mov    $0x30,%ecx
mov    $0x0,%al
call   1080 <seatest_assert_int_equal@plt>
mov    $0x0,%al
call   1050 <vle_compl_finish_group@plt>
mov    $0x0,%al
call   10a0 <vle_compl_get_count@plt>
mov    %eax,%esi
mov    $0x3,%edi
lea    0xde3(%rip),%rdx
mov    $0x33,%ecx
mov    $0x0,%al
call   1080 <seatest_assert_int_equal@plt>
mov    $0x0,%al
call   1060 <vle_compl_unite_groups@plt>
mov    $0x0,%al
call   10a0 <vle_compl_get_count@plt>
mov    %eax,%esi
mov    $0x3,%edi
lea    0xdbb(%rip),%rdx
mov    $0x37,%ecx
mov    $0x0,%al
call   1080 <seatest_assert_int_equal@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xdac(%rip),%rdi
lea    0xd90(%rip),%rdx
mov    $0x3a,%ecx
mov    $0x0,%al
call   1070 <seatest_assert_string_equal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xd74(%rip),%rdi
lea    0xd5c(%rip),%rdx
mov    $0x3e,%ecx
mov    $0x0,%al
call   1070 <seatest_assert_string_equal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xd2b(%rip),%rdi
lea    0xd28(%rip),%rdx
mov    $0x42,%ecx
mov    $0x0,%al
call   1070 <seatest_assert_string_equal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unite_sorts>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xe70(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <vle_compl_add_match@plt>
lea    0xe63(%rip),%r13
xor    %edi,%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    $0x2c,%ecx
xor    %eax,%eax
call   1080 <seatest_assert_int_equal@plt>
xor    %eax,%eax
call   1050 <vle_compl_finish_group@plt>
lea    0xe53(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1090 <vle_compl_add_match@plt>
xor    %edi,%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    $0x2e,%ecx
xor    %eax,%eax
call   1080 <seatest_assert_int_equal@plt>
xor    %eax,%eax
call   1050 <vle_compl_finish_group@plt>
lea    0xe2c(%rip),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1090 <vle_compl_add_match@plt>
xor    %edi,%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    $0x30,%ecx
xor    %eax,%eax
call   1080 <seatest_assert_int_equal@plt>
xor    %eax,%eax
call   1050 <vle_compl_finish_group@plt>
xor    %eax,%eax
call   10a0 <vle_compl_get_count@plt>
mov    $0x3,%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    $0x33,%ecx
xor    %eax,%eax
call   1080 <seatest_assert_int_equal@plt>
xor    %eax,%eax
call   1060 <vle_compl_unite_groups@plt>
xor    %eax,%eax
call   10a0 <vle_compl_get_count@plt>
mov    $0x3,%edi
mov    %eax,%esi
mov    %r13,%rdx
mov    $0x37,%ecx
xor    %eax,%eax
call   1080 <seatest_assert_int_equal@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    $0x3a,%ecx
xor    %eax,%eax
call   1070 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    $0x3e,%ecx
xor    %eax,%eax
call   1070 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    $0x42,%ecx
xor    %eax,%eax
call   1070 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ecz\00"
@__FUNCTION__.test_unite_sorts = [17 x i8] c"test_unite_sorts\00"
@.str.1 = [4 x i8] c"ecj\00"
@.str.2 = [4 x i8] c"eca\00"
define void @test_unite_sorts() {
%1 = alloca i8*
br label %2
2: ; preds = %0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 44)
br label %5
5: ; preds = %2
%6 = call i32 (...) @vle_compl_finish_group()
br label %7
7: ; preds = %5
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 46)
br label %10
10: ; preds = %7
%11 = call i32 (...) @vle_compl_finish_group()
br label %12
12: ; preds = %10
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 48)
br label %15
15: ; preds = %12
%16 = call i32 (...) @vle_compl_finish_group()
br label %17
17: ; preds = %15
%18 = call i32 (...) @vle_compl_get_count()
%19 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 3, i32 %18, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 51)
br label %20
20: ; preds = %17
%21 = call i32 (...) @vle_compl_unite_groups()
br label %22
22: ; preds = %20
%23 = call i32 (...) @vle_compl_get_count()
%24 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 3, i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 55)
br label %25
25: ; preds = %22
%26 = call i32 (...) @vle_compl_next()
%27 = sext i32 %26 to i64
%28 = inttoptr i64 %27 to i8*
store i8* %28, i8** %1
br label %29
29: ; preds = %25
%30 = load i8*, i8** %1
%31 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 58)
br label %32
32: ; preds = %29
%33 = load i8*, i8** %1
%34 = call i32 (...) @vle_compl_next()
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i8*
store i8* %36, i8** %1
br label %37
37: ; preds = %32
%38 = load i8*, i8** %1
%39 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %38, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 62)
br label %40
40: ; preds = %37
%41 = load i8*, i8** %1
%42 = call i32 (...) @vle_compl_next()
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %1
br label %45
45: ; preds = %40
%46 = load i8*, i8** %1
%47 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %46, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 66)
br label %48
48: ; preds = %45
%49 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ecz\00"
@__FUNCTION__.test_unite_sorts = [17 x i8] c"test_unite_sorts\00"
@.str.1 = [4 x i8] c"ecj\00"
@.str.2 = [4 x i8] c"eca\00"
define void @test_unite_sorts() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 44)
%3 = tail call i32 (...) @vle_compl_finish_group()
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 46)
%6 = tail call i32 (...) @vle_compl_finish_group()
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @vle_compl_add_match to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %7, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 48)
%9 = tail call i32 (...) @vle_compl_finish_group()
%10 = tail call i32 (...) @vle_compl_get_count()
%11 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 3, i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 51)
%12 = tail call i32 (...) @vle_compl_unite_groups()
%13 = tail call i32 (...) @vle_compl_get_count()
%14 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 3, i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 55)
%15 = tail call i32 (...) @vle_compl_next()
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 58)
tail call void @free(i8* %17)
%19 = tail call i32 (...) @vle_compl_next()
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i8*
%22 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 62)
tail call void @free(i8* %21)
%23 = tail call i32 (...) @vle_compl_next()
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i8*
%26 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.test_unite_sorts, i64 0, i64 0), i32 66)
tail call void @free(i8* %25)
ret void
}