void test_charset_completion_skips_entered_elements(void) {
  const char *start;
  char *completed;
  vle_compl_reset();
  complete_options("cpo=a", &start);
  completed = vle_compl_next();
  do {
    seatest_assert_string_equal("b", completed, __FUNCTION__, 386);
  } while (0);
  free(completed);
  completed = vle_compl_next();
  do {
    seatest_assert_string_equal("c", completed, __FUNCTION__, 390);
  } while (0);
  free(completed);
  completed = vle_compl_next();
  do {
    seatest_assert_string_equal("", completed, __FUNCTION__, 394);
  } while (0);
  free(completed);
  completed = vle_compl_next();
  do {
    seatest_assert_string_equal("b", completed, __FUNCTION__, 398);
  } while (0);
  free(completed);
}


x86 assembly (clang, -O0):
<test_charset_completion_skips_entered_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <vle_compl_reset@plt>
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <complete_options@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe7d(%rip),%rdi
lea    0xe78(%rip),%rdx
mov    $0x182,%ecx
mov    $0x0,%al
call   1060 <seatest_assert_string_equal@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
lea    0xe44(%rip),%rdx
mov    $0x186,%ecx
mov    $0x0,%al
call   1060 <seatest_assert_string_equal@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe14(%rip),%rdi
lea    0xe10(%rip),%rdx
mov    $0x18a,%ecx
mov    $0x0,%al
call   1060 <seatest_assert_string_equal@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <vle_compl_next@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xde1(%rip),%rdi
lea    0xddc(%rip),%rdx
mov    $0x18e,%ecx
mov    $0x0,%al
call   1060 <seatest_assert_string_equal@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_charset_completion_skips_entered_elements>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <vle_compl_reset@plt>
lea    0xe99(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <complete_options@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
lea    0xe82(%rip),%r14
lea    0xe7d(%rip),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    $0x182,%ecx
xor    %eax,%eax
call   1060 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
lea    0xe7e(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    $0x186,%ecx
xor    %eax,%eax
call   1060 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <vle_compl_next@plt>
movslq %eax,%rbx
lea    0xe21(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    $0x18a,%ecx
xor    %eax,%eax
call   1060 <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    %r15,%rdx
mov    $0x18e,%ecx
xor    %eax,%eax
call   1060 <seatest_assert_string_equal@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"cpo=a\00"
@.str.1 = [2 x i8] c"b\00"
@__FUNCTION__.test_charset_completion_skips_entered_elements = [47 x i8] c"test_charset_completion_skips_entered_elements\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [1 x i8] zeroinitializer
define void @test_charset_completion_skips_entered_elements() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 (...) @vle_compl_reset()
%4 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @complete_options to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1)
%5 = call i32 (...) @vle_compl_next()
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %2
br label %8
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 386)
br label %11
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = call i32 (...) @vle_compl_next()
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %2
br label %16
16: ; preds = %11
%17 = load i8*, i8** %2
%18 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 390)
br label %19
19: ; preds = %16
%20 = load i8*, i8** %2
%21 = call i32 (...) @vle_compl_next()
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %2
br label %24
24: ; preds = %19
%25 = load i8*, i8** %2
%26 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 394)
br label %27
27: ; preds = %24
%28 = load i8*, i8** %2
%29 = call i32 (...) @vle_compl_next()
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %2
br label %32
32: ; preds = %27
%33 = load i8*, i8** %2
%34 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %33, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 398)
br label %35
35: ; preds = %32
%36 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cpo=a\00"
@.str.1 = [2 x i8] c"b\00"
@__FUNCTION__.test_charset_completion_skips_entered_elements = [47 x i8] c"test_charset_completion_skips_entered_elements\00"
@.str.2 = [2 x i8] c"c\00"
@.str.3 = [1 x i8] zeroinitializer
define void @test_charset_completion_skips_entered_elements() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i32 (...) @vle_compl_reset()
%4 = call i32 (i8*, i8**, ...) bitcast (i32 (...)* @complete_options to i32 (i8*, i8**, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1)
%5 = call i32 (...) @vle_compl_next()
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 386)
%9 = call i32 (...) @vle_compl_next()
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %11, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 390)
%13 = call i32 (...) @vle_compl_next()
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
%16 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %15, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 394)
%17 = call i32 (...) @vle_compl_next()
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
%20 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_string_equal to i32 (i8*, i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__FUNCTION__.test_charset_completion_skips_entered_elements, i64 0, i64 0), i32 398)
ret void
}