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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void pretty_print_key(uint8_t *tag, size_t size) {
  size_t index;
  for (index = 0; index < size - 1; ++index) {
    printf("%02x", tag[index]);
    if ((index + 1) % 4 == 0) {
      printf(" ");
    }
  }
  printf("%02x\n", tag[size - 1]);
}


x86 assembly (clang, -O0):
<pretty_print_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    1190 <pretty_print_key+0x80>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
and    $0x3,%rax
cmp    $0x0,%rax
jne    117a <pretty_print_key+0x6a>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117f <pretty_print_key+0x6f>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <pretty_print_key+0x18>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pretty_print_key>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
cmp    $0x1,%rsi
je     1179 <pretty_print_key+0x59>
mov    $0x1,%ebx
lea    0xec0(%rip),%r15
jmp    1159 <pretty_print_key+0x39>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1179 <pretty_print_key+0x59>
mov    -0x4(%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x3,%bl
jne    1150 <pretty_print_key+0x30>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <pretty_print_key+0x30>
mov    -0x4(%r14,%r12,4),%esi
lea    0xe80(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
@.str.2 = [6 x i8] c"%02x\0A\00"
define void @pretty_print_key(i32* nocapture %0, i64 %1) {
%3 = add i64 %1, -1
%4 = icmp eq i64 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %15
%6 = phi i64 [ %10, %15 ], [ 0, %2 ]
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw i64 %6, 1
%11 = and i64 %10, 3
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = tail call i32 @putchar(i32 32)
br label %15
15: ; preds = %5, %13
%16 = icmp eq i64 %10, %3
br i1 %16, label %17, label %5
17: ; preds = %15, %2
%18 = getelementptr inbounds i32, i32* %0, i64 %3
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret void
}