#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 */
int /*<<< orphan*/ ct_blue(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ ct_br(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ ct_bw(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ ct_green(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ ct_jet(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ ct_red(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char *, char *);
void SetColorMap(unsigned char *r, unsigned char *g, unsigned char *b,
                 char *map_name) {
  int ii;
  if (!strcmp(map_name, "bw"))
    ct_bw(r, g, b);
  else if (!strcmp(map_name, "red"))
    ct_red(r, g, b);
  else if (!strcmp(map_name, "br"))
    ct_br(r, g, b);
  else if (!strcmp(map_name, "blue"))
    ct_blue(r, g, b);
  else if (!strcmp(map_name, "green"))
    ct_green(r, g, b);
  else if (!strcmp(map_name, "jet"))
    ct_jet(r, g, b);
  else {
    printf(" ? Colormap is not defined, using B&W\n");
    ct_bw(r, g, b);
  }
}


x86 assembly (clang, -O0):
<SetColorMap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11c7 <SetColorMap+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ct_bw@plt>
jmp    12e8 <SetColorMap+0x168>
mov    -0x20(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    11f6 <SetColorMap+0x76>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1090 <ct_red@plt>
jmp    12e3 <SetColorMap+0x163>
mov    -0x20(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1225 <SetColorMap+0xa5>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1080 <ct_br@plt>
jmp    12de <SetColorMap+0x15e>
mov    -0x20(%rbp),%rdi
lea    0xdda(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1254 <SetColorMap+0xd4>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1070 <ct_blue@plt>
jmp    12d9 <SetColorMap+0x159>
mov    -0x20(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1283 <SetColorMap+0x103>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <ct_green@plt>
jmp    12d4 <SetColorMap+0x154>
mov    -0x20(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12b2 <SetColorMap+0x132>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   10a0 <ct_jet@plt>
jmp    12cf <SetColorMap+0x14f>
lea    0xd60(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <ct_bw@plt>
jmp    12d4 <SetColorMap+0x154>
jmp    12d9 <SetColorMap+0x159>
jmp    12de <SetColorMap+0x15e>
jmp    12e3 <SetColorMap+0x163>
jmp    12e8 <SetColorMap+0x168>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetColorMap>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xe65(%rip),%rsi
mov    %rcx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1226 <SetColorMap+0xa6>
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     123f <SetColorMap+0xbf>
lea    0xe42(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1258 <SetColorMap+0xd8>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     1271 <SetColorMap+0xf1>
lea    0xe1c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     128a <SetColorMap+0x10a>
lea    0xe0b(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %eax,%eax
je     12a3 <SetColorMap+0x123>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <ct_bw@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1090 <ct_red@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <ct_br@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <ct_blue@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <ct_green@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    10a0 <ct_jet@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"bw\00"
@.str.1 = [4 x i8] c"red\00"
@.str.2 = [3 x i8] c"br\00"
@.str.3 = [5 x i8] c"blue\00"
@.str.4 = [6 x i8] c"green\00"
@.str.5 = [4 x i8] c"jet\00"
@.str.6 = [39 x i8] c" ? Colormap is not defined, using B&W\0A\00"
define void @SetColorMap(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = call i32 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %4
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = call i32 @ct_bw(i8* %14, i8* %15, i8* %16)
br label %74
18: ; preds = %4
%19 = load i8*, i8** %8
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = load i8*, i8** %6
%25 = load i8*, i8** %7
%26 = call i32 @ct_red(i8* %23, i8* %24, i8* %25)
br label %73
27: ; preds = %18
%28 = load i8*, i8** %8
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %27
%32 = load i8*, i8** %5
%33 = load i8*, i8** %6
%34 = load i8*, i8** %7
%35 = call i32 @ct_br(i8* %32, i8* %33, i8* %34)
br label %72
36: ; preds = %27
%37 = load i8*, i8** %8
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %45, label %40
40: ; preds = %36
%41 = load i8*, i8** %5
%42 = load i8*, i8** %6
%43 = load i8*, i8** %7
%44 = call i32 @ct_blue(i8* %41, i8* %42, i8* %43)
br label %71
45: ; preds = %36
%46 = load i8*, i8** %8
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %54, label %49
49: ; preds = %45
%50 = load i8*, i8** %5
%51 = load i8*, i8** %6
%52 = load i8*, i8** %7
%53 = call i32 @ct_green(i8* %50, i8* %51, i8* %52)
br label %70
54: ; preds = %45
%55 = load i8*, i8** %8
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %54
%59 = load i8*, i8** %5
%60 = load i8*, i8** %6
%61 = load i8*, i8** %7
%62 = call i32 @ct_jet(i8* %59, i8* %60, i8* %61)
br label %69
63: ; preds = %54
%64 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%65 = load i8*, i8** %5
%66 = load i8*, i8** %6
%67 = load i8*, i8** %7
%68 = call i32 @ct_bw(i8* %65, i8* %66, i8* %67)
br label %69
69: ; preds = %63, %58
br label %70
70: ; preds = %69, %49
br label %71
71: ; preds = %70, %40
br label %72
72: ; preds = %71, %31
br label %73
73: ; preds = %72, %22
br label %74
74: ; preds = %73, %13
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"bw\00"
@.str.1 = [4 x i8] c"red\00"
@.str.2 = [3 x i8] c"br\00"
@.str.3 = [5 x i8] c"blue\00"
@.str.4 = [6 x i8] c"green\00"
@.str.5 = [4 x i8] c"jet\00"
@str = [38 x i8] c" ? Colormap is not defined, using B&W\00"
define void @SetColorMap(i8* %0, i8* %1, i8* %2, i8* nocapture %3) {
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @ct_bw(i8* %0, i8* %1, i8* %2)
br label %37
9: ; preds = %4
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @ct_red(i8* %0, i8* %1, i8* %2)
br label %37
14: ; preds = %9
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @ct_br(i8* %0, i8* %1, i8* %2)
br label %37
19: ; preds = %14
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = tail call i32 @ct_blue(i8* %0, i8* %1, i8* %2)
br label %37
24: ; preds = %19
%25 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @ct_green(i8* %0, i8* %1, i8* %2)
br label %37
29: ; preds = %24
%30 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @ct_jet(i8* %0, i8* %1, i8* %2)
br label %37
34: ; preds = %29
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%36 = tail call i32 @ct_bw(i8* %0, i8* %1, i8* %2)
br label %37
37: ; preds = %12, %22, %32, %34, %27, %17, %7
ret void
}