#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 uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ debug_puthex(int);
int /*<<< orphan*/ debug_puts(char *);
void print_addr(const uint8_t *addr) {
  for (int i = 0; i < 16; i += 2) {
    uint16_t a = (addr[i] << 8) | addr[i + 1];
    debug_puthex(a);
    if (i < 14)
      debug_puts(":");
  }
}


x86 assembly (clang, -O0):
<print_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    118f <print_addr+0x6f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
or     (%rcx,%rdx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1040 <debug_puthex@plt>
cmpl   $0xe,-0xc(%rbp)
jge    117c <print_addr+0x5c>
lea    0xe89(%rip),%rdi
call   1030 <debug_puts@plt>
jmp    1181 <print_addr+0x61>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_addr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_addr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
shl    $0x8,%edi
or     0x4(%rbx),%edi
call   1040 <debug_puthex@plt>
lea    0xec5(%rip),%r14
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x8(%rbx),%edi
shl    $0x8,%edi
or     0xc(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x10(%rbx),%edi
shl    $0x8,%edi
or     0x14(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x18(%rbx),%edi
shl    $0x8,%edi
or     0x1c(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x20(%rbx),%edi
shl    $0x8,%edi
or     0x24(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x28(%rbx),%edi
shl    $0x8,%edi
or     0x2c(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x30(%rbx),%edi
shl    $0x8,%edi
or     0x34(%rbx),%edi
call   1040 <debug_puthex@plt>
mov    %r14,%rdi
call   1030 <debug_puts@plt>
mov    0x38(%rbx),%edi
shl    $0x8,%edi
or     0x3c(%rbx),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <debug_puthex@plt>

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define void @print_addr(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 16
br i1 %7, label %8, label %32
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = shl i32 %13, 8
%15 = load i32*, i32** %2
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %15, i64 %18
%20 = load i32, i32* %19
%21 = or i32 %14, %20
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = call i32 @debug_puthex(i32 %22)
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 14
br i1 %25, label %26, label %28
26: ; preds = %8
%27 = call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %28
28: ; preds = %26, %8
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 2
store i32 %31, i32* %3
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
define void @print_addr(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
%7 = tail call i32 @debug_puthex(i32 %6)
%8 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = getelementptr inbounds i32, i32* %0, i64 3
%13 = load i32, i32* %12
%14 = or i32 %11, %13
%15 = tail call i32 @debug_puthex(i32 %14)
%16 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = getelementptr inbounds i32, i32* %0, i64 4
%18 = load i32, i32* %17
%19 = shl i32 %18, 8
%20 = getelementptr inbounds i32, i32* %0, i64 5
%21 = load i32, i32* %20
%22 = or i32 %19, %21
%23 = tail call i32 @debug_puthex(i32 %22)
%24 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds i32, i32* %0, i64 6
%26 = load i32, i32* %25
%27 = shl i32 %26, 8
%28 = getelementptr inbounds i32, i32* %0, i64 7
%29 = load i32, i32* %28
%30 = or i32 %27, %29
%31 = tail call i32 @debug_puthex(i32 %30)
%32 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%33 = getelementptr inbounds i32, i32* %0, i64 8
%34 = load i32, i32* %33
%35 = shl i32 %34, 8
%36 = getelementptr inbounds i32, i32* %0, i64 9
%37 = load i32, i32* %36
%38 = or i32 %35, %37
%39 = tail call i32 @debug_puthex(i32 %38)
%40 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%41 = getelementptr inbounds i32, i32* %0, i64 10
%42 = load i32, i32* %41
%43 = shl i32 %42, 8
%44 = getelementptr inbounds i32, i32* %0, i64 11
%45 = load i32, i32* %44
%46 = or i32 %43, %45
%47 = tail call i32 @debug_puthex(i32 %46)
%48 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%49 = getelementptr inbounds i32, i32* %0, i64 12
%50 = load i32, i32* %49
%51 = shl i32 %50, 8
%52 = getelementptr inbounds i32, i32* %0, i64 13
%53 = load i32, i32* %52
%54 = or i32 %51, %53
%55 = tail call i32 @debug_puthex(i32 %54)
%56 = tail call i32 @debug_puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%57 = getelementptr inbounds i32, i32* %0, i64 14
%58 = load i32, i32* %57
%59 = shl i32 %58, 8
%60 = getelementptr inbounds i32, i32* %0, i64 15
%61 = load i32, i32* %60
%62 = or i32 %59, %61
%63 = tail call i32 @debug_puthex(i32 %62)
ret void
}