#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 i;
  char sepchar;
  for (i = 0; i < (5 * 4); i++) {
    sepchar = (i % 5 == 5 - 1) ? '\n' : ':';
    printf("%02x%c", keys[i], sepchar);
  }
  return;
}


x86 assembly (clang, -O0):
<wep_keyprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    1174 <wep_keyprint+0x64>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    $0x3a,%eax
mov    $0xa,%ecx
cmp    $0x4,%edx
cmove  %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xea3(%rip),%rdi
movsbl -0xd(%rbp),%edx
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <wep_keyprint+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wep_keyprint>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
mov    $0x4,%bpl
xor    %ebx,%ebx
lea    0xeda(%rip),%r14
jmp    114a <wep_keyprint+0x3a>
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0xff,%bpl
cmp    $0x14,%rbx
je     116a <wep_keyprint+0x5a>
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%eax
mov    $0xa,%edx
add    %bpl,%al
je     1130 <wep_keyprint+0x20>
mov    $0x3a,%edx
jmp    1130 <wep_keyprint+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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