char *get_header(void) {
  char *rv;
  if (asprintf(&rv, "%-5.5s %-9.9s %-10.10s %-10.10s %s", "PID", "User",
               "RX(KB/s)", "TX(KB/s)", "Command") == -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/Fred-Barclay/firejail/refs/"
               "heads/master/src/firemon/netstats.c",
               51, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  return rv;
}


x86 assembly (clang, -O0):
<get_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
lea    0xec6(%rip),%rdx
lea    0xec3(%rip),%rcx
lea    0xec1(%rip),%r8
lea    0xec3(%rip),%r9
lea    0xec5(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11e3 <get_header+0xa3>
jmp    1192 <get_header+0x52>
lea    -0x200(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xea1(%rip),%rdx
lea    0xead(%rip),%rcx
lea    0xeaf(%rip),%r8
mov    $0x33,%r9d
lea    0xf3b(%rip),%rax
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    -0x200(%rbp),%rdi
mov    $0x0,%al
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_header>:
push   %rbx
sub    $0x210,%rsp
lea    0xeef(%rip),%rax
mov    %rax,(%rsp)
lea    0xea6(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xebf(%rip),%rcx
lea    0xebd(%rip),%r8
lea    0xebf(%rip),%r9
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1040 <asprintf@plt>
cmp    $0xffffffff,%eax
je     1195 <get_header+0x55>
mov    0x8(%rsp),%rax
add    $0x210,%rsp
pop    %rbx
ret
lea    0xf5f(%rip),%rax
mov    %rax,(%rsp)
lea    0xe9f(%rip),%rdx
lea    0xeab(%rip),%rcx
lea    0xead(%rip),%r8
lea    0x10(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0x33,%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 = [35 x i8] c"%-5.5s %-9.9s %-10.10s %-10.10s %s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"User\00"
@.str.3 = [9 x i8] c"RX(KB/s)\00"
@.str.4 = [9 x i8] c"TX(KB/s)\00"
@.str.5 = [8 x i8] c"Command\00"
@.str.6 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.7 = [9 x i8] c"asprintf\00"
@.str.8 = [153 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/firemon/netstats.c\00"
@__FUNCTION__.get_header = [11 x i8] c"get_header\00"
define i8* @get_header() {
%1 = alloca i8*
%2 = alloca [500 x i8]
%3 = call i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, ...)*)(i8** %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %12
5: ; preds = %0
br label %6
6: ; preds = %5
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %7, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.8, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.get_header, i64 0, i64 0))
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %9)
unreachable
11: ; No predecessors!
br label %12
12: ; preds = %11, %0
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [35 x i8] c"%-5.5s %-9.9s %-10.10s %-10.10s %s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"User\00"
@.str.3 = [9 x i8] c"RX(KB/s)\00"
@.str.4 = [9 x i8] c"TX(KB/s)\00"
@.str.5 = [8 x i8] c"Command\00"
@.str.6 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.7 = [9 x i8] c"asprintf\00"
@.str.8 = [153 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/firemon/netstats.c\00"
@__FUNCTION__.get_header = [11 x i8] c"get_header\00"
define i8* @get_header() {
%1 = alloca i8*
%2 = alloca [500 x i8]
%3 = bitcast i8** %1 to i8*
%4 = call i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, ...)*)(i8** %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %7, i64 500, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str.8, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.get_header, i64 0, i64 0))
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %7)
unreachable
10: ; preds = %0
%11 = load i8*, i8** %1
ret i8* %11
}