#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 */
char *eval_expression(char const *, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
struct t_gui_buffer *gui_buffer_search_main();
int /*<<< orphan*/ input_data(struct t_gui_buffer *, char *);
int /*<<< orphan*/ string_free_split_command(char **);
char **string_split_command(char *, char);
void command_exec_list(const char *command_list) {
  char *command_list2, **commands, **ptr_cmd;
  struct t_gui_buffer *weechat_buffer;
  if (!command_list || !command_list[0])
    return;
  command_list2 = eval_expression(command_list, NULL, NULL, NULL);
  if (command_list2 && command_list2[0]) {
    commands = string_split_command(command_list2, ';');
    if (commands) {
      weechat_buffer = gui_buffer_search_main();
      for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++) {
        (void)input_data(weechat_buffer, *ptr_cmd);
      }
      string_free_split_command(commands);
    }
  }
  if (command_list2)
    free(command_list2);
}


x86 assembly (clang, -O0):
<command_exec_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1184 <command_exec_list+0x24>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1189 <command_exec_list+0x29>
jmp    123c <command_exec_list+0xdc>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1060 <eval_expression@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1228 <command_exec_list+0xc8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1228 <command_exec_list+0xc8>
mov    -0x10(%rbp),%rdi
mov    $0x3b,%esi
call   1040 <string_split_command@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1223 <command_exec_list+0xc3>
mov    $0x0,%al
call   1080 <gui_buffer_search_main@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     121a <command_exec_list+0xba>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1070 <input_data@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    11eb <command_exec_list+0x8b>
mov    -0x18(%rbp),%rdi
call   1050 <string_free_split_command@plt>
jmp    1228 <command_exec_list+0xc8>
cmpq   $0x0,-0x10(%rbp)
je     123c <command_exec_list+0xdc>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<command_exec_list>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     11ef <command_exec_list+0x8f>
cmpb   $0x0,(%rdi)
je     11ef <command_exec_list+0x8f>
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1060 <eval_expression@plt>
test   %rax,%rax
je     11ef <command_exec_list+0x8f>
mov    %rax,%r15
cmpb   $0x0,(%rax)
je     11dc <command_exec_list+0x7c>
mov    %r15,%rdi
mov    $0x3b,%esi
call   1040 <string_split_command@plt>
test   %rax,%rax
je     11dc <command_exec_list+0x7c>
mov    %rax,%r14
xor    %eax,%eax
call   1080 <gui_buffer_search_main@plt>
mov    (%r14),%rsi
test   %rsi,%rsi
je     11d4 <command_exec_list+0x74>
mov    %rax,%r12
mov    %r14,%rbx
add    $0x8,%rbx
nopl   0x0(%rax)
mov    %r12,%rdi
call   1070 <input_data@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    11c0 <command_exec_list+0x60>
mov    %r14,%rdi
call   1050 <string_free_split_command@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.t_gui_buffer = type { i32 }
define void @command_exec_list(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca %struct.t_gui_buffer*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9, %1
br label %56
15: ; preds = %9
%16 = load i8*, i8** %2
%17 = call i8* @eval_expression(i8* %16, i32* null, i32* null, i32* null)
store i8* %17, i8** %3
%18 = load i8*, i8** %3
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %50
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %50
26: ; preds = %20
%27 = load i8*, i8** %3
%28 = call i8** @string_split_command(i8* %27, i8 signext 59)
store i8** %28, i8*** %4
%29 = load i8**, i8*** %4
%30 = icmp ne i8** %29, null
br i1 %30, label %31, label %49
31: ; preds = %26
%32 = call %struct.t_gui_buffer* (...) @gui_buffer_search_main()
store %struct.t_gui_buffer* %32, %struct.t_gui_buffer** %6
%33 = load i8**, i8*** %4
store i8** %33, i8*** %5
br label %34
34: ; preds = %43, %31
%35 = load i8**, i8*** %5
%36 = load i8*, i8** %35
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load %struct.t_gui_buffer*, %struct.t_gui_buffer** %6
%40 = load i8**, i8*** %5
%41 = load i8*, i8** %40
%42 = call i32 @input_data(%struct.t_gui_buffer* %39, i8* %41)
br label %43
43: ; preds = %38
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i32 1
store i8** %45, i8*** %5
br label %34
46: ; preds = %34
%47 = load i8**, i8*** %4
%48 = call i32 @string_free_split_command(i8** %47)
br label %49
49: ; preds = %46, %26
br label %50
50: ; preds = %49, %20, %15
%51 = load i8*, i8** %3
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = load i8*, i8** %3
%55 = call i32 @free(i8* %54)
br label %56
56: ; preds = %14, %53, %50
ret void
}

LLVM IR (-O2):
%struct.t_gui_buffer = type { i32 }
define void @command_exec_list(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %30, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %30, label %6
6: ; preds = %3
%7 = tail call i8* @eval_expression(i8* %0, i32* null, i32* null, i32* null)
%8 = icmp eq i8* %7, null
br i1 %8, label %30, label %9
9: ; preds = %6
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %28, label %12
12: ; preds = %9
%13 = tail call i8** @string_split_command(i8* %7, i8 signext 59)
%14 = icmp eq i8** %13, null
br i1 %14, label %28, label %15
15: ; preds = %12
%16 = tail call %struct.t_gui_buffer* (...) @gui_buffer_search_main()
%17 = load i8*, i8** %13
%18 = icmp eq i8* %17, null
br i1 %18, label %26, label %19
19: ; preds = %15, %19
%20 = phi i8* [ %24, %19 ], [ %17, %15 ]
%21 = phi i8** [ %23, %19 ], [ %13, %15 ]
%22 = tail call i32 @input_data(%struct.t_gui_buffer* %16, i8* %20)
%23 = getelementptr inbounds i8*, i8** %21, i64 1
%24 = load i8*, i8** %23
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %19
26: ; preds = %19, %15
%27 = tail call i32 @string_free_split_command(i8** %13)
br label %28
28: ; preds = %9, %26, %12
%29 = tail call i32 @free(i8* %7)
br label %30
30: ; preds = %28, %6, %1, %3
ret void
}