#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 /*<<< orphan*/ dumpByte(unsigned char);
int /*<<< orphan*/ printNewline();
int /*<<< orphan*/ printSpace();
void dumpReg(unsigned long *a) {
  unsigned long r = *a;
  int i;
  for (i = 3; i >= 0; i--) {
    unsigned char b = (r >> (i * 8)) & 0xFF;
    dumpByte(b);
    if (i != 0)
      printSpace();
  }
  printNewline();
}


x86 assembly (clang, -O0):
<dumpReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     119d <dumpReg+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
shr    %cl,%rax
and    $0xff,%rax
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%edi
call   1030 <dumpByte@plt>
cmpl   $0x0,-0x14(%rbp)
je     118a <dumpReg+0x5a>
mov    $0x0,%al
call   1050 <printSpace@plt>
jmp    118f <dumpReg+0x5f>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114e <dumpReg+0x1e>
mov    $0x0,%al
call   1040 <printNewline@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpReg>:
push   %rbx
mov    (%rdi),%ebx
mov    %ebx,%eax
shr    $0x18,%eax
mov    %eax,%edi
call   1030 <dumpByte@plt>
xor    %eax,%eax
call   1050 <printSpace@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%edi
call   1030 <dumpByte@plt>
xor    %eax,%eax
call   1050 <printSpace@plt>
movzbl %bh,%edi
call   1030 <dumpByte@plt>
xor    %eax,%eax
call   1050 <printSpace@plt>
movzbl %bl,%edi
call   1030 <dumpByte@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <printNewline@plt>

LLVM IR (-O0):
define void @dumpReg(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i8
store i64* %0, i64** %2
%6 = load i64*, i64** %2
%7 = load i64, i64* %6
store i64 %7, i64* %3
store i32 3, i32* %4
br label %8
8: ; preds = %26, %1
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i64, i64* %3
%13 = load i32, i32* %4
%14 = mul nsw i32 %13, 8
%15 = zext i32 %14 to i64
%16 = lshr i64 %12, %15
%17 = and i64 %16, 255
%18 = trunc i64 %17 to i8
store i8 %18, i8* %5
%19 = load i8, i8* %5
%20 = call i32 @dumpByte(i8 zeroext %19)
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %11
%24 = call i32 (...) @printSpace()
br label %25
25: ; preds = %23, %11
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
%30 = call i32 (...) @printNewline()
ret void
}

LLVM IR (-O2):
define void @dumpReg(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = lshr i64 %2, 24
%4 = trunc i64 %3 to i8
%5 = tail call i32 @dumpByte(i8 zeroext %4)
%6 = tail call i32 (...) @printSpace()
%7 = lshr i64 %2, 16
%8 = trunc i64 %7 to i8
%9 = tail call i32 @dumpByte(i8 zeroext %8)
%10 = tail call i32 (...) @printSpace()
%11 = lshr i64 %2, 8
%12 = trunc i64 %11 to i8
%13 = tail call i32 @dumpByte(i8 zeroext %12)
%14 = tail call i32 (...) @printSpace()
%15 = trunc i64 %2 to i8
%16 = tail call i32 @dumpByte(i8 zeroext %15)
%17 = tail call i32 (...) @printNewline()
ret void
}