#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 u_int;
typedef int u_char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
void wep_nkeyprint(u_char *key, u_int nbytes) {
  int i;
  char sepchar;
  for (i = 0; i < nbytes; i++) {
    sepchar = (i == nbytes - 1) ? '\n' : ':';
    printf("%02x%c", key[i], sepchar);
  }
}


x86 assembly (clang, -O0):
<wep_nkeyprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1176 <wep_nkeyprint+0x66>
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x3a,%eax
mov    $0xa,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea1(%rip),%rdi
movsbl -0x11(%rbp),%edx
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <wep_nkeyprint+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wep_nkeyprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1160 <wep_nkeyprint+0x50>
mov    %rdi,%r15
lea    -0x1(%rsi),%r12d
mov    %esi,%r13d
xor    %ebx,%ebx
mov    $0xa,%ebp
lea    0xec9(%rip),%r14
nopw   0x0(%rax,%rax,1)
cmp    %rbx,%r12
mov    (%r15,%rbx,4),%esi
mov    $0x3a,%edx
cmove  %ebp,%edx
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1140 <wep_nkeyprint+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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