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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char);
void wep_keyprint(u_char *keys, int strong) {
  int i, printlength, keylength;
  char sepchar;
  printlength = strong ? 13 : (5 * 4);
  keylength = strong ? 13 : 5;
  for (i = 0; i < printlength; i++) {
    sepchar = (i % keylength == keylength - 1) ? '\n' : ':';
    printf("%02x%c", keys[i], sepchar);
  }
  return;
}


x86 assembly (clang, -O0):
<wep_keyprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x14,%eax
mov    $0xd,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x5,%eax
mov    $0xd,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a6 <wep_keyprint+0x96>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
mov    $0x3a,%eax
mov    $0xa,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe71(%rip),%rdi
movsbl -0x19(%rbp),%edx
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <wep_keyprint+0x42>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wep_keyprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
test   %esi,%esi
setne  %al
mov    $0x14,%ecx
mov    $0xd,%r12d
cmove  %rcx,%r12
lea    0x5(,%rax,8),%r13d
lea    0x4(,%rax,8),%ebp
xor    %ebx,%ebx
lea    0xeb4(%rip),%r15
jmp    1165 <wep_keyprint+0x55>
xchg   %ax,%ax
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
je     117e <wep_keyprint+0x6e>
mov    %ebx,%eax
xor    %edx,%edx
div    %r13d
mov    %edx,%eax
mov    $0xa,%edx
cmp    %ebp,%eax
je     1150 <wep_keyprint+0x40>
mov    $0x3a,%edx
jmp    1150 <wep_keyprint+0x40>
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_keyprint(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32* %0, i32** %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 13, i32 20
store i32 %12, i32* %6
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 13, i32 5
store i32 %16, i32* %7
store i32 0, i32* %5
br label %17
17: ; preds = %38, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %41
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = srem i32 %22, %23
%25 = load i32, i32* %7
%26 = sub nsw i32 %25, 1
%27 = icmp eq i32 %24, %26
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 10, i32 58
%30 = trunc i32 %29 to i8
store i8 %30, i8* %8
%31 = load i32*, i32** %3
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = load i8, i8* %8
%37 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %35, i8 signext %36)
br label %38
38: ; preds = %21
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %17
41: ; preds = %17
ret void
}

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