#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*/ strcat(char *, char *);
void colour_to_pscolor(int option, int colour, char *output) {
  *output = '\0';
  if ((option & 128) == 0) {
    switch (colour) {
    case 1:
      strcat(output, "0.00 1.00 1.00");
      break;
    case 2:
      strcat(output, "0.00 0.00 1.00");
      break;
    case 3:
      strcat(output, "1.00 0.00 1.00");
      break;
    case 4:
      strcat(output, "1.00 0.00 0.00");
      break;
    case 5:
      strcat(output, "1.00 1.00 0.00");
      break;
    case 6:
      strcat(output, "0.00 1.00 0.00");
      break;
    case 8:
      strcat(output, "1.00 1.00 1.00");
      break;
    default:
      strcat(output, "0.00 0.00 0.00");
      break;
    }
    strcat(output, " setrgbcolor");
  } else {
    switch (colour) {
    case 1:
      strcat(output, "1.00 0.00 0.00 0.00");
      break;
    case 2:
      strcat(output, "1.00 1.00 0.00 0.00");
      break;
    case 3:
      strcat(output, "0.00 1.00 0.00 0.00");
      break;
    case 4:
      strcat(output, "0.00 1.00 1.00 0.00");
      break;
    case 5:
      strcat(output, "0.00 0.00 1.00 0.00");
      break;
    case 6:
      strcat(output, "1.00 0.00 1.00 0.00");
      break;
    case 8:
      strcat(output, "0.00 0.00 0.00 0.00");
      break;
    default:
      strcat(output, "0.00 0.00 0.00 1.00");
      break;
    }
    strcat(output, " setcmykcolor");
  }
}


x86 assembly (clang, -O0):
<colour_to_pscolor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    121b <colour_to_pscolor+0x10b>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     11f6 <colour_to_pscolor+0xe6>
mov    -0x18(%rbp),%rax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xf88(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xefa(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xef9(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xef8(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcat@plt>
jmp    1206 <colour_to_pscolor+0xf6>
mov    -0x10(%rbp),%rdi
lea    0xef6(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <strcat@plt>
jmp    12f7 <colour_to_pscolor+0x1e7>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x7,%eax
ja     12d7 <colour_to_pscolor+0x1c7>
mov    -0x20(%rbp),%rax
lea    0xdc5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe26(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1030 <strcat@plt>
jmp    12e7 <colour_to_pscolor+0x1d7>
mov    -0x10(%rbp),%rdi
lea    0xe24(%rip),%rsi
call   1030 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colour_to_pscolor>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
movb   $0x0,(%rdx)
add    $0xffffffff,%esi
test   $0x80,%dil
lea    0xf8f(%rip),%rcx
lea    0xf97(%rip),%rax
cmove  %rcx,%rax
cmp    $0x7,%esi
ja     1155 <colour_to_pscolor+0x45>
test   $0x80,%dil
lea    0x2c5d(%rip),%rax
lea    0x2c96(%rip),%rcx
cmove  %rax,%rcx
movslq %esi,%rax
mov    (%rcx,%rax,8),%rax
test   $0x80,%dil
lea    0xecd(%rip),%rcx
lea    0xf73(%rip),%rbx
cmove  %rcx,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"0.00 1.00 1.00\00"
@.str.1 = [15 x i8] c"0.00 0.00 1.00\00"
@.str.2 = [15 x i8] c"1.00 0.00 1.00\00"
@.str.3 = [15 x i8] c"1.00 0.00 0.00\00"
@.str.4 = [15 x i8] c"1.00 1.00 0.00\00"
@.str.5 = [15 x i8] c"0.00 1.00 0.00\00"
@.str.6 = [15 x i8] c"1.00 1.00 1.00\00"
@.str.7 = [15 x i8] c"0.00 0.00 0.00\00"
@.str.8 = [13 x i8] c" setrgbcolor\00"
@.str.9 = [20 x i8] c"1.00 0.00 0.00 0.00\00"
@.str.10 = [20 x i8] c"1.00 1.00 0.00 0.00\00"
@.str.11 = [20 x i8] c"0.00 1.00 0.00 0.00\00"
@.str.12 = [20 x i8] c"0.00 1.00 1.00 0.00\00"
@.str.13 = [20 x i8] c"0.00 0.00 1.00 0.00\00"
@.str.14 = [20 x i8] c"1.00 0.00 1.00 0.00\00"
@.str.15 = [20 x i8] c"0.00 0.00 0.00 0.00\00"
@.str.16 = [20 x i8] c"0.00 0.00 0.00 1.00\00"
@.str.17 = [14 x i8] c" setcmykcolor\00"
define void @colour_to_pscolor(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
store i8 0, i8* %7
%8 = load i32, i32* %4
%9 = and i32 %8, 128
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %40
11: ; preds = %3
%12 = load i32, i32* %5
switch i32 %12, label %34 [
i32 1, label %13
i32 2, label %16
i32 3, label %19
i32 4, label %22
i32 5, label %25
i32 6, label %28
i32 8, label %31
]
13: ; preds = %11
%14 = load i8*, i8** %6
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %37
16: ; preds = %11
%17 = load i8*, i8** %6
%18 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %37
19: ; preds = %11
%20 = load i8*, i8** %6
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %37
22: ; preds = %11
%23 = load i8*, i8** %6
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %37
25: ; preds = %11
%26 = load i8*, i8** %6
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %37
28: ; preds = %11
%29 = load i8*, i8** %6
%30 = call i32 @strcat(i8* %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %37
31: ; preds = %11
%32 = load i8*, i8** %6
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %37
34: ; preds = %11
%35 = load i8*, i8** %6
%36 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %37
37: ; preds = %34, %31, %28, %25, %22, %19, %16, %13
%38 = load i8*, i8** %6
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %69
40: ; preds = %3
%41 = load i32, i32* %5
switch i32 %41, label %63 [
i32 1, label %42
i32 2, label %45
i32 3, label %48
i32 4, label %51
i32 5, label %54
i32 6, label %57
i32 8, label %60
]
42: ; preds = %40
%43 = load i8*, i8** %6
%44 = call i32 @strcat(i8* %43, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
br label %66
45: ; preds = %40
%46 = load i8*, i8** %6
%47 = call i32 @strcat(i8* %46, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %66
48: ; preds = %40
%49 = load i8*, i8** %6
%50 = call i32 @strcat(i8* %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
br label %66
51: ; preds = %40
%52 = load i8*, i8** %6
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %66
54: ; preds = %40
%55 = load i8*, i8** %6
%56 = call i32 @strcat(i8* %55, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0))
br label %66
57: ; preds = %40
%58 = load i8*, i8** %6
%59 = call i32 @strcat(i8* %58, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
br label %66
60: ; preds = %40
%61 = load i8*, i8** %6
%62 = call i32 @strcat(i8* %61, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0))
br label %66
63: ; preds = %40
%64 = load i8*, i8** %6
%65 = call i32 @strcat(i8* %64, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0))
br label %66
66: ; preds = %63, %60, %57, %54, %51, %48, %45, %42
%67 = load i8*, i8** %6
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0))
br label %69
69: ; preds = %66, %37
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"0.00 1.00 1.00\00"
@.str.1 = [15 x i8] c"0.00 0.00 1.00\00"
@.str.2 = [15 x i8] c"1.00 0.00 1.00\00"
@.str.3 = [15 x i8] c"1.00 0.00 0.00\00"
@.str.4 = [15 x i8] c"1.00 1.00 0.00\00"
@.str.5 = [15 x i8] c"0.00 1.00 0.00\00"
@.str.6 = [15 x i8] c"1.00 1.00 1.00\00"
@.str.7 = [15 x i8] c"0.00 0.00 0.00\00"
@.str.8 = [13 x i8] c" setrgbcolor\00"
@.str.9 = [20 x i8] c"1.00 0.00 0.00 0.00\00"
@.str.10 = [20 x i8] c"1.00 1.00 0.00 0.00\00"
@.str.11 = [20 x i8] c"0.00 1.00 0.00 0.00\00"
@.str.12 = [20 x i8] c"0.00 1.00 1.00 0.00\00"
@.str.13 = [20 x i8] c"0.00 0.00 1.00 0.00\00"
@.str.14 = [20 x i8] c"1.00 0.00 1.00 0.00\00"
@.str.15 = [20 x i8] c"0.00 0.00 0.00 0.00\00"
@.str.16 = [20 x i8] c"0.00 0.00 0.00 1.00\00"
@.str.17 = [14 x i8] c" setcmykcolor\00"
@switch.table.colour_to_pscolor = [8 x i8*] [i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0)]
@switch.table.colour_to_pscolor.18 = [8 x i8*] [i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0)]
define void @colour_to_pscolor(i32 %0, i32 %1, i8* %2) {
store i8 0, i8* %2
%4 = and i32 %0, 128
%5 = icmp eq i32 %4, 0
%6 = add i32 %1, -1
%7 = icmp ult i32 %6, 8
%8 = select i1 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i64 0, i64 0)
br i1 %7, label %9, label %14
9: ; preds = %3
%10 = select i1 %5, [8 x i8*]* @switch.table.colour_to_pscolor, [8 x i8*]* @switch.table.colour_to_pscolor.18
%11 = sext i32 %6 to i64
%12 = getelementptr inbounds [8 x i8*], [8 x i8*]* %10, i64 0, i64 %11
%13 = load i8*, i8** %12
br label %14
14: ; preds = %3, %9
%15 = phi i8* [ %13, %9 ], [ %8, %3 ]
%16 = select i1 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0)
%17 = tail call i32 @strcat(i8* %2, i8* %15)
%18 = tail call i32 @strcat(i8* %2, i8* %16)
ret void
}