#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ putchar(char);
int strlen(char const *);
void menu_display_header(const char *title) {
  int titleLenght = strlen(title);
  for (int i = 0; i < 80; ++i)
    putchar('-');
  putchar('\n');
  putchar('\n');
  for (int i = 0; i < 40 - titleLenght / 2; ++i)
    putchar(' ');
  putchar('\n');
  printf("%s\n", title);
}


x86 assembly (clang, -O0):
<menu_display_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x50,-0x10(%rbp)
jge    1171 <menu_display_header+0x41>
mov    $0x2d,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114f <menu_display_header+0x1f>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
mov    -0x18(%rbp),%eax
mov    $0x28,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    11c9 <menu_display_header+0x99>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118c <menu_display_header+0x5c>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rsi
lea    0xe22(%rip),%rdi
call   1050 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_display_header>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    $0x50,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1150 <menu_display_header+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmp    $0x4f,%ebp
jg     119f <menu_display_header+0x6f>
mov    %ebp,%eax
shr    $0x1f,%eax
add    %ebp,%eax
sar    %eax
mov    $0x28,%ebp
sub    %eax,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <menu_display_header+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe50(%rip),%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @menu_display_header(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %13, %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 80
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = call i32 @putchar(i8 signext 45)
br label %13
13: ; preds = %11
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %8
16: ; preds = %8
%17 = call i32 @putchar(i8 signext 10)
%18 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %5
br label %19
19: ; preds = %27, %16
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = sdiv i32 %21, 2
%23 = sub nsw i32 40, %22
%24 = icmp slt i32 %20, %23
br i1 %24, label %25, label %30
25: ; preds = %19
%26 = call i32 @putchar(i8 signext 32)
br label %27
27: ; preds = %25
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %19
30: ; preds = %19
%31 = call i32 @putchar(i8 signext 10)
%32 = load i8*, i8** %2
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @menu_display_header(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
br label %10
3: ; preds = %10
%4 = tail call i32 @putchar(i8 signext 10)
%5 = tail call i32 @putchar(i8 signext 10)
%6 = icmp slt i32 %2, 80
br i1 %6, label %7, label %15
7: ; preds = %3
%8 = sdiv i32 %2, -2
%9 = add nsw i32 %8, 39
br label %18
10: ; preds = %1, %10
%11 = phi i32 [ 0, %1 ], [ %13, %10 ]
%12 = tail call i32 @putchar(i8 signext 45)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, 80
br i1 %14, label %3, label %10
15: ; preds = %18, %3
%16 = tail call i32 @putchar(i8 signext 10)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
18: ; preds = %7, %18
%19 = phi i32 [ %21, %18 ], [ 0, %7 ]
%20 = tail call i32 @putchar(i8 signext 32)
%21 = add nuw i32 %19, 1
%22 = icmp eq i32 %19, %9
br i1 %22, label %15, label %18
}