#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 main() {
  char car1;
  char car2;
  int devolucion;
  while (!(car1 == 'q' && car2 == 'q')) {
    printf("Introduzca dos carácteres hexadecimales:");
    scanf("\n%c%c", &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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x71,%ecx
mov    %al,-0xd(%rbp)
jne    115e <main+0x2e>
movsbl -0x6(%rbp),%eax
cmp    $0x71,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1170 <main+0x40>
jmp    11cc <main+0x9c>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
lea    -0x5(%rbp),%rsi
lea    -0x6(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1040 <convHex@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     11c7 <main+0x97>
movsbl -0x5(%rbp),%esi
movsbl -0x6(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x10,%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
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
%6 = load i8, i8* %2
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 113
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 113
br label %13
13: ; preds = %9, %5
%14 = phi i1 [ false, %5 ], [ %12, %9 ]
%15 = xor i1 %14, true
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %3)
%19 = load i8, i8* %2
%20 = load i8, i8* %3
%21 = call i32 @convHex(i8 signext %19, i8 signext %20)
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, -1
br i1 %23, label %24, label %31
24: ; preds = %16
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
%29 = load i32, i32* %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %28, i32 %29)
br label %31
31: ; preds = %24, %16
br label %5
32: ; preds = %13
ret i32 0
}

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