#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 color(char *what, short fg, short bg, short sh) {
  static char sp[] = "   ";
  printf("%sForeground: %hd%sBackground: ", what, fg, sp);
  if (bg == fg)
    printf("transparent%s", sp);
  else
    printf("%hd%s", bg, sp);
  printf("Shadow: ");
  if (sh == fg)
    printf("none\n");
  else
    printf("%hd\n", sh);
}


x86 assembly (clang, -O0):
<color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %cx,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
mov    -0x8(%rbp),%rsi
movswl -0xa(%rbp),%edx
lea    0xec0(%rip),%rdi
lea    0x2ee1(%rip),%rcx
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0xc(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jne    1178 <color+0x68>
lea    0xebb(%rip),%rdi
lea    0x2ebc(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <color+0x81>
movswl -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
lea    0x2e9e(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0xe(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jne    11c2 <color+0xb2>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <color+0xc4>
movswl -0xe(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<color>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%rsi
lea    0xecb(%rip),%rdi
lea    0x2ef4(%rip),%rcx
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %bp,%bx
jne    1161 <color+0x41>
lea    0xecf(%rip),%rdi
lea    0x2ed8(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1179 <color+0x59>
movswl %bx,%esi
lea    0xec3(%rip),%rdi
lea    0x2ebe(%rip),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %bp,%r14w
jne    119d <color+0x7d>
lea    0xeae(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>
movswl %r14w,%esi
lea    0xe95(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@color.sp = internal global [4 x i8] c" \00"
@.str = [32 x i8] c"%sForeground: %hd%sBackground: \00"
@.str.1 = [14 x i8] c"transparent%s\00"
@.str.2 = [6 x i8] c"%hd%s\00"
@.str.3 = [9 x i8] c"Shadow: \00"
@.str.4 = [6 x i8] c"none\0A\00"
@.str.5 = [5 x i8] c"%hd\0A\00"
define void @color(i8* %0, i16 signext %1, i16 signext %2, i16 signext %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
store i8* %0, i8** %5
store i16 %1, i16* %6
store i16 %2, i16* %7
store i16 %3, i16* %8
%9 = load i8*, i8** %5
%10 = load i16, i16* %6
%11 = sext i16 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
%13 = load i16, i16* %7
%14 = sext i16 %13 to i32
%15 = load i16, i16* %6
%16 = sext i16 %15 to i32
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %20
18: ; preds = %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
br label %24
20: ; preds = %4
%21 = load i16, i16* %7
%22 = sext i16 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
br label %24
24: ; preds = %20, %18
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%26 = load i16, i16* %8
%27 = sext i16 %26 to i32
%28 = load i16, i16* %6
%29 = sext i16 %28 to i32
%30 = icmp eq i32 %27, %29
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %37
33: ; preds = %24
%34 = load i16, i16* %8
%35 = sext i16 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %31
ret void
}

LLVM IR (-O2):
@color.sp = internal global [4 x i8] c" \00"
@.str = [32 x i8] c"%sForeground: %hd%sBackground: \00"
@.str.1 = [14 x i8] c"transparent%s\00"
@.str.2 = [6 x i8] c"%hd%s\00"
@.str.3 = [9 x i8] c"Shadow: \00"
@.str.5 = [5 x i8] c"%hd\0A\00"
@str = [5 x i8] c"none\00"
define void @color(i8* %0, i16 signext %1, i16 signext %2, i16 signext %3) {
%5 = sext i16 %1 to i32
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
%7 = icmp eq i16 %2, %1
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
br label %13
10: ; preds = %4
%11 = sext i16 %2 to i32
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @color.sp, i64 0, i64 0))
br label %13
13: ; preds = %10, %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i16 %3, %1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %21
18: ; preds = %13
%19 = sext i16 %3 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %16
ret void
}