#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 rand();
int /*<<< orphan*/ srand(scalar_t__);
scalar_t__ time(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  unsigned long ethaddr_low, ethaddr_high;
  srand(time(0) + (getpid() << 8));
  ethaddr_high = (rand() & 0xfeff) | 0x0200;
  ethaddr_low = rand();
  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    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x28(%rbp),%rdi
shl    $0x8,%eax
cltq
add    %rax,%rdi
call   1050 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
and    $0xfeff,%eax
or     $0x200,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1070 <rand@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    0xe09(%rip),%rdi
mov    %rax,(%rsp)
call   1040 <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    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
shl    $0x8,%eax
movslq %eax,%rdi
add    %rbx,%rdi
call   1050 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
mov    %eax,%ebx
and    $0xfcff,%ebx
or     $0x200,%ebx
xor    %eax,%eax
call   1070 <rand@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    0xe45(%rip),%rdi
mov    %rbx,%r9
call   1040 <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 i64 @time(i32 0)
%9 = call i32 (...) @getpid()
%10 = shl i32 %9, 8
%11 = sext i32 %10 to i64
%12 = add nsw i64 %8, %11
%13 = call i32 @srand(i64 %12)
%14 = call i32 (...) @rand()
%15 = and i32 %14, 65279
%16 = or i32 %15, 512
%17 = sext i32 %16 to i64
store i64 %17, i64* %7
%18 = call i32 (...) @rand()
%19 = sext i32 %18 to i64
store i64 %19, i64* %6
%20 = load i64, i64* %7
%21 = lshr i64 %20, 8
%22 = load i64, i64* %7
%23 = and i64 %22, 255
%24 = load i64, i64* %6
%25 = lshr i64 %24, 24
%26 = load i64, i64* %6
%27 = lshr i64 %26, 16
%28 = and i64 %27, 255
%29 = load i64, i64* %6
%30 = lshr i64 %29, 8
%31 = and i64 %30, 255
%32 = load i64, i64* %6
%33 = and i64 %32, 255
%34 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %21, i64 %23, i64 %25, i64 %28, i64 %31, i64 %33)
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 i64 @time(i32 0)
%4 = tail call i32 (...) @getpid()
%5 = shl i32 %4, 8
%6 = sext i32 %5 to i64
%7 = add nsw i64 %3, %6
%8 = tail call i32 @srand(i64 %7)
%9 = tail call i32 (...) @rand()
%10 = and i32 %9, 64767
%11 = or i32 %10, 512
%12 = zext i32 %11 to i64
%13 = tail call i32 (...) @rand()
%14 = sext i32 %13 to i64
%15 = lshr i64 %12, 8
%16 = and i64 %12, 255
%17 = lshr i64 %14, 24
%18 = lshr i64 %14, 16
%19 = and i64 %18, 255
%20 = lshr i64 %14, 8
%21 = and i64 %20, 255
%22 = and i64 %14, 255
%23 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %16, i64 %17, i64 %19, i64 %21, i64 %22)
ret i32 0
}