#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 *, ...);
void clc_print_key_base(const unsigned char *key, const short size) {
  short i;
  for (i = 0; i < size; ++i) {
    printf("%x ", key[i]);
    if (i > 0 && i % 16 == 0)
      printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<clc_print_key_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movw   $0x0,-0xc(%rbp)
movswl -0xc(%rbp),%eax
movswl -0xa(%rbp),%ecx
cmp    %ecx,%eax
jge    119a <clc_print_key_base+0x8a>
mov    -0x8(%rbp),%rax
movswq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movswl -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    1184 <clc_print_key_base+0x74>
movswl -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1184 <clc_print_key_base+0x74>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <clc_print_key_base+0x79>
mov    -0xc(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0xc(%rbp)
jmp    1129 <clc_print_key_base+0x19>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clc_print_key_base>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %si,%si
jle    1173 <clc_print_key_base+0x53>
mov    %rdi,%r15
movzwl %si,%r12d
lea    0xec5(%rip),%r14
xor    %ebx,%ebx
jmp    1149 <clc_print_key_base+0x29>
nop
add    $0x1,%rbx
cmp    %rbx,%r12
je     1173 <clc_print_key_base+0x53>
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbx,%rbx
je     1140 <clc_print_key_base+0x20>
mov    %ebx,%eax
and    $0xf,%eax
test   %rax,%rax
jne    1140 <clc_print_key_base+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1140 <clc_print_key_base+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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