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];
      sprintf(msgout, "Error %s:%s(%d)", "asprintf", __FUNCTION__, 33);
      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   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
jne    11d3 <get_header+0x93>
jmp    1192 <get_header+0x52>
lea    -0x200(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    0xeaf(%rip),%rdx
lea    0xeb1(%rip),%rcx
mov    $0x21,%r8d
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x200(%rbp),%rdi
mov    $0x0,%al
call   1040 <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   1030 <asprintf@plt>
cmp    $0xffffffff,%eax
je     1195 <get_header+0x55>
mov    0x8(%rsp),%rax
add    $0x210,%rsp
pop    %rbx
ret
lea    0xeaa(%rip),%rsi
lea    0xeb3(%rip),%rdx
lea    0xeb5(%rip),%rcx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x21,%r8d
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <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 = [16 x i8] c"Error %s:%s(%d)\00"
@.str.7 = [9 x i8] c"asprintf\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*, i8*, ...) @sprintf(i8* %7, i8* getelementptr inbounds ([16 x i8], [16 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 ([11 x i8], [11 x i8]* @__FUNCTION__.get_header, i64 0, i64 0), i32 33)
%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 = [16 x i8] c"Error %s:%s(%d)\00"
@.str.7 = [9 x i8] c"asprintf\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*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 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 ([11 x i8], [11 x i8]* @__FUNCTION__.get_header, i64 0, i64 0), i32 33)
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %7)
unreachable
10: ; preds = %0
%11 = load i8*, i8** %1
ret i8* %11
}