#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*/ printf(char *, ...);
void pset(int color, int pal) {
  printf("%c[4", 27);
  if (color == 0)
    printf("0");
  if (color == 3)
    printf("7");
  if (pal) {
    if (color == 1)
      printf("4");
    if (color == 2)
      printf("3");
  } else {
    if (color == 1)
      printf("5");
    if (color == 2)
      printf("2");
  }
  printf("m ");
}


x86 assembly (clang, -O0):
<pset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xedb(%rip),%rdi
mov    $0x1b,%esi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1149 <pset+0x39>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0x4(%rbp)
jne    1161 <pset+0x51>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11a0 <pset+0x90>
cmpl   $0x1,-0x4(%rbp)
jne    1183 <pset+0x73>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    119b <pset+0x8b>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d5 <pset+0xc5>
cmpl   $0x1,-0x4(%rbp)
jne    11b8 <pset+0xa8>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
jne    11d0 <pset+0xc0>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d5 <pset+0xc5>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pset>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xed2(%rip),%rdi
mov    $0x1b,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
je     114a <pset+0x2a>
cmp    $0x3,%ebx
jne    1154 <pset+0x34>
mov    $0x37,%edi
jmp    114f <pset+0x2f>
mov    $0x30,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
je     1169 <pset+0x49>
cmp    $0x1,%ebx
je     117a <pset+0x5a>
cmp    $0x2,%ebx
jne    118b <pset+0x6b>
mov    $0x33,%edi
jmp    1186 <pset+0x66>
cmp    $0x1,%ebx
je     1181 <pset+0x61>
cmp    $0x2,%ebx
jne    118b <pset+0x6b>
mov    $0x32,%edi
jmp    1186 <pset+0x66>
mov    $0x34,%edi
jmp    1186 <pset+0x66>
mov    $0x35,%edi
call   1030 <putchar@plt>
lea    0xe73(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%c[4\00"
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"7\00"
@.str.3 = [2 x i8] c"4\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [2 x i8] c"5\00"
@.str.6 = [2 x i8] c"2\00"
@.str.7 = [3 x i8] c"m \00"
define void @pset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %3
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %23
br label %40
29: ; preds = %15
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %3
%36 = icmp eq i32 %35, 2
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
br label %40
40: ; preds = %39, %28
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c[4\00"
@.str.7 = [3 x i8] c"m \00"
define void @pset(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 27)
switch i32 %0, label %8 [
i32 0, label %5
i32 3, label %4
]
4: ; preds = %2
br label %5
5: ; preds = %2, %4
%6 = phi i32 [ 55, %4 ], [ 48, %2 ]
%7 = tail call i32 @putchar(i32 %6)
br label %8
8: ; preds = %5, %2
%9 = icmp eq i32 %1, 0
br i1 %9, label %12, label %10
10: ; preds = %8
switch i32 %0, label %17 [
i32 1, label %14
i32 2, label %11
]
11: ; preds = %10
br label %14
12: ; preds = %8
switch i32 %0, label %17 [
i32 1, label %14
i32 2, label %13
]
13: ; preds = %12
br label %14
14: ; preds = %12, %10, %11, %13
%15 = phi i32 [ 50, %13 ], [ 51, %11 ], [ 52, %10 ], [ 53, %12 ]
%16 = tail call i32 @putchar(i32 %15)
br label %17
17: ; preds = %14, %12, %10
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
ret void
}