#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 getpid();
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long, unsigned long,
                          unsigned long, unsigned long, unsigned long);
int random();
int /*<<< orphan*/ srandom(int);
int time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  unsigned long ethaddr_low, ethaddr_high;
  srandom(time(0) | getpid());
  ethaddr_high = (random() & 0xffff) | 0x0200;
  ethaddr_low = random();
  printf("%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\n", ethaddr_high >> 8,
         ethaddr_high & 0xff, ethaddr_low >> 24, (ethaddr_low >> 16) & 0xff,
         (ethaddr_low >> 8) & 0xff, ethaddr_low & 0xff);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x24(%rbp),%edi
or     %eax,%edi
call   1030 <srandom@plt>
mov    $0x0,%al
call   1070 <random@plt>
and    $0xffff,%eax
or     $0x200,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <random@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rsi
shr    $0x8,%rsi
mov    -0x20(%rbp),%rdx
and    $0xff,%rdx
mov    -0x18(%rbp),%rcx
shr    $0x18,%rcx
mov    -0x18(%rbp),%r8
shr    $0x10,%r8
and    $0xff,%r8
mov    -0x18(%rbp),%r9
shr    $0x8,%r9
and    $0xff,%r9
mov    -0x18(%rbp),%rax
and    $0xff,%rax
lea    0xe11(%rip),%rdi
mov    %rax,(%rsp)
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
or     %eax,%ebx
mov    %ebx,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1070 <random@plt>
or     $0x200,%eax
movzwl %ax,%ebx
xor    %eax,%eax
call   1070 <random@plt>
movslq %eax,%rcx
mov    %rbx,%rsi
shr    $0x8,%rsi
movzbl %bl,%edx
mov    %ecx,%eax
movzbl %ch,%ebx
movzbl %cl,%edi
shr    $0x18,%rcx
shr    $0x10,%eax
movzbl %al,%r8d
mov    %rdi,(%rsp)
lea    0xe51(%rip),%rdi
mov    %rbx,%r9
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @time(i32 0)
%9 = call i32 (...) @getpid()
%10 = or i32 %8, %9
%11 = call i32 @srandom(i32 %10)
%12 = call i32 (...) @random()
%13 = and i32 %12, 65535
%14 = or i32 %13, 512
%15 = sext i32 %14 to i64
store i64 %15, i64* %7
%16 = call i32 (...) @random()
%17 = sext i32 %16 to i64
store i64 %17, i64* %6
%18 = load i64, i64* %7
%19 = lshr i64 %18, 8
%20 = load i64, i64* %7
%21 = and i64 %20, 255
%22 = load i64, i64* %6
%23 = lshr i64 %22, 24
%24 = load i64, i64* %6
%25 = lshr i64 %24, 16
%26 = and i64 %25, 255
%27 = load i64, i64* %6
%28 = lshr i64 %27, 8
%29 = and i64 %28, 255
%30 = load i64, i64* %6
%31 = and i64 %30, 255
%32 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %19, i64 %21, i64 %23, i64 %26, i64 %29, i64 %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"%02lx:%02lx:%02lx:%02lx:%02lx:%02lx\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32 0)
%4 = tail call i32 (...) @getpid()
%5 = or i32 %4, %3
%6 = tail call i32 @srandom(i32 %5)
%7 = tail call i32 (...) @random()
%8 = and i32 %7, 65023
%9 = or i32 %8, 512
%10 = zext i32 %9 to i64
%11 = tail call i32 (...) @random()
%12 = sext i32 %11 to i64
%13 = lshr i64 %10, 8
%14 = and i64 %10, 255
%15 = lshr i64 %12, 24
%16 = lshr i64 %12, 16
%17 = and i64 %16, 255
%18 = lshr i64 %12, 8
%19 = and i64 %18, 255
%20 = and i64 %12, 255
%21 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %13, i64 %14, i64 %15, i64 %17, i64 %19, i64 %20)
ret i32 0
}