char *netns_etc_dir(const char *nsname) {
  char *rv = 0;
  if (asprintf(&rv, "/etc/netns/%s", nsname) <= 0)
    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/Fred-Barclay/firejail/refs/"
               "heads/master/src/firejail/netns.c",
               43, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  return rv;
}


x86 assembly (clang, -O0):
<netns_etc_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1040 <asprintf@plt>
cmp    $0x0,%eax
jg     11cc <netns_etc_dir+0x8c>
jmp    117b <netns_etc_dir+0x3b>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xe80(%rip),%rdx
lea    0xe8c(%rip),%rcx
lea    0xe8e(%rip),%r8
mov    $0x2b,%r9d
lea    0xf18(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x210(%rbp),%rdi
mov    $0x0,%al
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netns_etc_dir>:
push   %rbx
sub    $0x210,%rsp
mov    %rdi,%rdx
movq   $0x0,0x8(%rsp)
lea    0xea5(%rip),%rsi
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1040 <asprintf@plt>
test   %eax,%eax
jle    1179 <netns_etc_dir+0x39>
mov    0x8(%rsp),%rax
add    $0x210,%rsp
pop    %rbx
ret
lea    0xf41(%rip),%rax
mov    %rax,(%rsp)
lea    0xe83(%rip),%rdx
lea    0xe8f(%rip),%rcx
lea    0xe91(%rip),%r8
lea    0x10(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0x2b,%r9d
xor    %eax,%eax
call   1030 <snprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"/etc/netns/%s\00"
@.str.1 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.2 = [9 x i8] c"asprintf\00"
@.str.3 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Fred-Barclay/firejail/refs/heads/master/src/firejail/netns.c\00"
@__FUNCTION__.netns_etc_dir = [14 x i8] c"netns_etc_dir\00"
define i8* @netns_etc_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [500 x i8]
store i8* %0, i8** %2
store i8* null, i8** %3
%5 = load i8*, i8** %2
%6 = call i32 (i8**, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, ...)*)(i8** %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%11 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %10, 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 ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.netns_etc_dir, i64 0, i64 0))
%12 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %12)
unreachable
14: ; No predecessors!
br label %15
15: ; preds = %14, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"/etc/netns/%s\00"
@.str.1 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.2 = [9 x i8] c"asprintf\00"
@.str.3 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Fred-Barclay/firejail/refs/heads/master/src/firejail/netns.c\00"
@__FUNCTION__.netns_etc_dir = [14 x i8] c"netns_etc_dir\00"
define i8* @netns_etc_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca [500 x i8]
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = call i32 (i8**, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, ...)*)(i8** %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%9 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %8, 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 ([151 x i8], [151 x i8]* @.str.3, i64 0, i64 0), i32 43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__FUNCTION__.netns_etc_dir, i64 0, i64 0))
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %8)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %2
ret i8* %12
}