#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 /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void usnic_mac_to_gid(const char *const mac, char *raw_gid) {
  raw_gid[0] = 0xfe;
  raw_gid[1] = 0x80;
  memset(&raw_gid[2], 0, 6);
  raw_gid[8] = mac[0] ^ 2;
  raw_gid[9] = mac[1];
  raw_gid[10] = mac[2];
  raw_gid[11] = 0xff;
  raw_gid[12] = 0xfe;
  raw_gid[13] = mac[3];
  raw_gid[14] = mac[4];
  raw_gid[15] = mac[5];
}


x86 assembly (clang, -O0):
<usnic_mac_to_gid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0xfe,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x80,0x1(%rax)
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
xor    $0x2,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x9(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0xa(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0xb(%rax)
mov    -0x10(%rbp),%rax
movb   $0xfe,0xc(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0xd(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0xe(%rax)
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0xf(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usnic_mac_to_gid>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movw   $0x80fe,(%rsi)
lea    0x2(%rsi),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
mov    (%r14),%al
xor    $0x2,%al
mov    %al,0x8(%rbx)
mov    0x1(%r14),%al
mov    %al,0x9(%rbx)
mov    0x2(%r14),%al
mov    %al,0xa(%rbx)
movw   $0xfeff,0xb(%rbx)
mov    0x3(%r14),%al
mov    %al,0xd(%rbx)
mov    0x4(%r14),%al
mov    %al,0xe(%rbx)
mov    0x5(%r14),%al
mov    %al,0xf(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @usnic_mac_to_gid(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 0
store i8 -2, i8* %6
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 -128, i8* %8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = call i32 @memset(i8* %10, i32 0, i32 6)
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = xor i32 %15, 2
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 8
store i8 %17, i8* %19
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 9
store i8 %22, i8* %24
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 2
%27 = load i8, i8* %26
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i64 10
store i8 %27, i8* %29
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 11
store i8 -1, i8* %31
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 12
store i8 -2, i8* %33
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 3
%36 = load i8, i8* %35
%37 = load i8*, i8** %4
%38 = getelementptr inbounds i8, i8* %37, i64 13
store i8 %36, i8* %38
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 4
%41 = load i8, i8* %40
%42 = load i8*, i8** %4
%43 = getelementptr inbounds i8, i8* %42, i64 14
store i8 %41, i8* %43
%44 = load i8*, i8** %3
%45 = getelementptr inbounds i8, i8* %44, i64 5
%46 = load i8, i8* %45
%47 = load i8*, i8** %4
%48 = getelementptr inbounds i8, i8* %47, i64 15
store i8 %46, i8* %48
ret void
}

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