#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 convHex(char, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *, char *);
int validos(char, char);
int main() {
  char car1;
  char car2;
  int devolucion;
  int valido;
  while (!(car1 == 'q' && car2 == 'q')) {
    printf("Introduzca dos carácteres hexadecimales:");
    scanf("\n%c%c", &car1, &car2);
    valido = validos(car1, car2);
    devolucion = convHex(car1, car2);
    if (devolucion != -1)
      printf("El valor decimal de 0x%c%c es %d\n", car1, car2, devolucion);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x71,%ecx
mov    %al,-0x11(%rbp)
jne    116e <main+0x2e>
movsbl -0x6(%rbp),%eax
cmp    $0x71,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1180 <main+0x40>
jmp    11ee <main+0xae>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1050 <validos@plt>
mov    %eax,-0x10(%rbp)
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1040 <convHex@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     11e9 <main+0xa9>
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Introduzca dos car\C3\A1cteres hexadecimales:\00"
@.str.1 = [6 x i8] c"\0A%c%c\00"
@.str.2 = [34 x i8] c"El valor decimal de 0x%c%c es %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %35, %0
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 113
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 113
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
%16 = xor i1 %15, true
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3)
%20 = load i8, i8* %2
%21 = load i8, i8* %3
%22 = call i32 @validos(i8 signext %20, i8 signext %21)
store i32 %22, i32* %5
%23 = load i8, i8* %2
%24 = load i8, i8* %3
%25 = call i32 @convHex(i8 signext %23, i8 signext %24)
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, -1
br i1 %27, label %28, label %35
28: ; preds = %17
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %32, i32 %33)
br label %35
35: ; preds = %28, %17
br label %6
36: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}