#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 */
typedef int uint32_t;

/* Variables and functions */
void print_word_hex(uint32_t *c) {
  int i;
  uint32_t a;
  for (i = 0x7; i >= 0x0; i--) {
    a = *c & (0xf << (i * 0x4));
    a >>= (i * 0x4);
    if (a <= 9)
      (*((volatile uint32_t *)((volatile uint32_t *const)0x101f1000)) =
           (volatile uint32_t)((uint32_t)(a + (uint32_t)'0')));
    else if (a <= 0xf)
      (*((volatile uint32_t *)((volatile uint32_t *const)0x101f1000)) =
           (volatile uint32_t)((uint32_t)((a - 0xa) + (uint32_t)'a')));
    else
      (*((volatile uint32_t *)((volatile uint32_t *const)0x101f1000)) =
           (volatile uint32_t)((uint32_t)('?')));
  }
}


x86 assembly (clang, -O0):
<print_word_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     119f <print_word_hex+0x9f>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
mov    $0xf,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jg     115d <print_word_hex+0x5d>
mov    -0x10(%rbp),%ecx
add    $0x30,%ecx
mov    $0x101f1000,%eax
mov    %ecx,(%rax)
jmp    118c <print_word_hex+0x8c>
cmpl   $0xf,-0x10(%rbp)
jg     117c <print_word_hex+0x7c>
mov    -0x10(%rbp),%ecx
sub    $0xa,%ecx
add    $0x61,%ecx
mov    $0x101f1000,%eax
mov    %ecx,(%rax)
jmp    1187 <print_word_hex+0x87>
mov    $0x101f1000,%eax
movl   $0x3f,(%rax)
jmp    118c <print_word_hex+0x8c>
jmp    1191 <print_word_hex+0x91>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <print_word_hex+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_word_hex>:
mov    (%rdi),%eax
sar    $0x1c,%eax
add    $0x30,%eax
mov    %eax,0x101f1000
movzbl 0x3(%rdi),%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
mov    (%rdi),%eax
shr    $0x14,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
movzwl 0x2(%rdi),%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
mov    (%rdi),%eax
shr    $0xc,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
mov    (%rdi),%eax
shr    $0x8,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
mov    (%rdi),%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
mov    (%rdi),%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x57(%rax),%edx
cmp    $0xa,%eax
cmovb  %ecx,%edx
mov    %edx,0x101f1000
ret

LLVM IR (-O0):
define void @print_word_hex(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 7, i32* %3
br label %5
5: ; preds = %34, %1
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %37
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %9
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 4
%13 = shl i32 15, %12
%14 = and i32 %10, %13
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = mul nsw i32 %15, 4
%17 = load i32, i32* %4
%18 = ashr i32 %17, %16
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp sle i32 %19, 9
br i1 %20, label %21, label %24
21: ; preds = %8
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 48
store volatile i32 %23, i32* inttoptr (i64 270471168 to i32*)
br label %33
24: ; preds = %8
%25 = load i32, i32* %4
%26 = icmp sle i32 %25, 15
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 10
%30 = add nsw i32 %29, 97
store volatile i32 %30, i32* inttoptr (i64 270471168 to i32*)
br label %32
31: ; preds = %24
store volatile i32 63, i32* inttoptr (i64 270471168 to i32*)
br label %32
32: ; preds = %31, %27
br label %33
33: ; preds = %32, %21
br label %34
34: ; preds = %33
%35 = load i32, i32* %3
%36 = add nsw i32 %35, -1
store i32 %36, i32* %3
br label %5
37: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @print_word_hex(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = ashr i32 %2, 28
%4 = add nsw i32 %3, 48
store volatile i32 %4, i32* inttoptr (i64 270471168 to i32*)
%5 = load i32, i32* %0
%6 = lshr i32 %5, 24
%7 = and i32 %6, 15
%8 = icmp ult i32 %7, 10
%9 = or i32 %7, 48
%10 = add nuw nsw i32 %7, 87
%11 = select i1 %8, i32 %9, i32 %10
store volatile i32 %11, i32* inttoptr (i64 270471168 to i32*)
%12 = load i32, i32* %0
%13 = lshr i32 %12, 20
%14 = and i32 %13, 15
%15 = icmp ult i32 %14, 10
%16 = or i32 %14, 48
%17 = add nuw nsw i32 %14, 87
%18 = select i1 %15, i32 %16, i32 %17
store volatile i32 %18, i32* inttoptr (i64 270471168 to i32*)
%19 = load i32, i32* %0
%20 = lshr i32 %19, 16
%21 = and i32 %20, 15
%22 = icmp ult i32 %21, 10
%23 = or i32 %21, 48
%24 = add nuw nsw i32 %21, 87
%25 = select i1 %22, i32 %23, i32 %24
store volatile i32 %25, i32* inttoptr (i64 270471168 to i32*)
%26 = load i32, i32* %0
%27 = lshr i32 %26, 12
%28 = and i32 %27, 15
%29 = icmp ult i32 %28, 10
%30 = or i32 %28, 48
%31 = add nuw nsw i32 %28, 87
%32 = select i1 %29, i32 %30, i32 %31
store volatile i32 %32, i32* inttoptr (i64 270471168 to i32*)
%33 = load i32, i32* %0
%34 = lshr i32 %33, 8
%35 = and i32 %34, 15
%36 = icmp ult i32 %35, 10
%37 = or i32 %35, 48
%38 = add nuw nsw i32 %35, 87
%39 = select i1 %36, i32 %37, i32 %38
store volatile i32 %39, i32* inttoptr (i64 270471168 to i32*)
%40 = load i32, i32* %0
%41 = lshr i32 %40, 4
%42 = and i32 %41, 15
%43 = icmp ult i32 %42, 10
%44 = or i32 %42, 48
%45 = add nuw nsw i32 %42, 87
%46 = select i1 %43, i32 %44, i32 %45
store volatile i32 %46, i32* inttoptr (i64 270471168 to i32*)
%47 = load i32, i32* %0
%48 = and i32 %47, 15
%49 = icmp ult i32 %48, 10
%50 = or i32 %48, 48
%51 = add nuw nsw i32 %48, 87
%52 = select i1 %49, i32 %50, i32 %51
store volatile i32 %52, i32* inttoptr (i64 270471168 to i32*)
ret void
}