#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 */
char EE_bluetooth_receive();
int /*<<< orphan*/ printf(char *, char);
void printall() {
  char c;
  for (;;) {
    c = EE_bluetooth_receive();
    if ((c <= 'Z' && c >= 'A') || (c <= '9' && c >= '1'))
      printf("%c\n", c);
    else
      printf("0x%X\n", c);
  }
}


x86 assembly (clang, -O0):
<printall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EE_bluetooth_receive@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     114c <printall+0x2c>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jge    1166 <printall+0x46>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     117b <printall+0x5b>
movsbl -0x1(%rbp),%eax
cmp    $0x31,%eax
jl     117b <printall+0x5b>
lea    0xe93(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    118b <printall+0x6b>
lea    0xe82(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    1128 <printall+0x8>

x86 assembly (clang, -O2):
<printall>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xed2(%rip),%r14
jmp    1152 <printall+0x32>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x41(%rax),%ecx
cmp    $0x1a,%cl
cmovb  %rbx,%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <EE_bluetooth_receive@plt>
lea    -0x31(%rax),%ecx
mov    %rbx,%rdi
cmp    $0x9,%cl
jb     1140 <printall+0x20>
mov    %r14,%rdi
jmp    1140 <printall+0x20>

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [6 x i8] c"0x%X\0A\00"
define void @printall() {
%1 = alloca i8
br label %2
2: ; preds = %25, %0
%3 = call signext i8 (...) @EE_bluetooth_receive()
store i8 %3, i8* %1
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp sle i32 %5, 90
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 65
br i1 %10, label %19, label %11
11: ; preds = %7, %2
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 57
br i1 %14, label %15, label %22
15: ; preds = %11
%16 = load i8, i8* %1
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 49
br i1 %18, label %19, label %22
19: ; preds = %15, %7
%20 = load i8, i8* %1
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %20)
br label %25
22: ; preds = %15, %11
%23 = load i8, i8* %1
%24 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %23)
br label %25
25: ; preds = %22, %19
br label %2
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [6 x i8] c"0x%X\0A\00"
define void @printall() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @EE_bluetooth_receive()
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = add i8 %2, -49
%6 = icmp ult i8 %5, 9
%7 = or i1 %4, %6
%8 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%9 = tail call i32 @printf(i8* %8, i8 signext %2)
br label %1
}