void __make_head(char *head, int index, int i, int len) {
  char name_h[5][20] = {"main segments", "page/slab caches", "cp/gc", "blks",
                        "memory"};
  int half = (len - strlen(name_h[i])) / 2;
  *(head + index) = '|';
  index++;
  memset(head + index, '-', half);
  index += half;
  strcpy(head + index, name_h[i]);
  index += strlen(name_h[i]);
  memset(head + index, '-', half);
}


x86 assembly (clang, -O0):
<__make_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x64,%edx
call   1060 <memcpy@plt>
movslq -0x14(%rbp),%rax
mov    %rax,-0x90(%rbp)
movslq -0x10(%rbp),%rax
lea    -0x80(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x90(%rbp),%rax
sub    %rcx,%rax
shr    $0x1,%rax
mov    %eax,-0x84(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x7c,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
movslq -0x84(%rbp),%rdx
mov    $0x2d,%esi
call   1050 <memset@plt>
mov    -0x84(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
movslq -0x10(%rbp),%rax
lea    -0x80(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
movslq -0x10(%rbp),%rax
lea    -0x80(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
movslq -0x84(%rbp),%rdx
mov    $0x2d,%esi
call   1050 <memset@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__make_head>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %esi,%r12d
mov    %rdi,%r13
mov    0xf16(%rip),%eax
mov    %eax,0x60(%rsp)
movaps 0xefb(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xedf(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xec3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe6f(%rip),%xmm0
movaps %xmm0,(%rsp)
movslq %ecx,%rbp
movslq %edx,%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,4),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
sub    %rax,%rbp
shr    %rbp
movslq %r12d,%rbx
movb   $0x7c,0x0(%r13,%rbx,1)
lea    (%rbx,%rbp,1),%r12d
lea    (%rbx,%r13,1),%rdi
add    $0x1,%rdi
movslq %ebp,%rbp
mov    $0x2d,%esi
mov    %rbp,%rdx
call   1050 <memset@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
movslq %eax,%rdi
add    %r13,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    (%r14,%r12,1),%eax
add    $0x1,%eax
movslq %eax,%rdi
add    %r13,%rdi
mov    $0x2d,%esi
mov    %rbp,%rdx
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <memset@plt>

LLVM IR (-O0):
@__const.__make_head.name_h = [5 x [20 x i8]] [[20 x i8] c"main segments\00\00\00\00\00\00\00", [20 x i8] c"page/slab caches\00\00\00\00", [20 x i8] c"cp/gc\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"blks\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"memory\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
define void @__make_head(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x [20 x i8]]
%10 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = bitcast [5 x [20 x i8]]* %9 to i8*
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %9, i64 0, i64 %15
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %16, i64 0, i64 0
%18 = call i64 @strlen(i8* %17)
%19 = sub i64 %13, %18
%20 = udiv i64 %19, 2
%21 = trunc i64 %20 to i32
store i32 %21, i32* %10
%22 = load i8*, i8** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 124, i8* %25
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
%28 = load i8*, i8** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = load i32, i32* %10
%35 = load i32, i32* %6
%36 = add nsw i32 %35, %34
store i32 %36, i32* %6
%37 = load i8*, i8** %5
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %9, i64 0, i64 %42
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %43, i64 0, i64 0
%45 = call i8* @strcpy(i8* %40, i8* %44)
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %9, i64 0, i64 %47
%49 = getelementptr inbounds [20 x i8], [20 x i8]* %48, i64 0, i64 0
%50 = call i64 @strlen(i8* %49)
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = add i64 %52, %50
%54 = trunc i64 %53 to i32
store i32 %54, i32* %6
%55 = load i8*, i8** %5
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %55, i64 %57
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
ret void
}

LLVM IR (-O2):
@__const.__make_head.name_h = [5 x [20 x i8]] [[20 x i8] c"main segments\00\00\00\00\00\00\00", [20 x i8] c"page/slab caches\00\00\00\00", [20 x i8] c"cp/gc\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"blks\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", [20 x i8] c"memory\00\00\00\00\00\00\00\00\00\00\00\00\00\00"]
define void @__make_head(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [5 x [20 x i8]]
%6 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %5, i64 0, i64 0, i64 0
%7 = sext i32 %3 to i64
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds [5 x [20 x i8]], [5 x [20 x i8]]* %5, i64 0, i64 %8, i64 0
%10 = call i64 @strlen(i8* %9)
%11 = sub i64 %7, %10
%12 = lshr i64 %11, 1
%13 = trunc i64 %12 to i32
%14 = sext i32 %1 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8 124, i8* %15
%16 = add nsw i32 %1, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
%19 = shl i64 %12, 32
%20 = ashr exact i64 %19, 32
tail call void @llvm.memset.p0i8.i64(i8* align 1 %18, i8 45, i64 %20, i1 false)
%21 = add nsw i32 %16, %13
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = call i8* @strcpy(i8* dereferenceable(1) %23, i8* %9)
%25 = trunc i64 %10 to i32
%26 = add i32 %21, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
tail call void @llvm.memset.p0i8.i64(i8* align 1 %28, i8 45, i64 %20, i1 false)
ret void
}