#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 rand();
void random_eui64(unsigned char *eui64) {
  int i;
  for (i = 0; i < 8; i++)
    eui64[i] = rand() & 0xFF;
  eui64[0] &= ~3;
}


x86 assembly (clang, -O0):
<random_eui64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1154 <random_eui64+0x44>
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <random_eui64+0x13>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
and    $0xfffffffc,%ecx
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_eui64>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x1(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x2(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x3(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x4(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x5(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x6(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x7(%rbx)
andb   $0xfc,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @random_eui64(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %15, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = call i32 (...) @rand()
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 %10, i8* %14
br label %15
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = and i32 %22, -4
%24 = trunc i32 %23 to i8
store i8 %24, i8* %20
ret void
}

LLVM IR (-O2):
define void @random_eui64(i8* nocapture %0) {
%2 = tail call i32 (...) @rand()
%3 = trunc i32 %2 to i8
store i8 %3, i8* %0
%4 = tail call i32 (...) @rand()
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = tail call i32 (...) @rand()
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = tail call i32 (...) @rand()
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
%13 = tail call i32 (...) @rand()
%14 = trunc i32 %13 to i8
%15 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %14, i8* %15
%16 = tail call i32 (...) @rand()
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %17, i8* %18
%19 = tail call i32 (...) @rand()
%20 = trunc i32 %19 to i8
%21 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %20, i8* %21
%22 = tail call i32 (...) @rand()
%23 = trunc i32 %22 to i8
%24 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %23, i8* %24
%25 = load i8, i8* %0
%26 = and i8 %25, -4
store i8 %26, i8* %0
ret void
}