#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 t_gui_buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ command_plugin_list(char *, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ plugin_auto_load(int, char **);
int /*<<< orphan*/ plugin_load(char *, int, char **);
int /*<<< orphan*/ plugin_reload_name(char *, int, char **);
int /*<<< orphan*/ plugin_unload_all();
int /*<<< orphan*/ plugin_unload_name(char *);
int /*<<< orphan*/ string_free_split(char **);
char **string_split(char *, char *, int /*<<< orphan*/, int /*<<< orphan*/,
                    int *);
scalar_t__ string_strcasecmp(char *, char *);
char *util_search_full_lib_name(char *, char *);
int command_plugin(void *data, struct t_gui_buffer *buffer, int argc,
                   char **argv, char **argv_eol) {
  int plugin_argc;
  char **plugin_argv, *full_name;
  (void)data;
  (void)buffer;
  if (argc == 1) {
    command_plugin_list(NULL, 0);
    return 0;
  }
  if (string_strcasecmp(argv[1], "list") == 0) {
    command_plugin_list((argc > 2) ? argv[2] : NULL, 0);
    return 0;
  }
  if (string_strcasecmp(argv[1], "listfull") == 0) {
    command_plugin_list((argc > 2) ? argv[2] : NULL, 1);
    return 0;
  }
  if (string_strcasecmp(argv[1], "autoload") == 0) {
    if (argc > 2) {
      plugin_argv = string_split(argv_eol[2], " ", 0, 0, &plugin_argc);
      plugin_auto_load(plugin_argc, plugin_argv);
    } else
      plugin_auto_load(0, NULL);
    return 0;
  }
  if (string_strcasecmp(argv[1], "load") == 0) {
    if (argc < 3)
      return -1;
    plugin_argv = NULL;
    plugin_argc = 0;
    if (argc > 3) {
      plugin_argv = string_split(argv_eol[3], " ", 0, 0, &plugin_argc);
    }
    full_name = util_search_full_lib_name(argv[2], "plugins");
    plugin_load(full_name, plugin_argc, plugin_argv);
    if (full_name)
      free(full_name);
    if (plugin_argv)
      string_free_split(plugin_argv);
    return 0;
  }
  if (string_strcasecmp(argv[1], "reload") == 0) {
    if (argc > 2) {
      if (argc > 3) {
        plugin_argv = string_split(argv_eol[3], " ", 0, 0, &plugin_argc);
        plugin_reload_name(argv[2], plugin_argc, plugin_argv);
        if (plugin_argv)
          string_free_split(plugin_argv);
      } else
        plugin_reload_name(argv[2], 0, NULL);
    } else {
      plugin_unload_all();
      plugin_auto_load(0, NULL);
    }
    return 0;
  }
  if (string_strcasecmp(argv[1], "unload") == 0) {
    if (argc > 2)
      plugin_unload_name(argv[2]);
    else
      plugin_unload_all();
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<command_plugin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    11ec <command_plugin+0x3c>
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   10a0 <command_plugin_list@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe05(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    1247 <command_plugin+0x97>
cmpl   $0x2,-0x1c(%rbp)
jle    1225 <command_plugin+0x75>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    1230 <command_plugin+0x80>
xor    %eax,%eax
mov    %rax,-0x50(%rbp)
jmp    1230 <command_plugin+0x80>
mov    -0x50(%rbp),%rdi
xor    %esi,%esi
call   10a0 <command_plugin_list@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdaf(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    12a5 <command_plugin+0xf5>
cmpl   $0x2,-0x1c(%rbp)
jle    1280 <command_plugin+0xd0>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    128b <command_plugin+0xdb>
xor    %eax,%eax
mov    %rax,-0x58(%rbp)
jmp    128b <command_plugin+0xdb>
mov    -0x58(%rbp),%rdi
mov    $0x1,%esi
call   10a0 <command_plugin_list@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd5a(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    1315 <command_plugin+0x165>
cmpl   $0x2,-0x1c(%rbp)
jle    12fe <command_plugin+0x14e>
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd3b(%rip),%rsi
xor    %ecx,%ecx
lea    -0x34(%rbp),%r8
mov    %ecx,%edx
call   1090 <string_split@plt>
mov    %rax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rsi
call   1080 <plugin_auto_load@plt>
jmp    1309 <command_plugin+0x159>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <plugin_auto_load@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcff(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    13de <command_plugin+0x22e>
cmpl   $0x3,-0x1c(%rbp)
jge    1349 <command_plugin+0x199>
movl   $0xffffffff,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jle    1382 <command_plugin+0x1d2>
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xca6(%rip),%rsi
xor    %ecx,%ecx
lea    -0x34(%rbp),%r8
mov    %ecx,%edx
call   1090 <string_split@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xc88(%rip),%rsi
call   1040 <util_search_full_lib_name@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%rdx
call   10d0 <plugin_load@plt>
cmpq   $0x0,-0x48(%rbp)
je     13be <command_plugin+0x20e>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x40(%rbp)
je     13d2 <command_plugin+0x222>
mov    -0x40(%rbp),%rdi
call   1050 <string_free_split@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc34(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    1493 <command_plugin+0x2e3>
cmpl   $0x2,-0x1c(%rbp)
jle    1475 <command_plugin+0x2c5>
cmpl   $0x3,-0x1c(%rbp)
jle    145d <command_plugin+0x2ad>
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xbf8(%rip),%rsi
xor    %ecx,%ecx
lea    -0x34(%rbp),%r8
mov    %ecx,%edx
call   1090 <string_split@plt>
mov    %rax,-0x40(%rbp)
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x34(%rbp),%esi
mov    -0x40(%rbp),%rdx
call   10c0 <plugin_reload_name@plt>
cmpq   $0x0,-0x40(%rbp)
je     1458 <command_plugin+0x2a8>
mov    -0x40(%rbp),%rdi
call   1050 <string_free_split@plt>
jmp    1470 <command_plugin+0x2c0>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   10c0 <plugin_reload_name@plt>
jmp    1487 <command_plugin+0x2d7>
mov    $0x0,%al
call   1060 <plugin_unload_all@plt>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <plugin_auto_load@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xb86(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
cmp    $0x0,%rax
jne    14e0 <command_plugin+0x330>
cmpl   $0x2,-0x1c(%rbp)
jle    14cd <command_plugin+0x31d>
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <plugin_unload_name@plt>
jmp    14d4 <command_plugin+0x324>
mov    $0x0,%al
call   1060 <plugin_unload_all@plt>
movl   $0x0,-0x4(%rbp)
jmp    14e7 <command_plugin+0x337>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_plugin>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x1,%edx
jne    11d6 <command_plugin+0x26>
xor    %r14d,%r14d
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <command_plugin_list@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8,%r15
mov    %rcx,%rbx
mov    %edx,%ebp
mov    0x8(%rcx),%rdi
lea    0xe17(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
test   %rax,%rax
je     1294 <command_plugin+0xe4>
mov    0x8(%rbx),%rdi
lea    0xe03(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
test   %rax,%rax
je     12a9 <command_plugin+0xf9>
mov    0x8(%rbx),%rdi
lea    0xdf3(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
test   %rax,%rax
je     12b7 <command_plugin+0x107>
mov    0x8(%rbx),%rdi
lea    0xdef(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
test   %rax,%rax
je     12f5 <command_plugin+0x145>
mov    0x8(%rbx),%rdi
lea    0xdd4(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
test   %rax,%rax
je     1317 <command_plugin+0x167>
mov    0x8(%rbx),%rdi
lea    0xdc2(%rip),%rsi
call   10b0 <string_strcasecmp@plt>
mov    $0xffffffff,%r14d
test   %rax,%rax
jne    11c8 <command_plugin+0x18>
cmp    $0x3,%ebp
jl     139f <command_plugin+0x1ef>
mov    0x10(%rbx),%rdi
call   1070 <plugin_unload_name@plt>
xor    %r14d,%r14d
jmp    11c8 <command_plugin+0x18>
xor    %r14d,%r14d
cmp    $0x3,%ebp
jl     11bf <command_plugin+0xf>
mov    0x10(%rbx),%rdi
jmp    11c1 <command_plugin+0x11>
xor    %r14d,%r14d
cmp    $0x3,%ebp
jl     12e9 <command_plugin+0x139>
mov    0x10(%rbx),%rdi
jmp    12eb <command_plugin+0x13b>
cmp    $0x3,%ebp
jl     1312 <command_plugin+0x162>
mov    0x10(%r15),%rdi
lea    0xd50(%rip),%rsi
xor    %r14d,%r14d
lea    0x4(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <string_split@plt>
mov    0x4(%rsp),%edi
mov    %rax,%rsi
call   1080 <plugin_auto_load@plt>
jmp    11c8 <command_plugin+0x18>
xor    %edi,%edi
mov    $0x1,%esi
jmp    11c3 <command_plugin+0x13>
mov    $0xffffffff,%r14d
cmp    $0x3,%ebp
jl     11c8 <command_plugin+0x18>
movl   $0x0,0x4(%rsp)
jne    134f <command_plugin+0x19f>
xor    %ebp,%ebp
jmp    136b <command_plugin+0x1bb>
xor    %r14d,%r14d
jmp    1341 <command_plugin+0x191>
cmp    $0x3,%ebp
jl     1337 <command_plugin+0x187>
jne    13ae <command_plugin+0x1fe>
mov    0x10(%rbx),%rdi
xor    %r14d,%r14d
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <plugin_reload_name@plt>
jmp    11c8 <command_plugin+0x18>
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <plugin_unload_all@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <plugin_auto_load@plt>
jmp    11c8 <command_plugin+0x18>
mov    0x18(%r15),%rdi
lea    0xcbd(%rip),%rsi
lea    0x4(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <string_split@plt>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
lea    0xca3(%rip),%rsi
call   1040 <util_search_full_lib_name@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%esi
mov    %rax,%rdi
mov    %rbp,%rdx
call   10d0 <plugin_load@plt>
test   %rbx,%rbx
je     139a <command_plugin+0x1ea>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
jmp    13dd <command_plugin+0x22d>
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <plugin_unload_all@plt>
jmp    11c8 <command_plugin+0x18>
mov    0x18(%r15),%rdi
lea    0xc5e(%rip),%rsi
xor    %r14d,%r14d
lea    0x4(%rsp),%r8
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <string_split@plt>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
mov    0x4(%rsp),%esi
mov    %rax,%rdx
call   10c0 <plugin_reload_name@plt>
test   %rbp,%rbp
je     11c8 <command_plugin+0x18>
mov    %rbp,%rdi
call   1050 <string_free_split@plt>
jmp    11c8 <command_plugin+0x18>

LLVM IR (-O0):
%struct.t_gui_buffer = type { i32 }
@.str = [5 x i8] c"list\00"
@.str.1 = [9 x i8] c"listfull\00"
@.str.2 = [9 x i8] c"autoload\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [5 x i8] c"load\00"
@.str.5 = [8 x i8] c"plugins\00"
@.str.6 = [7 x i8] c"reload\00"
@.str.7 = [7 x i8] c"unload\00"
define i32 @command_plugin(i8* %0, %struct.t_gui_buffer* %1, i32 %2, i8** %3, i8** %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.t_gui_buffer*
%9 = alloca i32
%10 = alloca i8**
%11 = alloca i8**
%12 = alloca i32
%13 = alloca i8**
%14 = alloca i8*
store i8* %0, i8** %7
store %struct.t_gui_buffer* %1, %struct.t_gui_buffer** %8
store i32 %2, i32* %9
store i8** %3, i8*** %10
store i8** %4, i8*** %11
%15 = load i8*, i8** %7
%16 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %8
%17 = load i32, i32* %9
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %5
%20 = call i32 @command_plugin_list(i8* null, i32 0)
store i32 0, i32* %6
br label %171
21: ; preds = %5
%22 = load i8**, i8*** %10
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @string_strcasecmp(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %38
27: ; preds = %21
%28 = load i32, i32* %9
%29 = icmp sgt i32 %28, 2
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i8**, i8*** %10
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
br label %35
34: ; preds = %27
br label %35
35: ; preds = %34, %30
%36 = phi i8* [ %33, %30 ], [ null, %34 ]
%37 = call i32 @command_plugin_list(i8* %36, i32 0)
store i32 0, i32* %6
br label %171
38: ; preds = %21
%39 = load i8**, i8*** %10
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i64 @string_strcasecmp(i8* %41, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %55
44: ; preds = %38
%45 = load i32, i32* %9
%46 = icmp sgt i32 %45, 2
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = load i8**, i8*** %10
%49 = getelementptr inbounds i8*, i8** %48, i64 2
%50 = load i8*, i8** %49
br label %52
51: ; preds = %44
br label %52
52: ; preds = %51, %47
%53 = phi i8* [ %50, %47 ], [ null, %51 ]
%54 = call i32 @command_plugin_list(i8* %53, i32 1)
store i32 0, i32* %6
br label %171
55: ; preds = %38
%56 = load i8**, i8*** %10
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i64 @string_strcasecmp(i8* %58, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %75
61: ; preds = %55
%62 = load i32, i32* %9
%63 = icmp sgt i32 %62, 2
br i1 %63, label %64, label %72
64: ; preds = %61
%65 = load i8**, i8*** %11
%66 = getelementptr inbounds i8*, i8** %65, i64 2
%67 = load i8*, i8** %66
%68 = call i8** @string_split(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %12)
store i8** %68, i8*** %13
%69 = load i32, i32* %12
%70 = load i8**, i8*** %13
%71 = call i32 @plugin_auto_load(i32 %69, i8** %70)
br label %74
72: ; preds = %61
%73 = call i32 @plugin_auto_load(i32 0, i8** null)
br label %74
74: ; preds = %72, %64
store i32 0, i32* %6
br label %171
75: ; preds = %55
%76 = load i8**, i8*** %10
%77 = getelementptr inbounds i8*, i8** %76, i64 1
%78 = load i8*, i8** %77
%79 = call i64 @string_strcasecmp(i8* %78, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %114
81: ; preds = %75
%82 = load i32, i32* %9
%83 = icmp slt i32 %82, 3
br i1 %83, label %84, label %85
84: ; preds = %81
store i32 -1, i32* %6
br label %171
85: ; preds = %81
store i8** null, i8*** %13
store i32 0, i32* %12
%86 = load i32, i32* %9
%87 = icmp sgt i32 %86, 3
br i1 %87, label %88, label %93
88: ; preds = %85
%89 = load i8**, i8*** %11
%90 = getelementptr inbounds i8*, i8** %89, i64 3
%91 = load i8*, i8** %90
%92 = call i8** @string_split(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %12)
store i8** %92, i8*** %13
br label %93
93: ; preds = %88, %85
%94 = load i8**, i8*** %10
%95 = getelementptr inbounds i8*, i8** %94, i64 2
%96 = load i8*, i8** %95
%97 = call i8* @util_search_full_lib_name(i8* %96, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
store i8* %97, i8** %14
%98 = load i8*, i8** %14
%99 = load i32, i32* %12
%100 = load i8**, i8*** %13
%101 = call i32 @plugin_load(i8* %98, i32 %99, i8** %100)
%102 = load i8*, i8** %14
%103 = icmp ne i8* %102, null
br i1 %103, label %104, label %107
104: ; preds = %93
%105 = load i8*, i8** %14
%106 = call i32 @free(i8* %105)
br label %107
107: ; preds = %104, %93
%108 = load i8**, i8*** %13
%109 = icmp ne i8** %108, null
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load i8**, i8*** %13
%112 = call i32 @string_free_split(i8** %111)
br label %113
113: ; preds = %110, %107
store i32 0, i32* %6
br label %171
114: ; preds = %75
%115 = load i8**, i8*** %10
%116 = getelementptr inbounds i8*, i8** %115, i64 1
%117 = load i8*, i8** %116
%118 = call i64 @string_strcasecmp(i8* %117, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%119 = icmp eq i64 %118, 0
br i1 %119, label %120, label %153
120: ; preds = %114
%121 = load i32, i32* %9
%122 = icmp sgt i32 %121, 2
br i1 %122, label %123, label %149
123: ; preds = %120
%124 = load i32, i32* %9
%125 = icmp sgt i32 %124, 3
br i1 %125, label %126, label %143
126: ; preds = %123
%127 = load i8**, i8*** %11
%128 = getelementptr inbounds i8*, i8** %127, i64 3
%129 = load i8*, i8** %128
%130 = call i8** @string_split(i8* %129, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %12)
store i8** %130, i8*** %13
%131 = load i8**, i8*** %10
%132 = getelementptr inbounds i8*, i8** %131, i64 2
%133 = load i8*, i8** %132
%134 = load i32, i32* %12
%135 = load i8**, i8*** %13
%136 = call i32 @plugin_reload_name(i8* %133, i32 %134, i8** %135)
%137 = load i8**, i8*** %13
%138 = icmp ne i8** %137, null
br i1 %138, label %139, label %142
139: ; preds = %126
%140 = load i8**, i8*** %13
%141 = call i32 @string_free_split(i8** %140)
br label %142
142: ; preds = %139, %126
br label %148
143: ; preds = %123
%144 = load i8**, i8*** %10
%145 = getelementptr inbounds i8*, i8** %144, i64 2
%146 = load i8*, i8** %145
%147 = call i32 @plugin_reload_name(i8* %146, i32 0, i8** null)
br label %148
148: ; preds = %143, %142
br label %152
149: ; preds = %120
%150 = call i32 (...) @plugin_unload_all()
%151 = call i32 @plugin_auto_load(i32 0, i8** null)
br label %152
152: ; preds = %149, %148
store i32 0, i32* %6
br label %171
153: ; preds = %114
%154 = load i8**, i8*** %10
%155 = getelementptr inbounds i8*, i8** %154, i64 1
%156 = load i8*, i8** %155
%157 = call i64 @string_strcasecmp(i8* %156, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%158 = icmp eq i64 %157, 0
br i1 %158, label %159, label %170
159: ; preds = %153
%160 = load i32, i32* %9
%161 = icmp sgt i32 %160, 2
br i1 %161, label %162, label %167
162: ; preds = %159
%163 = load i8**, i8*** %10
%164 = getelementptr inbounds i8*, i8** %163, i64 2
%165 = load i8*, i8** %164
%166 = call i32 @plugin_unload_name(i8* %165)
br label %169
167: ; preds = %159
%168 = call i32 (...) @plugin_unload_all()
br label %169
169: ; preds = %167, %162
store i32 0, i32* %6
br label %171
170: ; preds = %153
store i32 -1, i32* %6
br label %171
171: ; preds = %170, %169, %152, %113, %84, %74, %52, %35, %19
%172 = load i32, i32* %6
ret i32 %172
}

LLVM IR (-O2):
%struct.t_gui_buffer = type { i32 }
@.str = [5 x i8] c"list\00"
@.str.1 = [9 x i8] c"listfull\00"
@.str.2 = [9 x i8] c"autoload\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [5 x i8] c"load\00"
@.str.5 = [8 x i8] c"plugins\00"
@.str.6 = [7 x i8] c"reload\00"
@.str.7 = [7 x i8] c"unload\00"
define i32 @command_plugin(i8* nocapture readnone %0, %struct.t_gui_buffer* nocapture readnone %1, i32 %2, i8** nocapture %3, i8** nocapture %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
%8 = icmp eq i32 %2, 1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 @command_plugin_list(i8* null, i32 0)
br label %114
11: ; preds = %5
%12 = getelementptr inbounds i8*, i8** %3, i64 1
%13 = load i8*, i8** %12
%14 = tail call i64 @string_strcasecmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %11
%17 = icmp sgt i32 %2, 2
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = getelementptr inbounds i8*, i8** %3, i64 2
%20 = load i8*, i8** %19
br label %21
21: ; preds = %16, %18
%22 = phi i8* [ %20, %18 ], [ null, %16 ]
%23 = tail call i32 @command_plugin_list(i8* %22, i32 0)
br label %114
24: ; preds = %11
%25 = load i8*, i8** %12
%26 = tail call i64 @string_strcasecmp(i8* %25, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = icmp sgt i32 %2, 2
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = getelementptr inbounds i8*, i8** %3, i64 2
%32 = load i8*, i8** %31
br label %33
33: ; preds = %28, %30
%34 = phi i8* [ %32, %30 ], [ null, %28 ]
%35 = tail call i32 @command_plugin_list(i8* %34, i32 1)
br label %114
36: ; preds = %24
%37 = load i8*, i8** %12
%38 = tail call i64 @string_strcasecmp(i8* %37, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %50
40: ; preds = %36
%41 = icmp sgt i32 %2, 2
br i1 %41, label %42, label %48
42: ; preds = %40
%43 = getelementptr inbounds i8*, i8** %4, i64 2
%44 = load i8*, i8** %43
%45 = call i8** @string_split(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %6)
%46 = load i32, i32* %6
%47 = call i32 @plugin_auto_load(i32 %46, i8** %45)
br label %114
48: ; preds = %40
%49 = tail call i32 @plugin_auto_load(i32 0, i8** null)
br label %114
50: ; preds = %36
%51 = load i8*, i8** %12
%52 = tail call i64 @string_strcasecmp(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %76
54: ; preds = %50
%55 = icmp slt i32 %2, 3
br i1 %55, label %114, label %56
56: ; preds = %54
store i32 0, i32* %6
%57 = icmp eq i32 %2, 3
br i1 %57, label %62, label %58
58: ; preds = %56
%59 = getelementptr inbounds i8*, i8** %4, i64 3
%60 = load i8*, i8** %59
%61 = call i8** @string_split(i8* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %6)
br label %62
62: ; preds = %58, %56
%63 = phi i8** [ %61, %58 ], [ null, %56 ]
%64 = getelementptr inbounds i8*, i8** %3, i64 2
%65 = load i8*, i8** %64
%66 = call i8* @util_search_full_lib_name(i8* %65, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%67 = load i32, i32* %6
%68 = call i32 @plugin_load(i8* %66, i32 %67, i8** %63)
%69 = icmp eq i8* %66, null
br i1 %69, label %72, label %70
70: ; preds = %62
%71 = call i32 @free(i8* %66)
br label %72
72: ; preds = %70, %62
%73 = icmp eq i8** %63, null
br i1 %73, label %114, label %74
74: ; preds = %72
%75 = call i32 @string_free_split(i8** %63)
br label %114
76: ; preds = %50
%77 = load i8*, i8** %12
%78 = tail call i64 @string_strcasecmp(i8* %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %102
80: ; preds = %76
%81 = icmp sgt i32 %2, 2
br i1 %81, label %82, label %99
82: ; preds = %80
%83 = icmp eq i32 %2, 3
br i1 %83, label %95, label %84
84: ; preds = %82
%85 = getelementptr inbounds i8*, i8** %4, i64 3
%86 = load i8*, i8** %85
%87 = call i8** @string_split(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 0, i32* %6)
%88 = getelementptr inbounds i8*, i8** %3, i64 2
%89 = load i8*, i8** %88
%90 = load i32, i32* %6
%91 = call i32 @plugin_reload_name(i8* %89, i32 %90, i8** %87)
%92 = icmp eq i8** %87, null
br i1 %92, label %114, label %93
93: ; preds = %84
%94 = call i32 @string_free_split(i8** %87)
br label %114
95: ; preds = %82
%96 = getelementptr inbounds i8*, i8** %3, i64 2
%97 = load i8*, i8** %96
%98 = tail call i32 @plugin_reload_name(i8* %97, i32 0, i8** null)
br label %114
99: ; preds = %80
%100 = tail call i32 (...) @plugin_unload_all()
%101 = tail call i32 @plugin_auto_load(i32 0, i8** null)
br label %114
102: ; preds = %76
%103 = load i8*, i8** %12
%104 = tail call i64 @string_strcasecmp(i8* %103, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %114
106: ; preds = %102
%107 = icmp sgt i32 %2, 2
br i1 %107, label %108, label %112
108: ; preds = %106
%109 = getelementptr inbounds i8*, i8** %3, i64 2
%110 = load i8*, i8** %109
%111 = tail call i32 @plugin_unload_name(i8* %110)
br label %114
112: ; preds = %106
%113 = tail call i32 (...) @plugin_unload_all()
br label %114
114: ; preds = %102, %108, %112, %99, %84, %93, %95, %72, %74, %54, %42, %48, %33, %21, %9
%115 = phi i32 [ 0, %9 ], [ 0, %21 ], [ 0, %33 ], [ 0, %48 ], [ 0, %42 ], [ -1, %54 ], [ 0, %74 ], [ 0, %72 ], [ 0, %95 ], [ 0, %93 ], [ 0, %84 ], [ 0, %99 ], [ 0, %112 ], [ 0, %108 ], [ -1, %102 ]
ret i32 %115
}