int net_config_mac(const char *ifname, const unsigned char mac[6]) {
  char *macstr;
  if (asprintf(&macstr, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2],
               mac[3], mac[4], mac[5]) == -1)
    do {
      char msgout[500];
      snprintf(msgout, 500, "Error %s: %s:%d %s", "asprintf",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/pmillerchip/firejail/refs/"
               "heads/master/src/firejail/network.c",
               254, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  sbox_run((1 << 0) | (1 << 4) | (1 << 2), 5,
           ("/run/firejail/lib"
            "/fnet"),
           "config", "mac", ifname, macstr);
  free(macstr);
  return 0;
}


x86 assembly (clang, -O0):
<net_config_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%edx
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%ecx
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%r8d
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%r9d
mov    -0x10(%rbp),%rax
movzbl 0x4(%rax),%r10d
mov    -0x10(%rbp),%rax
movzbl 0x5(%rax),%eax
lea    -0x18(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1060 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    121e <net_config_mac+0xbe>
jmp    11cd <net_config_mac+0x6d>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xe3e(%rip),%rdx
lea    0xe4a(%rip),%rcx
lea    0xe4c(%rip),%r8
mov    $0xfe,%r9d
lea    0xed7(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <snprintf@plt>
lea    -0x210(%rbp),%rdi
mov    $0x0,%al
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x8(%rbp),%r9
mov    -0x18(%rbp),%rax
mov    $0x15,%edi
mov    $0x5,%esi
lea    0xeaa(%rip),%rdx
lea    0xeba(%rip),%rcx
lea    0xe98(%rip),%r8
mov    %rax,(%rsp)
mov    $0x0,%al
call   1050 <sbox_run@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_config_mac>:
push   %rbx
sub    $0x220,%rsp
mov    %rdi,%rbx
movzbl (%rsi),%edx
movzbl 0x1(%rsi),%ecx
movzbl 0x2(%rsi),%r8d
movzbl 0x3(%rsi),%r9d
movzbl 0x4(%rsi),%eax
movzbl 0x5(%rsi),%esi
mov    %esi,0x8(%rsp)
mov    %eax,(%rsp)
lea    0xe6e(%rip),%rsi
lea    0x18(%rsp),%rdi
xor    %eax,%eax
call   1060 <asprintf@plt>
cmp    $0xffffffff,%eax
je     11ea <net_config_mac+0x8a>
mov    0x18(%rsp),%rax
mov    %rax,(%rsp)
lea    0xf2e(%rip),%rdx
lea    0xf3e(%rip),%rcx
lea    0xf1c(%rip),%r8
mov    $0x15,%edi
mov    $0x5,%esi
mov    %rbx,%r9
xor    %eax,%eax
call   1050 <sbox_run@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x220,%rsp
pop    %rbx
ret
lea    0xee1(%rip),%rax
mov    %rax,(%rsp)
lea    0xe22(%rip),%rdx
lea    0xe2e(%rip),%rcx
lea    0xe30(%rip),%r8
lea    0x20(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0xfe,%r9d
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
@.str.1 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.2 = [9 x i8] c"asprintf\00"
@.str.3 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmillerchip/firejail/refs/heads/master/src/firejail/network.c\00"
@__FUNCTION__.net_config_mac = [15 x i8] c"net_config_mac\00"
@.str.4 = [23 x i8] c"/run/firejail/lib/fnet\00"
@.str.5 = [7 x i8] c"config\00"
@.str.6 = [4 x i8] c"mac\00"
define i32 @net_config_mac(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [500 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 4
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = call i32 (i8**, i8*, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i32, i32, i32, i32, i32, i32, ...)*)(i8** %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %14, i32 %18, i32 %22, i32 %26, i32 %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %40
33: ; preds = %2
br label %34
34: ; preds = %33
%35 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%36 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %35, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 254, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.net_config_mac, i64 0, i64 0))
%37 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%38 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %37)
unreachable
39: ; No predecessors!
br label %40
40: ; preds = %39, %2
%41 = load i8*, i8** %3
%42 = load i8*, i8** %5
%43 = call i32 (i32, i32, i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @sbox_run to i32 (i32, i32, i8*, i8*, i8*, i8*, i8*, ...)*)(i32 21, i32 5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %41, i8* %42)
%44 = load i8*, i8** %5
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\00"
@.str.1 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.2 = [9 x i8] c"asprintf\00"
@.str.3 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/pmillerchip/firejail/refs/heads/master/src/firejail/network.c\00"
@__FUNCTION__.net_config_mac = [15 x i8] c"net_config_mac\00"
@.str.4 = [23 x i8] c"/run/firejail/lib/fnet\00"
@.str.5 = [7 x i8] c"config\00"
@.str.6 = [4 x i8] c"mac\00"
define i32 @net_config_mac(i8* %0, i8* nocapture %1) {
%3 = alloca i8*
%4 = alloca [500 x i8]
%5 = bitcast i8** %3 to i8*
%6 = load i8, i8* %1
%7 = zext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %1, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = getelementptr inbounds i8, i8* %1, i64 4
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = getelementptr inbounds i8, i8* %1, i64 5
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 (i8**, i8*, i32, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i32, i32, i32, i32, i32, i32, ...)*)(i8** %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %13, i32 %16, i32 %19, i32 %22)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %29
25: ; preds = %2
%26 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%27 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %26, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.3, i64 0, i64 0), i32 254, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.net_config_mac, i64 0, i64 0))
%28 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %26)
unreachable
29: ; preds = %2
%30 = load i8*, i8** %3
%31 = call i32 (i32, i32, i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @sbox_run to i32 (i32, i32, i8*, i8*, i8*, i8*, i8*, ...)*)(i32 21, i32 5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %30)
%32 = load i8*, i8** %3
ret i32 0
}