#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*/ change_color(unsigned char);
int /*<<< orphan*/ getString(unsigned char *, int);
int /*<<< orphan*/ printString(char *);
void change_text_color() {
  unsigned char n;
  unsigned char colorbuff[100] = {0};
  unsigned char color_texto = 0, color_fondo = 0, valores = 0;
  printString("0 - Negro       8 - Gris Oscuro\n");
  printString("1 - Azul        9 - Azul Claro\n");
  printString("2 - Verde       A - Verde Claro\n");
  printString("3 - Celeste     B - Celeste Claro\n");
  printString("4 - Rojo        C - Rojo Claro\n");
  printString("5 - Violeta     D - Rosa\n");
  printString("6 - Marron      E - Amarillo\n");
  printString("7 - Gris Claro  F - Blanco\n");
  printString("Elija un color de texto: ");
  getString(colorbuff, 100);
  n = colorbuff[0];
  if (n >= '0' && n <= '9') {
    color_texto = colorbuff[0] - '0';
    valores += color_texto;
  } else if (n >= 'A' && n <= 'F') {
    color_texto = n - 'A' + 10;
    valores += color_texto;
  } else {
    printString("Input Errado!\n");
  }
  printString("Elija un color de fondo: ");
  getString(colorbuff, 100);
  n = colorbuff[0];
  if (n >= '0' && n <= '9') {
    color_fondo = n - '0';
    valores += color_fondo * 16;
  } else if (n >= 'A' && n <= 'F') {
    color_fondo = n - 'A' + 10;
    valores += color_fondo * 16;
  } else {
    printString("Input Errado!\n");
  }
  if (color_texto == color_fondo) {
    printString("El texto y el fondo tienen que");
    printString(" tener colores distintos!\n");
    return;
  }
  if (color_texto == color_fondo) {
    printString("El texto y el fondo tienen que");
    printString(" tener colores distintos!\n");
    return;
  }
  change_color(valores);
}


x86 assembly (clang, -O0):
<change_text_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movb   $0x0,-0x71(%rbp)
movb   $0x0,-0x72(%rbp)
movb   $0x0,-0x73(%rbp)
lea    0xe92(%rip),%rdi
call   1050 <printString@plt>
lea    0xea7(%rip),%rdi
call   1050 <printString@plt>
lea    0xebb(%rip),%rdi
call   1050 <printString@plt>
lea    0xed0(%rip),%rdi
call   1050 <printString@plt>
lea    0xee7(%rip),%rdi
call   1050 <printString@plt>
lea    0xefb(%rip),%rdi
call   1050 <printString@plt>
lea    0xf09(%rip),%rdi
call   1050 <printString@plt>
lea    0xf1b(%rip),%rdi
call   1050 <printString@plt>
lea    0xf2b(%rip),%rdi
call   1050 <printString@plt>
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1030 <getString@plt>
mov    -0x70(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     121d <change_text_color+0xdd>
movzbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     121d <change_text_color+0xdd>
movzbl -0x70(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x71(%rbp)
movzbl -0x71(%rbp),%ecx
movzbl -0x73(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x73(%rbp)
jmp    1267 <change_text_color+0x127>
movzbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1256 <change_text_color+0x116>
movzbl -0x1(%rbp),%eax
cmp    $0x46,%eax
jg     1256 <change_text_color+0x116>
movzbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x71(%rbp)
movzbl -0x71(%rbp),%ecx
movzbl -0x73(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x73(%rbp)
jmp    1262 <change_text_color+0x122>
lea    0xeb6(%rip),%rdi
call   1050 <printString@plt>
jmp    1267 <change_text_color+0x127>
lea    0xeb4(%rip),%rdi
call   1050 <printString@plt>
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1030 <getString@plt>
mov    -0x70(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     12c0 <change_text_color+0x180>
movzbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     12c0 <change_text_color+0x180>
movzbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x72(%rbp)
movzbl -0x72(%rbp),%ecx
shl    $0x4,%ecx
movzbl -0x73(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x73(%rbp)
jmp    130d <change_text_color+0x1cd>
movzbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     12fc <change_text_color+0x1bc>
movzbl -0x1(%rbp),%eax
cmp    $0x46,%eax
jg     12fc <change_text_color+0x1bc>
movzbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x72(%rbp)
movzbl -0x72(%rbp),%ecx
shl    $0x4,%ecx
movzbl -0x73(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x73(%rbp)
jmp    1308 <change_text_color+0x1c8>
lea    0xe10(%rip),%rdi
call   1050 <printString@plt>
jmp    130d <change_text_color+0x1cd>
movzbl -0x71(%rbp),%eax
movzbl -0x72(%rbp),%ecx
cmp    %ecx,%eax
jne    133a <change_text_color+0x1fa>
lea    0xe18(%rip),%rdi
call   1050 <printString@plt>
lea    0xe2b(%rip),%rdi
call   1050 <printString@plt>
jmp    1370 <change_text_color+0x230>
movzbl -0x71(%rbp),%eax
movzbl -0x72(%rbp),%ecx
cmp    %ecx,%eax
jne    1367 <change_text_color+0x227>
lea    0xdeb(%rip),%rdi
call   1050 <printString@plt>
lea    0xdfe(%rip),%rdi
call   1050 <printString@plt>
jmp    1370 <change_text_color+0x230>
movzbl -0x73(%rbp),%edi
call   1060 <change_color@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<change_text_color>:
push   %rbx
sub    $0x70,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
lea    0xe9c(%rip),%rdi
call   1040 <printString@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printString@plt>
lea    0xec5(%rip),%rdi
call   1040 <printString@plt>
lea    0xeda(%rip),%rdi
call   1040 <printString@plt>
lea    0xef1(%rip),%rdi
call   1040 <printString@plt>
lea    0xf05(%rip),%rdi
call   1040 <printString@plt>
lea    0xf13(%rip),%rdi
call   1040 <printString@plt>
lea    0xf25(%rip),%rdi
call   1040 <printString@plt>
lea    0xf35(%rip),%rdi
call   1040 <printString@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
call   1030 <getString@plt>
mov    (%rsp),%al
lea    -0x30(%rax),%ebx
cmp    $0xa,%bl
jb     11fd <change_text_color+0xcd>
lea    -0x41(%rax),%ecx
cmp    $0x5,%cl
ja     11ef <change_text_color+0xbf>
add    $0xc9,%al
mov    %eax,%ebx
jmp    11fd <change_text_color+0xcd>
lea    0xf1d(%rip),%rdi
call   1040 <printString@plt>
xor    %ebx,%ebx
lea    0xf1e(%rip),%rdi
call   1040 <printString@plt>
mov    %rsp,%rdi
mov    $0x64,%esi
call   1030 <getString@plt>
movzbl (%rsp),%eax
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1227 <change_text_color+0xf7>
add    $0xffffffd0,%eax
jmp    1232 <change_text_color+0x102>
lea    -0x41(%rax),%ecx
cmp    $0x5,%cl
ja     1257 <change_text_color+0x127>
add    $0xffffffc9,%eax
mov    %eax,%ecx
shl    $0x4,%cl
add    %bl,%cl
cmp    %al,%bl
jne    126b <change_text_color+0x13b>
lea    0xef8(%rip),%rdi
call   1040 <printString@plt>
lea    0xf0b(%rip),%rdi
call   1040 <printString@plt>
jmp    1273 <change_text_color+0x143>
lea    0xeb5(%rip),%rdi
call   1040 <printString@plt>
xor    %eax,%eax
mov    %ebx,%ecx
cmp    %al,%bl
je     123d <change_text_color+0x10d>
movzbl %cl,%edi
call   1050 <change_color@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"0 - Negro 8 - Gris Oscuro\0A\00"
@.str.1 = [32 x i8] c"1 - Azul 9 - Azul Claro\0A\00"
@.str.2 = [33 x i8] c"2 - Verde A - Verde Claro\0A\00"
@.str.3 = [35 x i8] c"3 - Celeste B - Celeste Claro\0A\00"
@.str.4 = [32 x i8] c"4 - Rojo C - Rojo Claro\0A\00"
@.str.5 = [26 x i8] c"5 - Violeta D - Rosa\0A\00"
@.str.6 = [30 x i8] c"6 - Marron E - Amarillo\0A\00"
@.str.7 = [28 x i8] c"7 - Gris Claro F - Blanco\0A\00"
@.str.8 = [26 x i8] c"Elija un color de texto: \00"
@.str.9 = [15 x i8] c"Input Errado!\0A\00"
@.str.10 = [26 x i8] c"Elija un color de fondo: \00"
@.str.11 = [31 x i8] c"El texto y el fondo tienen que\00"
@.str.12 = [27 x i8] c" tener colores distintos!\0A\00"
define void @change_text_color() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = bitcast [100 x i8]* %2 to i8*
store i8 0, i8* %3
store i8 0, i8* %4
store i8 0, i8* %5
%7 = call i32 @printString(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printString(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @printString(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @printString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 @printString(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%17 = call i32 @getString(i8* %16, i32 100)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%19 = load i8, i8* %18
store i8 %19, i8* %1
%20 = load i8, i8* %1
%21 = zext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %39
23: ; preds = %0
%24 = load i8, i8* %1
%25 = zext i8 %24 to i32
%26 = icmp sle i32 %25, 57
br i1 %26, label %27, label %39
27: ; preds = %23
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = sub nsw i32 %30, 48
%32 = trunc i32 %31 to i8
store i8 %32, i8* %3
%33 = load i8, i8* %3
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = add nsw i32 %36, %34
%38 = trunc i32 %37 to i8
store i8 %38, i8* %5
br label %62
39: ; preds = %23, %0
%40 = load i8, i8* %1
%41 = zext i8 %40 to i32
%42 = icmp sge i32 %41, 65
br i1 %42, label %43, label %59
43: ; preds = %39
%44 = load i8, i8* %1
%45 = zext i8 %44 to i32
%46 = icmp sle i32 %45, 70
br i1 %46, label %47, label %59
47: ; preds = %43
%48 = load i8, i8* %1
%49 = zext i8 %48 to i32
%50 = sub nsw i32 %49, 65
%51 = add nsw i32 %50, 10
%52 = trunc i32 %51 to i8
store i8 %52, i8* %3
%53 = load i8, i8* %3
%54 = zext i8 %53 to i32
%55 = load i8, i8* %5
%56 = zext i8 %55 to i32
%57 = add nsw i32 %56, %54
%58 = trunc i32 %57 to i8
store i8 %58, i8* %5
br label %61
59: ; preds = %43, %39
%60 = call i32 @printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %61
61: ; preds = %59, %47
br label %62
62: ; preds = %61, %27
%63 = call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%65 = call i32 @getString(i8* %64, i32 100)
%66 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%67 = load i8, i8* %66
store i8 %67, i8* %1
%68 = load i8, i8* %1
%69 = zext i8 %68 to i32
%70 = icmp sge i32 %69, 48
br i1 %70, label %71, label %87
71: ; preds = %62
%72 = load i8, i8* %1
%73 = zext i8 %72 to i32
%74 = icmp sle i32 %73, 57
br i1 %74, label %75, label %87
75: ; preds = %71
%76 = load i8, i8* %1
%77 = zext i8 %76 to i32
%78 = sub nsw i32 %77, 48
%79 = trunc i32 %78 to i8
store i8 %79, i8* %4
%80 = load i8, i8* %4
%81 = zext i8 %80 to i32
%82 = mul nsw i32 %81, 16
%83 = load i8, i8* %5
%84 = zext i8 %83 to i32
%85 = add nsw i32 %84, %82
%86 = trunc i32 %85 to i8
store i8 %86, i8* %5
br label %111
87: ; preds = %71, %62
%88 = load i8, i8* %1
%89 = zext i8 %88 to i32
%90 = icmp sge i32 %89, 65
br i1 %90, label %91, label %108
91: ; preds = %87
%92 = load i8, i8* %1
%93 = zext i8 %92 to i32
%94 = icmp sle i32 %93, 70
br i1 %94, label %95, label %108
95: ; preds = %91
%96 = load i8, i8* %1
%97 = zext i8 %96 to i32
%98 = sub nsw i32 %97, 65
%99 = add nsw i32 %98, 10
%100 = trunc i32 %99 to i8
store i8 %100, i8* %4
%101 = load i8, i8* %4
%102 = zext i8 %101 to i32
%103 = mul nsw i32 %102, 16
%104 = load i8, i8* %5
%105 = zext i8 %104 to i32
%106 = add nsw i32 %105, %103
%107 = trunc i32 %106 to i8
store i8 %107, i8* %5
br label %110
108: ; preds = %91, %87
%109 = call i32 @printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %110
110: ; preds = %108, %95
br label %111
111: ; preds = %110, %75
%112 = load i8, i8* %3
%113 = zext i8 %112 to i32
%114 = load i8, i8* %4
%115 = zext i8 %114 to i32
%116 = icmp eq i32 %113, %115
br i1 %116, label %117, label %120
117: ; preds = %111
%118 = call i32 @printString(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%119 = call i32 @printString(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
br label %132
120: ; preds = %111
%121 = load i8, i8* %3
%122 = zext i8 %121 to i32
%123 = load i8, i8* %4
%124 = zext i8 %123 to i32
%125 = icmp eq i32 %122, %124
br i1 %125, label %126, label %129
126: ; preds = %120
%127 = call i32 @printString(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%128 = call i32 @printString(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
br label %132
129: ; preds = %120
%130 = load i8, i8* %5
%131 = call i32 @change_color(i8 zeroext %130)
br label %132
132: ; preds = %129, %126, %117
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"0 - Negro 8 - Gris Oscuro\0A\00"
@.str.1 = [32 x i8] c"1 - Azul 9 - Azul Claro\0A\00"
@.str.2 = [33 x i8] c"2 - Verde A - Verde Claro\0A\00"
@.str.3 = [35 x i8] c"3 - Celeste B - Celeste Claro\0A\00"
@.str.4 = [32 x i8] c"4 - Rojo C - Rojo Claro\0A\00"
@.str.5 = [26 x i8] c"5 - Violeta D - Rosa\0A\00"
@.str.6 = [30 x i8] c"6 - Marron E - Amarillo\0A\00"
@.str.7 = [28 x i8] c"7 - Gris Claro F - Blanco\0A\00"
@.str.8 = [26 x i8] c"Elija un color de texto: \00"
@.str.9 = [15 x i8] c"Input Errado!\0A\00"
@.str.10 = [26 x i8] c"Elija un color de fondo: \00"
@.str.11 = [31 x i8] c"El texto y el fondo tienen que\00"
@.str.12 = [27 x i8] c" tener colores distintos!\0A\00"
define void @change_text_color() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printString(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @printString(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @printString(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @printString(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%9 = tail call i32 @printString(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%10 = tail call i32 @printString(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%11 = tail call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%12 = call i32 @getString(i8* %2, i32 100)
%13 = load i8, i8* %2
%14 = add i8 %13, -48
%15 = icmp ult i8 %14, 10
br i1 %15, label %23, label %16
16: ; preds = %0
%17 = add i8 %13, -65
%18 = icmp ult i8 %17, 6
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = add nsw i8 %13, -55
br label %23
21: ; preds = %16
%22 = call i32 @printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %23
23: ; preds = %0, %19, %21
%24 = phi i8 [ %20, %19 ], [ 0, %21 ], [ %14, %0 ]
%25 = call i32 @printString(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%26 = call i32 @getString(i8* %2, i32 100)
%27 = load i8, i8* %2
%28 = zext i8 %27 to i32
%29 = add i8 %27, -48
%30 = icmp ult i8 %29, 10
br i1 %30, label %31, label %36
31: ; preds = %23
%32 = add nsw i32 %28, -48
%33 = trunc i32 %32 to i8
%34 = shl i8 %33, 4
%35 = add nuw i8 %34, %24
br label %46
36: ; preds = %23
%37 = add i8 %27, -65
%38 = icmp ult i8 %37, 6
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = add nsw i32 %28, -55
%41 = trunc i32 %40 to i8
%42 = shl i8 %41, 4
%43 = add nuw i8 %42, %24
br label %46
44: ; preds = %36
%45 = call i32 @printString(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %46
46: ; preds = %39, %44, %31
%47 = phi i32 [ %32, %31 ], [ %40, %39 ], [ 0, %44 ]
%48 = phi i8 [ %35, %31 ], [ %43, %39 ], [ %24, %44 ]
%49 = trunc i32 %47 to i8
%50 = icmp eq i8 %24, %49
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 @printString(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
%53 = call i32 @printString(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
br label %56
54: ; preds = %46
%55 = call i32 @change_color(i8 zeroext %48)
br label %56
56: ; preds = %54, %51
ret void
}