char *netns_control_file(const char *nsname) {
  char *rv = 0;
  if (asprintf(&rv, "/var/run/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/pmillerchip/firejail/refs/"
               "heads/master/src/firejail/netns.c",
               36, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  return rv;
}


x86 assembly (clang, -O0):
<netns_control_file>:
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_control_file+0x8c>
jmp    117b <netns_control_file+0x3b>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xe84(%rip),%rdx
lea    0xe90(%rip),%rcx
lea    0xe92(%rip),%r8
mov    $0x24,%r9d
lea    0xf1b(%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_control_file>:
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_control_file+0x39>
mov    0x8(%rsp),%rax
add    $0x210,%rsp
pop    %rbx
ret
lea    0xf44(%rip),%rax
mov    %rax,(%rsp)
lea    0xe87(%rip),%rdx
lea    0xe93(%rip),%rcx
lea    0xe95(%rip),%r8
lea    0x10(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0x24,%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 = [18 x i8] c"/var/run/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 = [150 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/netns.c\00"
@__FUNCTION__.netns_control_file = [19 x i8] c"netns_control_file\00"
define i8* @netns_control_file(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 ([18 x i8], [18 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 ([150 x i8], [150 x i8]* @.str.3, i64 0, i64 0), i32 36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.netns_control_file, 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 = [18 x i8] c"/var/run/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 = [150 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/netns.c\00"
@__FUNCTION__.netns_control_file = [19 x i8] c"netns_control_file\00"
define i8* @netns_control_file(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 ([18 x i8], [18 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 ([150 x i8], [150 x i8]* @.str.3, i64 0, i64 0), i32 36, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.netns_control_file, 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
}