#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*/ free_string_array(char **, int);
char **list_color_schemes(int *);
size_t strlen(char const *);
scalar_t__ strnoscmp(char const *, char *, size_t);
int /*<<< orphan*/ vle_compl_add_last_match(char const *);
int /*<<< orphan*/ vle_compl_add_match(char *);
int /*<<< orphan*/ vle_compl_finish_group();
void complete_colorschemes(const char name[]) {
  int i;
  size_t len;
  int schemes_len;
  char **schemes;
  len = strlen(name);
  schemes = list_color_schemes(&schemes_len);
  for (i = 0; i < schemes_len; i++) {
    if (schemes[i][0] != '.' || name[0] == '.') {
      if (strnoscmp(name, schemes[i], len) == 0) {
        vle_compl_add_match(schemes[i]);
      }
    }
  }
  free_string_array(schemes, schemes_len);
  vle_compl_finish_group();
  vle_compl_add_last_match(name);
}


x86 assembly (clang, -O0):
<complete_colorschemes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
call   1070 <list_color_schemes@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    121d <complete_colorschemes+0xad>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11d1 <complete_colorschemes+0x61>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    120a <complete_colorschemes+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strnoscmp@plt>
cmp    $0x0,%rax
jne    1205 <complete_colorschemes+0x95>
mov    -0x28(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <vle_compl_add_match@plt>
jmp    120a <complete_colorschemes+0x9a>
jmp    120f <complete_colorschemes+0x9f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119d <complete_colorschemes+0x2d>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <free_string_array@plt>
mov    $0x0,%al
call   1050 <vle_compl_finish_group@plt>
mov    -0x8(%rbp),%rdi
call   1090 <vle_compl_add_last_match@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<complete_colorschemes>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rax,%r15
lea    0x4(%rsp),%rdi
call   1070 <list_color_schemes@plt>
mov    %rax,%r12
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11db <complete_colorschemes+0x6b>
xor    %ebx,%ebx
jmp    11be <complete_colorschemes+0x4e>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rdx
call   1030 <strnoscmp@plt>
test   %rax,%rax
je     11d0 <complete_colorschemes+0x60>
add    $0x1,%rbx
movslq 0x4(%rsp),%rsi
cmp    %rsi,%rbx
jge    11db <complete_colorschemes+0x6b>
mov    (%r12,%rbx,8),%rsi
cmpb   $0x2e,(%rsi)
jne    11a0 <complete_colorschemes+0x30>
cmpb   $0x2e,(%r14)
je     11a0 <complete_colorschemes+0x30>
jmp    11b0 <complete_colorschemes+0x40>
nop
mov    (%r12,%rbx,8),%rdi
call   1080 <vle_compl_add_match@plt>
jmp    11b0 <complete_colorschemes+0x40>
mov    %r12,%rdi
call   1060 <free_string_array@plt>
xor    %eax,%eax
call   1050 <vle_compl_finish_group@plt>
mov    %r14,%rdi
call   1090 <vle_compl_add_last_match@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @complete_colorschemes(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8**
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %4
%9 = call i8** @list_color_schemes(i32* %5)
store i8** %9, i8*** %6
store i32 0, i32* %3
br label %10
10: ; preds = %49, %1
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %52
14: ; preds = %10
%15 = load i8**, i8*** %6
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 46
br i1 %23, label %30, label %24
24: ; preds = %14
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 46
br i1 %29, label %30, label %48
30: ; preds = %24, %14
%31 = load i8*, i8** %2
%32 = load i8**, i8*** %6
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = load i64, i64* %4
%38 = call i64 @strnoscmp(i8* %31, i8* %36, i64 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %30
%41 = load i8**, i8*** %6
%42 = load i32, i32* %3
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @vle_compl_add_match(i8* %45)
br label %47
47: ; preds = %40, %30
br label %48
48: ; preds = %47, %24
br label %49
49: ; preds = %48
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %10
52: ; preds = %10
%53 = load i8**, i8*** %6
%54 = load i32, i32* %5
%55 = call i32 @free_string_array(i8** %53, i32 %54)
%56 = call i32 (...) @vle_compl_finish_group()
%57 = load i8*, i8** %2
%58 = call i32 @vle_compl_add_last_match(i8* %57)
ret void
}

LLVM IR (-O2):
define void @complete_colorschemes(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = call i8** @list_color_schemes(i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %1, %23
%9 = phi i64 [ %24, %23 ], [ 0, %1 ]
%10 = getelementptr inbounds i8*, i8** %5, i64 %9
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 46
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i8, i8* %0
%16 = icmp eq i8 %15, 46
br i1 %16, label %17, label %23
17: ; preds = %14, %8
%18 = call i64 @strnoscmp(i8* %0, i8* %11, i64 %4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i8*, i8** %10
%22 = call i32 @vle_compl_add_match(i8* %21)
br label %23
23: ; preds = %14, %20, %17
%24 = add nuw nsw i64 %9, 1
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %8, label %28
28: ; preds = %23, %1
%29 = phi i32 [ %6, %1 ], [ %25, %23 ]
%30 = call i32 @free_string_array(i8** %5, i32 %29)
%31 = call i32 (...) @vle_compl_finish_group()
%32 = call i32 @vle_compl_add_last_match(i8* %0)
ret void
}