#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*/ printf(char *, ...);
unsigned long rd_word(unsigned long *);
void display_full(unsigned long start, unsigned long endaddr) {
  unsigned long v;
  unsigned long loop;
  for (; (start < endaddr); start += sizeof(unsigned long)) {
    printf("%06lX : ", start);
    v = rd_word((unsigned long *)start);
    printf("%08lX : ", v);
    for (loop = 0; (loop < sizeof(int)); loop++) {
      unsigned long r = ((v & (0xFFL << (loop * 8))) >> (loop * 8));
      printf("%c", ((r >= 0x20) && (r <= 0x7E)) ? (char)r : '.');
    }
    printf(" : ");
    for (loop = 0; (loop < (sizeof(int) * 8)); loop++)
      printf(
          "%c",
          (((v & (1L << ((sizeof(int) * 8L) - (loop + 1)))) == 0) ? '0' : '1'));
    printf("\n");
  }
  return;
}


x86 assembly (clang, -O0):
<display_full>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1296 <display_full+0x176>
mov    -0x8(%rbp),%rsi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <rd_word@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
jae    11ff <display_full+0xdf>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x3,%rcx
mov    $0xff,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
mov    -0x20(%rbp),%rcx
shl    $0x3,%rcx
shr    %cl,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x20,-0x28(%rbp)
jb     11d0 <display_full+0xb0>
cmpq   $0x7e,-0x28(%rbp)
ja     11d0 <display_full+0xb0>
mov    -0x28(%rbp),%rax
movsbl %al,%eax
mov    %eax,-0x2c(%rbp)
jmp    11dd <display_full+0xbd>
mov    $0x2e,%eax
mov    %eax,-0x2c(%rbp)
jmp    11dd <display_full+0xbd>
mov    -0x2c(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1177 <display_full+0x57>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x20(%rbp)
cmpq   $0x20,-0x20(%rbp)
jae    1277 <display_full+0x157>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    $0x20,%ecx
sub    %rax,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    -0x38(%rbp),%rcx
and    %rax,%rcx
mov    $0x31,%esi
mov    $0x30,%eax
cmp    $0x0,%rcx
cmove  %eax,%esi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1215 <display_full+0xf5>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1130 <display_full+0x10>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_full>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %rsi,%rdi
jae    123e <display_full+0x10e>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2e,%r15d
lea    0xeae(%rip),%r13
nopw   0x0(%rax,%rax,1)
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <rd_word@plt>
mov    %rax,%rbp
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl %bpl,%eax
add    $0xffffffffffffffe0,%rax
cmp    $0x5f,%rax
movsbl %bpl,%edi
cmovae %r15d,%edi
call   1030 <putchar@plt>
mov    %rbp,%rax
shr    $0x8,%rax
movzbl %al,%ecx
add    $0xffffffffffffffe0,%rcx
cmp    $0x5f,%rcx
movsbl %al,%edi
cmovae %r15d,%edi
call   1030 <putchar@plt>
mov    %rbp,%rax
shr    $0x10,%rax
movzbl %al,%ecx
add    $0xffffffffffffffe0,%rcx
cmp    $0x5f,%rcx
movsbl %al,%edi
cmovae %r15d,%edi
call   1030 <putchar@plt>
mov    %rbp,%rax
shr    $0x18,%rax
movzbl %al,%ecx
add    $0xffffffffffffffe0,%rcx
cmp    $0x5f,%rcx
movsbl %al,%edi
cmovae %r15d,%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1f,%r12d
bt     %r12,%rbp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%r12
jb     1210 <display_full+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rbx
cmp    %r14,%rbx
jb     1160 <display_full+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%06lX : \00"
@.str.1 = [9 x i8] c"%08lX : \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [4 x i8] c" : \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @display_full(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %8
8: ; preds = %69, %2
%9 = load i64, i64* %3
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %72
12: ; preds = %8
%13 = load i64, i64* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = load i64, i64* %3
%16 = inttoptr i64 %15 to i64*
%17 = call i64 @rd_word(i64* %16)
store i64 %17, i64* %5
%18 = load i64, i64* %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %18)
store i64 0, i64* %6
br label %20
20: ; preds = %45, %12
%21 = load i64, i64* %6
%22 = icmp ult i64 %21, 4
br i1 %22, label %23, label %48
23: ; preds = %20
%24 = load i64, i64* %5
%25 = load i64, i64* %6
%26 = mul i64 %25, 8
%27 = shl i64 255, %26
%28 = and i64 %24, %27
%29 = load i64, i64* %6
%30 = mul i64 %29, 8
%31 = lshr i64 %28, %30
store i64 %31, i64* %7
%32 = load i64, i64* %7
%33 = icmp uge i64 %32, 32
br i1 %33, label %34, label %41
34: ; preds = %23
%35 = load i64, i64* %7
%36 = icmp ule i64 %35, 126
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i64, i64* %7
%39 = trunc i64 %38 to i8
%40 = sext i8 %39 to i32
br label %42
41: ; preds = %34, %23
br label %42
42: ; preds = %41, %37
%43 = phi i32 [ %40, %37 ], [ 46, %41 ]
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42
%46 = load i64, i64* %6
%47 = add i64 %46, 1
store i64 %47, i64* %6
br label %20
48: ; preds = %20
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i64 0, i64* %6
br label %50
50: ; preds = %64, %48
%51 = load i64, i64* %6
%52 = icmp ult i64 %51, 32
br i1 %52, label %53, label %67
53: ; preds = %50
%54 = load i64, i64* %5
%55 = load i64, i64* %6
%56 = add i64 %55, 1
%57 = sub i64 32, %56
%58 = shl i64 1, %57
%59 = and i64 %54, %58
%60 = icmp eq i64 %59, 0
%61 = zext i1 %60 to i64
%62 = select i1 %60, i32 48, i32 49
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %53
%65 = load i64, i64* %6
%66 = add i64 %65, 1
store i64 %66, i64* %6
br label %50
67: ; preds = %50
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i64, i64* %3
%71 = add i64 %70, 8
store i64 %71, i64* %3
br label %8
72: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%06lX : \00"
@.str.1 = [9 x i8] c"%08lX : \00"
@.str.3 = [4 x i8] c" : \00"
define void @display_full(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
br i1 %3, label %4, label %60
4: ; preds = %2, %56
%5 = phi i64 [ %58, %56 ], [ %0, %2 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = inttoptr i64 %5 to i64*
%8 = tail call i64 @rd_word(i64* %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %8)
%10 = and i64 %8, 255
%11 = add nsw i64 %10, -32
%12 = icmp ult i64 %11, 95
%13 = trunc i64 %8 to i32
%14 = shl i32 %13, 24
%15 = ashr exact i32 %14, 24
%16 = select i1 %12, i32 %15, i32 46
%17 = tail call i32 @putchar(i32 %16)
%18 = lshr i64 %8, 8
%19 = and i64 %18, 255
%20 = add nsw i64 %19, -32
%21 = icmp ult i64 %20, 95
%22 = trunc i64 %18 to i32
%23 = shl i32 %22, 24
%24 = ashr exact i32 %23, 24
%25 = select i1 %21, i32 %24, i32 46
%26 = tail call i32 @putchar(i32 %25)
%27 = lshr i64 %8, 16
%28 = and i64 %27, 255
%29 = add nsw i64 %28, -32
%30 = icmp ult i64 %29, 95
%31 = trunc i64 %27 to i32
%32 = shl i32 %31, 24
%33 = ashr exact i32 %32, 24
%34 = select i1 %30, i32 %33, i32 46
%35 = tail call i32 @putchar(i32 %34)
%36 = lshr i64 %8, 24
%37 = and i64 %36, 255
%38 = add nsw i64 %37, -32
%39 = icmp ult i64 %38, 95
%40 = trunc i64 %36 to i32
%41 = shl i32 %40, 24
%42 = ashr exact i32 %41, 24
%43 = select i1 %39, i32 %42, i32 46
%44 = tail call i32 @putchar(i32 %43)
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %4, %46
%47 = phi i64 [ 0, %4 ], [ %48, %46 ]
%48 = add nuw nsw i64 %47, 1
%49 = sub nuw nsw i64 31, %47
%50 = shl nuw nsw i64 1, %49
%51 = and i64 %50, %8
%52 = icmp eq i64 %51, 0
%53 = select i1 %52, i32 48, i32 49
%54 = tail call i32 @putchar(i32 %53)
%55 = icmp eq i64 %48, 32
br i1 %55, label %56, label %46
56: ; preds = %46
%57 = tail call i32 @putchar(i32 10)
%58 = add i64 %5, 8
%59 = icmp ult i64 %58, %1
br i1 %59, label %4, label %60
60: ; preds = %56, %2
ret void
}