#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_config_section {
  int dummy;
};
struct t_config_file {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gui_filter_new(int, char const *, char *, char *, char *);
int /*<<< orphan*/ string_free_split(char **);
char **string_split(char const *, char *, int, int /*<<< orphan*/, int *);
scalar_t__ string_strcasecmp(char *, char *);
int config_weechat_filter_read_cb(const void *pointer, void *data,
                                  struct t_config_file *config_file,
                                  struct t_config_section *section,
                                  const char *option_name, const char *value) {
  char **argv, **argv_eol;
  int argc;
  (void)pointer;
  (void)data;
  (void)config_file;
  (void)section;
  if (option_name && value && value[0]) {
    argv = string_split(value, ";", 0, 0, &argc);
    argv_eol = string_split(value, ";", 1, 0, NULL);
    if (argv && argv_eol && (argc >= 4)) {
      gui_filter_new((string_strcasecmp(argv[0], "on") == 0) ? 1 : 0,
                     option_name, argv[1], argv[2], argv_eol[3]);
    }
    if (argv)
      string_free_split(argv);
    if (argv_eol)
      string_free_split(argv_eol);
  }
  return 1;
}


x86 assembly (clang, -O0):
<config_weechat_filter_read_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1254 <config_weechat_filter_read_cb+0x114>
cmpq   $0x0,-0x30(%rbp)
je     1254 <config_weechat_filter_read_cb+0x114>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1254 <config_weechat_filter_read_cb+0x114>
mov    -0x30(%rbp),%rdi
lea    0xe6f(%rip),%rsi
xor    %ecx,%ecx
lea    -0x44(%rbp),%r8
mov    %ecx,%edx
call   1040 <string_split@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe53(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <string_split@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1227 <config_weechat_filter_read_cb+0xe7>
cmpq   $0x0,-0x40(%rbp)
je     1227 <config_weechat_filter_read_cb+0xe7>
cmpl   $0x4,-0x44(%rbp)
jl     1227 <config_weechat_filter_read_cb+0xe7>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
lea    0xe12(%rip),%rsi
call   1050 <string_strcasecmp@plt>
mov    %rax,%rcx
xor    %edi,%edi
mov    $0x1,%eax
cmp    $0x0,%rcx
cmove  %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x40(%rbp),%rax
mov    0x18(%rax),%r8
call   1060 <gui_filter_new@plt>
cmpq   $0x0,-0x38(%rbp)
je     123b <config_weechat_filter_read_cb+0xfb>
mov    -0x38(%rbp),%rdi
call   1030 <string_free_split@plt>
cmpq   $0x0,-0x40(%rbp)
je     124f <config_weechat_filter_read_cb+0x10f>
mov    -0x40(%rbp),%rdi
call   1030 <string_free_split@plt>
jmp    1254 <config_weechat_filter_read_cb+0x114>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_weechat_filter_read_cb>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %r8,%r8
je     11f6 <config_weechat_filter_read_cb+0xb6>
mov    %r9,%rbx
test   %r9,%r9
je     11f6 <config_weechat_filter_read_cb+0xb6>
cmpb   $0x0,(%rbx)
je     11f6 <config_weechat_filter_read_cb+0xb6>
mov    %r8,%r12
lea    0xe90(%rip),%r15
lea    0x4(%rsp),%r8
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <string_split@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <string_split@plt>
mov    %rax,%r15
test   %r14,%r14
je     11dc <config_weechat_filter_read_cb+0x9c>
test   %r15,%r15
je     11dc <config_weechat_filter_read_cb+0x9c>
cmpl   $0x4,0x4(%rsp)
jl     11dc <config_weechat_filter_read_cb+0x9c>
mov    (%r14),%rdi
lea    0xe48(%rip),%rsi
call   1050 <string_strcasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rcx
mov    0x18(%r15),%r8
mov    %r12,%rsi
call   1060 <gui_filter_new@plt>
test   %r14,%r14
je     11e9 <config_weechat_filter_read_cb+0xa9>
mov    %r14,%rdi
call   1030 <string_free_split@plt>
test   %r15,%r15
je     11f6 <config_weechat_filter_read_cb+0xb6>
mov    %r15,%rdi
call   1030 <string_free_split@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.t_config_file = type { i32 }
%struct.t_config_section = type { i32 }
@.str = [2 x i8] c";\00"
@.str.1 = [3 x i8] c"on\00"
define i32 @config_weechat_filter_read_cb(i8* %0, i8* %1, %struct.t_config_file* %2, %struct.t_config_section* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.t_config_file*
%10 = alloca %struct.t_config_section*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8**
%14 = alloca i8**
%15 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store %struct.t_config_file* %2, %struct.t_config_file** %9
store %struct.t_config_section* %3, %struct.t_config_section** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%16 = load i8*, i8** %7
%17 = load i8*, i8** %8
%18 = load %struct.t_config_file*, %struct.t_config_file** %9
%19 = load %struct.t_config_section*, %struct.t_config_section** %10
%20 = load i8*, i8** %11
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %76
22: ; preds = %6
%23 = load i8*, i8** %12
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %76
25: ; preds = %22
%26 = load i8*, i8** %12
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %76
31: ; preds = %25
%32 = load i8*, i8** %12
%33 = call i8** @string_split(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32* %15)
store i8** %33, i8*** %13
%34 = load i8*, i8** %12
%35 = call i8** @string_split(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32* null)
store i8** %35, i8*** %14
%36 = load i8**, i8*** %13
%37 = icmp ne i8** %36, null
br i1 %37, label %38, label %63
38: ; preds = %31
%39 = load i8**, i8*** %14
%40 = icmp ne i8** %39, null
br i1 %40, label %41, label %63
41: ; preds = %38
%42 = load i32, i32* %15
%43 = icmp sge i32 %42, 4
br i1 %43, label %44, label %63
44: ; preds = %41
%45 = load i8**, i8*** %13
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i64 @string_strcasecmp(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
%50 = zext i1 %49 to i64
%51 = select i1 %49, i32 1, i32 0
%52 = load i8*, i8** %11
%53 = load i8**, i8*** %13
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = load i8**, i8*** %13
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = load i8**, i8*** %14
%60 = getelementptr inbounds i8*, i8** %59, i64 3
%61 = load i8*, i8** %60
%62 = call i32 @gui_filter_new(i32 %51, i8* %52, i8* %55, i8* %58, i8* %61)
br label %63
63: ; preds = %44, %41, %38, %31
%64 = load i8**, i8*** %13
%65 = icmp ne i8** %64, null
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i8**, i8*** %13
%68 = call i32 @string_free_split(i8** %67)
br label %69
69: ; preds = %66, %63
%70 = load i8**, i8*** %14
%71 = icmp ne i8** %70, null
br i1 %71, label %72, label %75
72: ; preds = %69
%73 = load i8**, i8*** %14
%74 = call i32 @string_free_split(i8** %73)
br label %75
75: ; preds = %72, %69
br label %76
76: ; preds = %75, %25, %22, %6
ret i32 1
}

LLVM IR (-O2):
%struct.t_config_file = type { i32 }
%struct.t_config_section = type { i32 }
@.str = [2 x i8] c";\00"
@.str.1 = [3 x i8] c"on\00"
define i32 @config_weechat_filter_read_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, %struct.t_config_file* nocapture readnone %2, %struct.t_config_section* nocapture readnone %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = icmp ne i8* %4, null
%10 = icmp ne i8* %5, null
%11 = and i1 %9, %10
br i1 %11, label %12, label %42
12: ; preds = %6
%13 = load i8, i8* %5
%14 = icmp eq i8 %13, 0
br i1 %14, label %42, label %15
15: ; preds = %12
%16 = call i8** @string_split(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32* %7)
%17 = call i8** @string_split(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32* null)
%18 = icmp ne i8** %16, null
%19 = icmp ne i8** %17, null
%20 = select i1 %18, i1 %19, i1 false
%21 = load i32, i32* %7
%22 = icmp sgt i32 %21, 3
%23 = select i1 %20, i1 %22, i1 false
br i1 %23, label %24, label %36
24: ; preds = %15
%25 = load i8*, i8** %16
%26 = call i64 @string_strcasecmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = getelementptr inbounds i8*, i8** %16, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8*, i8** %16, i64 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8*, i8** %17, i64 3
%34 = load i8*, i8** %33
%35 = call i32 @gui_filter_new(i32 %28, i8* %4, i8* %30, i8* %32, i8* %34)
br label %36
36: ; preds = %24, %15
br i1 %18, label %37, label %39
37: ; preds = %36
%38 = call i32 @string_free_split(i8** %16)
br label %39
39: ; preds = %37, %36
br i1 %19, label %40, label %42
40: ; preds = %39
%41 = call i32 @string_free_split(i8** %17)
br label %42
42: ; preds = %39, %40, %12, %6
ret i32 1
}