void display_cpu_header(char *cpu, int length) {
  charrep('-', length);
  printf("\n");
  if (strstr(cpu, "cluster"))
    printf("| %-*s |\n", length - 4, cpu);
  else if (strstr(cpu, "core"))
    printf("|      %-*s |\n", length - 9, cpu);
  else
    printf("|             %-*s |\n", length - 16, cpu);
}


x86 assembly (clang, -O0):
<display_cpu_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x2d,%edi
mov    $0x0,%al
call   1040 <charrep@plt>
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     1193 <display_cpu_header+0x63>
mov    -0xc(%rbp),%esi
sub    $0x4,%esi
mov    -0x8(%rbp),%rdx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <display_cpu_header+0xb7>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
je     11ca <display_cpu_header+0x9a>
mov    -0xc(%rbp),%esi
sub    $0x9,%esi
mov    -0x8(%rbp),%rdx
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <display_cpu_header+0xb2>
mov    -0xc(%rbp),%esi
sub    $0x10,%esi
mov    -0x8(%rbp),%rdx
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <display_cpu_header+0xb7>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_cpu_header>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x2d,%edi
xor    %eax,%eax
call   1050 <charrep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     1180 <display_cpu_header+0x40>
lea    0xe8f(%rip),%rdi
mov    $0xfffffffc,%esi
jmp    11b1 <display_cpu_header+0x71>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
mov    $0xfffffff0,%eax
mov    $0xfffffff7,%esi
cmove  %eax,%esi
lea    0xe80(%rip),%rax
lea    0xe6a(%rip),%rdi
cmove  %rax,%rdi
add    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [8 x i8] c"cluster\00"
@.str.2 = [10 x i8] c"| %-*s |\0A\00"
@.str.3 = [5 x i8] c"core\00"
@.str.4 = [15 x i8] c"| %-*s |\0A\00"
@.str.5 = [22 x i8] c"| %-*s |\0A\00"
define void @display_cpu_header(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 (i32, i32, ...) bitcast (i32 (...)* @charrep to i32 (i32, i32, ...)*)(i32 45, i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %3
%9 = call i8* @strstr(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 4
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %13, i8* %14)
br label %31
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i8* @strstr(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 9
%23 = load i8*, i8** %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i32 %22, i8* %23)
br label %30
25: ; preds = %16
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 16
%28 = load i8*, i8** %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %27, i8* %28)
br label %30
30: ; preds = %25, %20
br label %31
31: ; preds = %30, %11
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"cluster\00"
@.str.2 = [10 x i8] c"| %-*s |\0A\00"
@.str.3 = [5 x i8] c"core\00"
@.str.4 = [15 x i8] c"| %-*s |\0A\00"
@.str.5 = [22 x i8] c"| %-*s |\0A\00"
define void @display_cpu_header(i8* %0, i32 %1) {
%3 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @charrep to i32 (i32, i32, ...)*)(i32 45, i32 %1)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%9 = icmp eq i8* %8, null
%10 = select i1 %9, i32 -16, i32 -9
%11 = select i1 %9, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0)
br label %12
12: ; preds = %7, %2
%13 = phi i32 [ -4, %2 ], [ %10, %7 ]
%14 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %11, %7 ]
%15 = add nsw i32 %13, %1
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %14, i32 %15, i8* %0)
ret void
}