#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(const void *pointer, void *data,
                            const char *modifier, const char *modifier_data,
                            const char *string) {
  int keep_colors;
  (void)pointer;
  (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    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x35(%rbp)
je     1186 <irc_color_modifier_cb+0x46>
mov    -0x28(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11c8 <irc_color_modifier_cb+0x88>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1060 <irc_color_decode@plt>
mov    %rax,-0x8(%rbp)
jmp    122e <irc_color_modifier_cb+0xee>
mov    -0x20(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11f7 <irc_color_modifier_cb+0xb7>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <irc_color_encode@plt>
mov    %rax,-0x8(%rbp)
jmp    122e <irc_color_modifier_cb+0xee>
mov    -0x20(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1226 <irc_color_modifier_cb+0xe6>
mov    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1040 <irc_color_decode_ansi@plt>
mov    %rax,-0x8(%rbp)
jmp    122e <irc_color_modifier_cb+0xee>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_color_modifier_cb>:
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %rdx,%rbx
test   %rcx,%rcx
je     1169 <irc_color_modifier_cb+0x29>
lea    0xeaa(%rip),%rsi
mov    %rcx,%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, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %10
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %21
17: ; preds = %5
%18 = load i8*, i8** %10
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br label %21
21: ; preds = %17, %5
%22 = phi i1 [ false, %5 ], [ %20, %17 ]
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
store i32 %24, i32* %12
%25 = load i8*, i8** %9
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load i8*, i8** %11
%30 = load i32, i32* %12
%31 = call i8* @irc_color_decode(i8* %29, i32 %30)
store i8* %31, i8** %6
br label %49
32: ; preds = %21
%33 = load i8*, i8** %9
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i8*, i8** %11
%38 = load i32, i32* %12
%39 = call i8* @irc_color_encode(i8* %37, i32 %38)
store i8* %39, i8** %6
br label %49
40: ; preds = %32
%41 = load i8*, i8** %9
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i8*, i8** %11
%46 = load i32, i32* %12
%47 = call i8* @irc_color_decode_ansi(i8* %45, i32 %46)
store i8* %47, i8** %6
br label %49
48: ; preds = %40
store i8* null, i8** %6
br label %49
49: ; preds = %48, %44, %36, %28
%50 = load i8*, i8** %6
ret i8* %50
}

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* nocapture readnone %1, i8* %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %3, null
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = tail call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %5
%12 = phi i32 [ 0, %5 ], [ %10, %7 ]
%13 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i8* @irc_color_decode(i8* %4, i32 %12)
br label %27
17: ; preds = %11
%18 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i8* @irc_color_encode(i8* %4, i32 %12)
br label %27
22: ; preds = %17
%23 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i8* @irc_color_decode_ansi(i8* %4, i32 %12)
br label %27
27: ; preds = %22, %25, %20, %15
%28 = phi i8* [ %16, %15 ], [ %21, %20 ], [ %26, %25 ], [ null, %22 ]
ret i8* %28
}