#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 */
char *irc_color_decode(char const *, int);
char *irc_color_encode(char const *, int);
scalar_t__ strcmp(char const *, char *);
char *irc_color_modifier_cb(void *data, const char *modifier,
                            const char *modifier_data, const char *string) {
  int keep_colors;
  (void)data;
  keep_colors = (modifier_data && (strcmp(modifier_data, "1") == 0)) ? 1 : 0;
  if (strcmp(modifier, "irc_color_decode") == 0)
    return irc_color_decode(string, keep_colors);
  if (strcmp(modifier, "irc_color_encode") == 0)
    return irc_color_encode(string, keep_colors);
  return NULL;
}


x86 assembly (clang, -O0):
<irc_color_modifier_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x2d(%rbp)
je     1172 <irc_color_modifier_cb+0x42>
mov    -0x20(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11b4 <irc_color_modifier_cb+0x84>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1050 <irc_color_decode@plt>
mov    %rax,-0x8(%rbp)
jmp    11eb <irc_color_modifier_cb+0xbb>
mov    -0x18(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11e3 <irc_color_modifier_cb+0xb3>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1040 <irc_color_encode@plt>
mov    %rax,-0x8(%rbp)
jmp    11eb <irc_color_modifier_cb+0xbb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_color_modifier_cb>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rsi,%rbx
test   %rdx,%rdx
je     1159 <irc_color_modifier_cb+0x29>
lea    0xeba(%rip),%rsi
mov    %rdx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
jmp    115b <irc_color_modifier_cb+0x2b>
xor    %ebp,%ebp
lea    0xea0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     118a <irc_color_modifier_cb+0x5a>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1198 <irc_color_modifier_cb+0x68>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <irc_color_decode@plt>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <irc_color_encode@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [17 x i8] c"irc_color_decode\00"
@.str.2 = [17 x i8] c"irc_color_encode\00"
define i8* @irc_color_modifier_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load i8*, i8** %8
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br label %18
18: ; preds = %14, %4
%19 = phi i1 [ false, %4 ], [ %17, %14 ]
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
store i32 %21, i32* %10
%22 = load i8*, i8** %7
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = load i8*, i8** %9
%27 = load i32, i32* %10
%28 = call i8* @irc_color_decode(i8* %26, i32 %27)
store i8* %28, i8** %5
br label %38
29: ; preds = %18
%30 = load i8*, i8** %7
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i8*, i8** %9
%35 = load i32, i32* %10
%36 = call i8* @irc_color_encode(i8* %34, i32 %35)
store i8* %36, i8** %5
br label %38
37: ; preds = %29
store i8* null, i8** %5
br label %38
38: ; preds = %37, %33, %25
%39 = load i8*, i8** %5
ret i8* %39
}

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
@.str.1 = [17 x i8] c"irc_color_decode\00"
@.str.2 = [17 x i8] c"irc_color_encode\00"
define i8* @irc_color_modifier_cb(i8* nocapture readnone %0, i8* %1, i8* %2, i8* %3) {
%5 = icmp eq i8* %2, null
br i1 %5, label %10, label %6
6: ; preds = %4
%7 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 0, %4 ], [ %9, %6 ]
%12 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = tail call i8* @irc_color_decode(i8* %3, i32 %11)
br label %21
16: ; preds = %10
%17 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i8* @irc_color_encode(i8* %3, i32 %11)
br label %21
21: ; preds = %16, %19, %14
%22 = phi i8* [ %15, %14 ], [ %20, %19 ], [ null, %16 ]
ret i8* %22
}