#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 */
size_t const CHAR_BIT;
int /*<<< orphan*/ eiki_hex_char(size_t);
int /*<<< orphan*/ eiki_print_c(int /*<<< orphan*/);
int /*<<< orphan*/ eiki_print_s(char *);
void eiki_print_p(const void *ptr) {
  const size_t bytes = sizeof(void *);
  const size_t bits = bytes * CHAR_BIT;
  size_t shift = ((bits - 1) / 4) * 4;
  size_t p;
  typedef int
      static_assertion_failed_10[(!!(sizeof(size_t) == sizeof(void *))) * 2 -
                                 1];
  eiki_print_s("0x");
  p = (size_t)ptr;
  for (; shift; shift -= 4) {
    eiki_print_c(eiki_hex_char(p >> shift));
  }
  eiki_print_c(eiki_hex_char(p));
}


x86 assembly (clang, -O0):
<eiki_print_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x8,-0x10(%rbp)
mov    0x2e95(%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)
lea    0xe97(%rip),%rdi
call   1030 <eiki_print_s@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11b1 <eiki_print_p+0x81>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rcx
shr    %cl,%rdi
call   1050 <eiki_hex_char@plt>
mov    %eax,%edi
call   1040 <eiki_print_c@plt>
mov    -0x20(%rbp),%rax
sub    $0x4,%rax
mov    %rax,-0x20(%rbp)
jmp    117e <eiki_print_p+0x4e>
mov    -0x28(%rbp),%rdi
call   1050 <eiki_hex_char@plt>
mov    %eax,%edi
call   1040 <eiki_print_c@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_print_p>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xeca(%rip),%rdi
call   1030 <eiki_print_s@plt>
mov    $0xfffffffffffffffc,%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%ecx
shr    %cl,%rdi
call   1050 <eiki_hex_char@plt>
mov    %eax,%edi
call   1040 <eiki_print_c@plt>
add    $0xfffffffffffffffc,%rbx
jne    1150 <eiki_print_p+0x20>
mov    %r14,%rdi
call   1050 <eiki_hex_char@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <eiki_print_c@plt>

LLVM IR (-O0):
@CHAR_BIT = constant i64 0
@.str = [3 x i8] c"0x\00"
define void @eiki_print_p(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %2
store i64 8, i64* %3
%7 = load i64, i64* @CHAR_BIT
%8 = mul i64 8, %7
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = udiv i64 %10, 4
%12 = mul i64 %11, 4
store i64 %12, i64* %5
%13 = call i32 @eiki_print_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %2
%15 = ptrtoint i8* %14 to i64
store i64 %15, i64* %6
br label %16
16: ; preds = %25, %1
%17 = load i64, i64* %5
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i64, i64* %6
%21 = load i64, i64* %5
%22 = lshr i64 %20, %21
%23 = call i32 @eiki_hex_char(i64 %22)
%24 = call i32 @eiki_print_c(i32 %23)
br label %25
25: ; preds = %19
%26 = load i64, i64* %5
%27 = sub i64 %26, 4
store i64 %27, i64* %5
br label %16
28: ; preds = %16
%29 = load i64, i64* %6
%30 = call i32 @eiki_hex_char(i64 %29)
%31 = call i32 @eiki_print_c(i32 %30)
ret void
}

LLVM IR (-O2):
@CHAR_BIT = constant i64 0
@.str = [3 x i8] c"0x\00"
define void @eiki_print_p(i8* %0) {
%2 = tail call i32 @eiki_print_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = ptrtoint i8* %0 to i64
br label %4
4: ; preds = %1, %4
%5 = phi i64 [ -4, %1 ], [ %9, %4 ]
%6 = lshr i64 %3, %5
%7 = tail call i32 @eiki_hex_char(i64 %6)
%8 = tail call i32 @eiki_print_c(i32 %7)
%9 = add i64 %5, -4
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = tail call i32 @eiki_hex_char(i64 %3)
%13 = tail call i32 @eiki_print_c(i32 %12)
ret void
}