#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 EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main(int argc, char **argv) {
  int c;
  c = getchar();
  while (c != EOF) {
    putchar((((0xF0 & c) >> 4) < 10 ? ('0' + ((0xF0 & c) >> 4))
                                    : (('A' - 10) + ((0xF0 & c) >> 4))));
    putchar(((0x0F & c) < 10 ? ('0' + (0x0F & c)) : (('A' - 10) + (0x0F & c))));
    c = getchar();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
je     11d8 <main+0xb8>
mov    -0x14(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
cmp    $0xa,%eax
jge    117c <main+0x5c>
mov    -0x14(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
add    $0x30,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <main+0x6d>
mov    -0x14(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
add    $0x37,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
cmp    $0xa,%eax
jge    11b5 <main+0x95>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
add    $0x30,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c1 <main+0xa1>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
add    $0x37,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <putchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
je     117b <main+0x5b>
mov    %eax,%ebx
nopl   0x0(%rax)
mov    %ebx,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%edi
cmp    $0xa,%eax
cmovb  %ecx,%edi
call   1030 <putchar@plt>
and    $0xf,%ebx
lea    0x30(%rbx),%eax
lea    0x37(%rbx),%edi
cmp    $0xa,%ebx
cmovb  %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @getchar()
store i32 %7, i32* %6
br label %8
8: ; preds = %41, %2
%9 = load i32, i32* %6
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %45
12: ; preds = %8
%13 = load i32, i32* %6
%14 = and i32 240, %13
%15 = ashr i32 %14, 4
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* %6
%19 = and i32 240, %18
%20 = ashr i32 %19, 4
%21 = add nsw i32 48, %20
br label %27
22: ; preds = %12
%23 = load i32, i32* %6
%24 = and i32 240, %23
%25 = ashr i32 %24, 4
%26 = add nsw i32 55, %25
br label %27
27: ; preds = %22, %17
%28 = phi i32 [ %21, %17 ], [ %26, %22 ]
%29 = call i32 @putchar(i32 %28)
%30 = load i32, i32* %6
%31 = and i32 15, %30
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %37
33: ; preds = %27
%34 = load i32, i32* %6
%35 = and i32 15, %34
%36 = add nsw i32 48, %35
br label %41
37: ; preds = %27
%38 = load i32, i32* %6
%39 = and i32 15, %38
%40 = add nsw i32 55, %39
br label %41
41: ; preds = %37, %33
%42 = phi i32 [ %36, %33 ], [ %40, %37 ]
%43 = call i32 @putchar(i32 %42)
%44 = call i32 (...) @getchar()
store i32 %44, i32* %6
br label %8
45: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %24, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %21, %6 ], [ %3, %2 ]
%8 = lshr i32 %7, 4
%9 = and i32 %8, 15
%10 = icmp ult i32 %9, 10
%11 = or i32 %9, 48
%12 = add nuw nsw i32 %9, 55
%13 = select i1 %10, i32 %11, i32 %12
%14 = tail call i32 @putchar(i32 %13)
%15 = and i32 %7, 15
%16 = icmp ult i32 %15, 10
%17 = or i32 %15, 48
%18 = add nuw nsw i32 %15, 55
%19 = select i1 %16, i32 %17, i32 %18
%20 = tail call i32 @putchar(i32 %19)
%21 = tail call i32 (...) @getchar()
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %6
24: ; preds = %6, %2
ret i32 0
}