#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 size_t greg_t;

/* Variables and functions */
size_t const CHAR_BIT;
int /*<<< orphan*/ eiki_hex_char(size_t);
int /*<<< orphan*/ eiki_print_c(int /*<<< orphan*/);
void eiki_print_greg(greg_t reg) {
  const size_t bytes = sizeof(greg_t);
  const size_t bits = bytes * CHAR_BIT;
  size_t shift = ((bits - 1) / 4) * 4;
  for (; shift; shift -= 4) {
    eiki_print_c(eiki_hex_char(reg >> shift));
  }
  eiki_print_c(eiki_hex_char(reg));
}


x86 assembly (clang, -O0):
<eiki_print_greg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x8,-0x10(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
shr    $0x2,%rax
shl    $0x2,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118d <eiki_print_greg+0x6d>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rcx
shr    %cl,%rdi
call   1040 <eiki_hex_char@plt>
mov    %eax,%edi
call   1030 <eiki_print_c@plt>
mov    -0x20(%rbp),%rax
sub    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    115a <eiki_print_greg+0x3a>
mov    -0x8(%rbp),%rdi
call   1040 <eiki_hex_char@plt>
mov    %eax,%edi
call   1030 <eiki_print_c@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_print_greg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xfffffffffffffffc,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%ecx
shr    %cl,%rdi
call   1040 <eiki_hex_char@plt>
mov    %eax,%edi
call   1030 <eiki_print_c@plt>
add    $0xfffffffffffffffc,%rbx
jne    1130 <eiki_print_greg+0x10>
mov    %r14,%rdi
call   1040 <eiki_hex_char@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <eiki_print_c@plt>

LLVM IR (-O0):
@CHAR_BIT = constant i64 0
define void @eiki_print_greg(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
store i64 8, i64* %3
%6 = load i64, i64* @CHAR_BIT
%7 = mul i64 8, %6
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = sub i64 %8, 1
%10 = udiv i64 %9, 4
%11 = mul i64 %10, 4
store i64 %11, i64* %5
br label %12
12: ; preds = %21, %1
%13 = load i64, i64* %5
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = load i64, i64* %2
%17 = load i64, i64* %5
%18 = lshr i64 %16, %17
%19 = call i32 @eiki_hex_char(i64 %18)
%20 = call i32 @eiki_print_c(i32 %19)
br label %21
21: ; preds = %15
%22 = load i64, i64* %5
%23 = sub i64 %22, 4
store i64 %23, i64* %5
br label %12
24: ; preds = %12
%25 = load i64, i64* %2
%26 = call i32 @eiki_hex_char(i64 %25)
%27 = call i32 @eiki_print_c(i32 %26)
ret void
}

LLVM IR (-O2):
@CHAR_BIT = constant i64 0
define void @eiki_print_greg(i64 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ -4, %1 ], [ %7, %2 ]
%4 = lshr i64 %0, %3
%5 = tail call i32 @eiki_hex_char(i64 %4)
%6 = tail call i32 @eiki_print_c(i32 %5)
%7 = add i64 %3, -4
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %2
9: ; preds = %2
%10 = tail call i32 @eiki_hex_char(i64 %0)
%11 = tail call i32 @eiki_print_c(i32 %10)
ret void
}