#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_decode_ansi(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);
  if (strcmp(modifier, "irc_color_decode_ansi") == 0)
    return irc_color_decode_ansi(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     1182 <irc_color_modifier_cb+0x42>
mov    -0x20(%rbp),%rdi
lea    0xe8d(%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    0xe62(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c4 <irc_color_modifier_cb+0x84>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1060 <irc_color_decode@plt>
mov    %rax,-0x8(%rbp)
jmp    122a <irc_color_modifier_cb+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f3 <irc_color_modifier_cb+0xb3>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1050 <irc_color_encode@plt>
mov    %rax,-0x8(%rbp)
jmp    122a <irc_color_modifier_cb+0xea>
mov    -0x18(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1222 <irc_color_modifier_cb+0xe2>
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   1040 <irc_color_decode_ansi@plt>
mov    %rax,-0x8(%rbp)
jmp    122a <irc_color_modifier_cb+0xea>
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     1169 <irc_color_modifier_cb+0x29>
lea    0xeaa(%rip),%rsi
mov    %rdx,%rdi
call   1030 <strcmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
jmp    116b <irc_color_modifier_cb+0x2b>
xor    %ebp,%ebp
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11ae <irc_color_modifier_cb+0x6e>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11bc <irc_color_modifier_cb+0x7c>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11ca <irc_color_modifier_cb+0x8a>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <irc_color_decode@plt>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <irc_color_encode@plt>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <irc_color_decode_ansi@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"
@.str.3 = [22 x i8] c"irc_color_decode_ansi\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 %46
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 %46
37: ; preds = %29
%38 = load i8*, i8** %7
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i8*, i8** %9
%43 = load i32, i32* %10
%44 = call i8* @irc_color_decode_ansi(i8* %42, i32 %43)
store i8* %44, i8** %5
br label %46
45: ; preds = %37
store i8* null, i8** %5
br label %46
46: ; preds = %45, %41, %33, %25
%47 = load i8*, i8** %5
ret i8* %47
}

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"
@.str.3 = [22 x i8] c"irc_color_decode_ansi\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 %26
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 %26
21: ; preds = %16
%22 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i8* @irc_color_decode_ansi(i8* %3, i32 %11)
br label %26
26: ; preds = %21, %24, %19, %14
%27 = phi i8* [ %15, %14 ], [ %20, %19 ], [ %25, %24 ], [ null, %21 ]
ret i8* %27
}