#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(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)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    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1250 <config_weechat_filter_read_cb+0x110>
cmpq   $0x0,-0x28(%rbp)
je     1250 <config_weechat_filter_read_cb+0x110>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1250 <config_weechat_filter_read_cb+0x110>
mov    -0x28(%rbp),%rdi
lea    0xe73(%rip),%rsi
xor    %ecx,%ecx
lea    -0x3c(%rbp),%r8
mov    %ecx,%edx
call   1040 <string_split@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe57(%rip),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <string_split@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1223 <config_weechat_filter_read_cb+0xe3>
cmpq   $0x0,-0x38(%rbp)
je     1223 <config_weechat_filter_read_cb+0xe3>
cmpl   $0x4,-0x3c(%rbp)
jl     1223 <config_weechat_filter_read_cb+0xe3>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    0xe16(%rip),%rsi
call   1050 <string_strcasecmp@plt>
mov    %rax,%rcx
xor    %edi,%edi
mov    $0x1,%eax
cmp    $0x0,%rcx
cmove  %eax,%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%r8
call   1060 <gui_filter_new@plt>
cmpq   $0x0,-0x30(%rbp)
je     1237 <config_weechat_filter_read_cb+0xf7>
mov    -0x30(%rbp),%rdi
call   1030 <string_free_split@plt>
cmpq   $0x0,-0x38(%rbp)
je     124b <config_weechat_filter_read_cb+0x10b>
mov    -0x38(%rbp),%rdi
call   1030 <string_free_split@plt>
jmp    1250 <config_weechat_filter_read_cb+0x110>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_weechat_filter_read_cb>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rcx,%rcx
je     11f6 <config_weechat_filter_read_cb+0xb6>
mov    %r8,%rbx
test   %r8,%r8
je     11f6 <config_weechat_filter_read_cb+0xb6>
cmpb   $0x0,(%rbx)
je     11f6 <config_weechat_filter_read_cb+0xb6>
mov    %rcx,%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, %struct.t_config_file* %1, %struct.t_config_section* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca %struct.t_config_file*
%8 = alloca %struct.t_config_section*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8**
%12 = alloca i8**
%13 = alloca i32
store i8* %0, i8** %6
store %struct.t_config_file* %1, %struct.t_config_file** %7
store %struct.t_config_section* %2, %struct.t_config_section** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%14 = load i8*, i8** %6
%15 = load %struct.t_config_file*, %struct.t_config_file** %7
%16 = load %struct.t_config_section*, %struct.t_config_section** %8
%17 = load i8*, i8** %9
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %73
19: ; preds = %5
%20 = load i8*, i8** %10
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %73
22: ; preds = %19
%23 = load i8*, i8** %10
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %73
28: ; preds = %22
%29 = load i8*, i8** %10
%30 = call i8** @string_split(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32* %13)
store i8** %30, i8*** %11
%31 = load i8*, i8** %10
%32 = call i8** @string_split(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32* null)
store i8** %32, i8*** %12
%33 = load i8**, i8*** %11
%34 = icmp ne i8** %33, null
br i1 %34, label %35, label %60
35: ; preds = %28
%36 = load i8**, i8*** %12
%37 = icmp ne i8** %36, null
br i1 %37, label %38, label %60
38: ; preds = %35
%39 = load i32, i32* %13
%40 = icmp sge i32 %39, 4
br i1 %40, label %41, label %60
41: ; preds = %38
%42 = load i8**, i8*** %11
%43 = getelementptr inbounds i8*, i8** %42, i64 0
%44 = load i8*, i8** %43
%45 = call i64 @string_strcasecmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i32 1, i32 0
%49 = load i8*, i8** %9
%50 = load i8**, i8*** %11
%51 = getelementptr inbounds i8*, i8** %50, i64 1
%52 = load i8*, i8** %51
%53 = load i8**, i8*** %11
%54 = getelementptr inbounds i8*, i8** %53, i64 2
%55 = load i8*, i8** %54
%56 = load i8**, i8*** %12
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @gui_filter_new(i32 %48, i8* %49, i8* %52, i8* %55, i8* %58)
br label %60
60: ; preds = %41, %38, %35, %28
%61 = load i8**, i8*** %11
%62 = icmp ne i8** %61, null
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = load i8**, i8*** %11
%65 = call i32 @string_free_split(i8** %64)
br label %66
66: ; preds = %63, %60
%67 = load i8**, i8*** %12
%68 = icmp ne i8** %67, null
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load i8**, i8*** %12
%71 = call i32 @string_free_split(i8** %70)
br label %72
72: ; preds = %69, %66
br label %73
73: ; preds = %72, %22, %19, %5
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, %struct.t_config_file* nocapture readnone %1, %struct.t_config_section* nocapture readnone %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = bitcast i32* %6 to i8*
%8 = icmp ne i8* %3, null
%9 = icmp ne i8* %4, null
%10 = and i1 %8, %9
br i1 %10, label %11, label %41
11: ; preds = %5
%12 = load i8, i8* %4
%13 = icmp eq i8 %12, 0
br i1 %13, label %41, label %14
14: ; preds = %11
%15 = call i8** @string_split(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32* %6)
%16 = call i8** @string_split(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 0, i32* null)
%17 = icmp ne i8** %15, null
%18 = icmp ne i8** %16, null
%19 = select i1 %17, i1 %18, i1 false
%20 = load i32, i32* %6
%21 = icmp sgt i32 %20, 3
%22 = select i1 %19, i1 %21, i1 false
br i1 %22, label %23, label %35
23: ; preds = %14
%24 = load i8*, i8** %15
%25 = call i64 @string_strcasecmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
%28 = getelementptr inbounds i8*, i8** %15, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8*, i8** %15, i64 2
%31 = load i8*, i8** %30
%32 = getelementptr inbounds i8*, i8** %16, i64 3
%33 = load i8*, i8** %32
%34 = call i32 @gui_filter_new(i32 %27, i8* %3, i8* %29, i8* %31, i8* %33)
br label %35
35: ; preds = %23, %14
br i1 %17, label %36, label %38
36: ; preds = %35
%37 = call i32 @string_free_split(i8** %15)
br label %38
38: ; preds = %36, %35
br i1 %18, label %39, label %41
39: ; preds = %38
%40 = call i32 @string_free_split(i8** %16)
br label %41
41: ; preds = %38, %39, %11, %5
ret i32 1
}