#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*/ getopt(char *, char *);
int /*<<< orphan*/ strtok(int /*<<< orphan*/, char *);
char xtoi(int /*<<< orphan*/);
char *getmac(char *config2, char *token) {
  static char mac[6];
  mac[0] = xtoi(strtok(getopt(config2, token), ":"));
  mac[1] = xtoi(strtok(0, ":"));
  mac[2] = xtoi(strtok(0, ":"));
  mac[3] = xtoi(strtok(0, ":"));
  mac[4] = xtoi(strtok(0, ":"));
  mac[5] = xtoi(strtok(0, ":"));
  return mac;
}


x86 assembly (clang, -O0):
<getmac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <getopt@plt>
mov    %eax,%edi
lea    0xeaa(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2ed1(%rip)
xor    %edi,%edi
lea    0xe8f(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2eb7(%rip)
xor    %edi,%edi
lea    0xe74(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e9d(%rip)
xor    %edi,%edi
lea    0xe59(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e83(%rip)
xor    %edi,%edi
lea    0xe3e(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e69(%rip)
xor    %edi,%edi
lea    0xe23(%rip),%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e4f(%rip)
lea    0x2e43(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmac>:
push   %r14
push   %rbx
push   %rax
call   1050 <getopt@plt>
lea    0xec0(%rip),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2ee2(%rip)
lea    0x2edb(%rip),%r14
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2ec5(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2eaf(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e99(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e83(%rip)
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <strtok@plt>
mov    %eax,%edi
call   1030 <xtoi@plt>
mov    %al,0x2e6d(%rip)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@getmac.mac = internal global [6 x i8] zeroinitializer
@.str = [2 x i8] c":\00"
define i8* @getmac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @getopt(i8* %5, i8* %6)
%8 = call i32 @strtok(i32 %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = call signext i8 @xtoi(i32 %8)
store i8 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 0)
%10 = call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 @xtoi(i32 %10)
store i8 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 1)
%12 = call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call signext i8 @xtoi(i32 %12)
store i8 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 2)
%14 = call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = call signext i8 @xtoi(i32 %14)
store i8 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 3)
%16 = call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = call signext i8 @xtoi(i32 %16)
store i8 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 4)
%18 = call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = call signext i8 @xtoi(i32 %18)
store i8 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 5)
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 0)
}

LLVM IR (-O2):
@getmac.mac = internal global [6 x i8] zeroinitializer
@.str = [2 x i8] c":\00"
define i8* @getmac(i8* %0, i8* %1) {
%3 = tail call i32 @getopt(i8* %0, i8* %1)
%4 = tail call i32 @strtok(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call signext i8 @xtoi(i32 %4)
store i8 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 0)
%6 = tail call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call signext i8 @xtoi(i32 %6)
store i8 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 1)
%8 = tail call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = tail call signext i8 @xtoi(i32 %8)
store i8 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 2)
%10 = tail call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = tail call signext i8 @xtoi(i32 %10)
store i8 %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 3)
%12 = tail call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call signext i8 @xtoi(i32 %12)
store i8 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 4)
%14 = tail call i32 @strtok(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = tail call signext i8 @xtoi(i32 %14)
store i8 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 5)
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @getmac.mac, i64 0, i64 0)
}