char *get_header(void) {
  char *rv;
  if (asprintf(&rv, "%-5.5s %-9.9s %-8.8s %-8.8s %-5.5s %-4.4s %-9.9s %s",
               "PID", "User", "RES(KiB)", "SHR(KiB)", "CPU%", "Prcs", "Uptime",
               "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/netblue30/firejail/refs/"
               "heads/master/src/firemon/top.c",
               52, __FUNCTION__);
      perror(msgout);
      exit(1);
    } while (0);
  return rv;
}


x86 assembly (clang, -O0):
<get_header>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x228,%rsp
lea    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
lea    0xed6(%rip),%rdx
lea    0xed3(%rip),%rcx
lea    0xed1(%rip),%r8
lea    0xed3(%rip),%r9
lea    0xed5(%rip),%rbx
lea    0xed3(%rip),%r11
lea    0xed1(%rip),%r10
lea    0xed1(%rip),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1040 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    1208 <get_header+0xc8>
jmp    11b7 <get_header+0x77>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
lea    0xe9e(%rip),%rdx
lea    0xeaa(%rip),%rcx
lea    0xeac(%rip),%r8
mov    $0x34,%r9d
lea    0xf30(%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    $0x228,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_header>:
push   %r14
push   %rbx
sub    $0x208,%rsp
lea    0xf0f(%rip),%rbx
lea    0xf01(%rip),%r10
lea    0xef5(%rip),%r11
lea    0xee9(%rip),%r14
lea    0xe93(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xebd(%rip),%rcx
lea    0xebb(%rip),%r8
lea    0xebd(%rip),%r9
lea    0x8(%rsp),%rdi
xor    %eax,%eax
push   %rbx
push   %r10
push   %r11
push   %r14
call   1040 <asprintf@plt>
add    $0x20,%rsp
cmp    $0xffffffff,%eax
je     11b5 <get_header+0x75>
mov    0x8(%rsp),%rax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret
sub    $0x8,%rsp
lea    0xf55(%rip),%r10
lea    0xea1(%rip),%rdx
lea    0xead(%rip),%rcx
lea    0xeaf(%rip),%r8
lea    0x18(%rsp),%rbx
mov    $0x1f4,%esi
mov    %rbx,%rdi
mov    $0x34,%r9d
xor    %eax,%eax
push   %r10
call   1030 <snprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"%-5.5s %-9.9s %-8.8s %-8.8s %-5.5s %-4.4s %-9.9s %s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"User\00"
@.str.3 = [9 x i8] c"RES(KiB)\00"
@.str.4 = [9 x i8] c"SHR(KiB)\00"
@.str.5 = [5 x i8] c"CPU%\00"
@.str.6 = [5 x i8] c"Prcs\00"
@.str.7 = [7 x i8] c"Uptime\00"
@.str.8 = [8 x i8] c"Command\00"
@.str.9 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.10 = [9 x i8] c"asprintf\00"
@.str.11 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/netblue30/firejail/refs/heads/master/src/firemon/top.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*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...)*)(i8** %1, i8* getelementptr inbounds ([52 x i8], [52 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 ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.11, i64 0, i64 0), i32 52, 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 = [52 x i8] c"%-5.5s %-9.9s %-8.8s %-8.8s %-5.5s %-4.4s %-9.9s %s\00"
@.str.1 = [4 x i8] c"PID\00"
@.str.2 = [5 x i8] c"User\00"
@.str.3 = [9 x i8] c"RES(KiB)\00"
@.str.4 = [9 x i8] c"SHR(KiB)\00"
@.str.5 = [5 x i8] c"CPU%\00"
@.str.6 = [5 x i8] c"Prcs\00"
@.str.7 = [7 x i8] c"Uptime\00"
@.str.8 = [8 x i8] c"Command\00"
@.str.9 = [19 x i8] c"Error %s: %s:%d %s\00"
@.str.10 = [9 x i8] c"asprintf\00"
@.str.11 = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/netblue30/firejail/refs/heads/master/src/firemon/top.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*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @asprintf to i32 (i8**, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, ...)*)(i8** %1, i8* getelementptr inbounds ([52 x i8], [52 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 ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, 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.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str.11, i64 0, i64 0), i32 52, 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
}