#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 *);
int /*<<< orphan*/ strcpy(char *, char *);
void colour_to_pscolor(int option, int colour, char *output) {
  strcpy(output, "");
  if ((option & 128) == 0) {
    switch (colour) {
    case 0:
      strcat(output, "1.00 1.00 1.00");
      break;
    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;
    default:
      strcat(output, "0.00 0.00 0.00");
      break;
    }
    strcat(output, " setrgbcolor");
  } else {
    switch (colour) {
    case 0:
      strcat(output, "0.00 0.00 0.00 0.00");
      break;
    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;
    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),%rdi
lea    0xf48(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1230 <colour_to_pscolor+0x110>
mov    -0x8(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x6,%rax
ja     120b <colour_to_pscolor+0xeb>
mov    -0x18(%rbp),%rax
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xf56(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xedc(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xedb(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xeda(%rip),%rsi
call   1040 <strcat@plt>
jmp    121b <colour_to_pscolor+0xfb>
mov    -0x10(%rbp),%rdi
lea    0xe61(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1040 <strcat@plt>
jmp    1308 <colour_to_pscolor+0x1e8>
mov    -0x8(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x6,%rax
ja     12e8 <colour_to_pscolor+0x1c8>
mov    -0x20(%rbp),%rax
lea    0xdb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe10(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe0c(%rip),%rsi
call   1040 <strcat@plt>
jmp    12f8 <colour_to_pscolor+0x1d8>
mov    -0x10(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe0f(%rip),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colour_to_pscolor>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xf1a(%rip),%rsi
mov    %rdx,%rdi
call   1030 <strcpy@plt>
test   $0x80,%bpl
lea    0xef9(%rip),%rax
lea    0xf79(%rip),%rsi
cmove  %rax,%rsi
cmp    $0x6,%r14d
ja     1174 <colour_to_pscolor+0x54>
test   $0x80,%bpl
lea    0x2c4e(%rip),%rax
lea    0x2c7f(%rip),%rcx
cmove  %rax,%rcx
movslq %r14d,%rax
mov    (%rcx,%rax,8),%rsi
test   $0x80,%bpl
lea    0xeae(%rip),%rax
lea    0xf54(%rip),%rbp
cmove  %rax,%rbp
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <strcat@plt>

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

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