void print_menu(void) {
  int num_options = 6;
  int col_width = 20;
  char *opt[num_options];
  opt[0] = "Add a new record";
  opt[1] = "Modify a record";
  opt[2] = "Print a record";
  opt[3] = "Print all info";
  opt[4] = "Delete a record";
  opt[5] = "Quit the program";
  printf("What would you like to do?\n");
  int i = 0;
  while (i < num_options) {
    printf("%d:\t%*s\t%d:\t%*s\n", i, col_width, opt[i], i + 1, col_width,
           i >= num_options ? '\0' : opt[i + 1]);
    i = i + 2;
  }
}


x86 assembly (clang, -O0):
<print_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x6,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
lea    0xf(,%rcx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x28(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
lea    0xeaa(%rip),%rcx
mov    %rcx,(%rax)
lea    0xeb1(%rip),%rcx
mov    %rcx,0x8(%rax)
lea    0xeb6(%rip),%rcx
mov    %rcx,0x10(%rax)
lea    0xeba(%rip),%rcx
mov    %rcx,0x18(%rax)
lea    0xebe(%rip),%rcx
mov    %rcx,0x20(%rax)
lea    0xec3(%rip),%rcx
mov    %rcx,0x28(%rax)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1246 <print_menu+0x136>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,-0x40(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,-0x3c(%rbp)
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     11f3 <print_menu+0xe3>
xor    %eax,%eax
mov    %rax,-0x48(%rbp)
jmp    1208 <print_menu+0xf8>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%r8d
mov    -0x38(%rbp),%rcx
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%esi
mov    -0x48(%rbp),%rax
lea    0xe57(%rip),%rdi
sub    $0x10,%rsp
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a5 <print_menu+0x95>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_menu>:
push   %rbx
sub    $0x10,%rsp
lea    0xf45(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rax
mov    %rax,(%rsp)
lea    0xf1d(%rip),%rbx
lea    0xeb6(%rip),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x14,%edx
mov    $0x1,%r8d
mov    $0x14,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rax
mov    %rax,(%rsp)
lea    0xea8(%rip),%rcx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x14,%edx
mov    $0x3,%r8d
mov    $0x14,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rax
mov    %rax,(%rsp)
lea    0xe94(%rip),%rcx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x14,%edx
mov    $0x5,%r8d
mov    $0x14,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Add a new record\00"
@.str.1 = [16 x i8] c"Modify a record\00"
@.str.2 = [15 x i8] c"Print a record\00"
@.str.3 = [15 x i8] c"Print all info\00"
@.str.4 = [16 x i8] c"Delete a record\00"
@.str.5 = [17 x i8] c"Quit the program\00"
@.str.6 = [28 x i8] c"What would you like to do?\0A\00"
@.str.7 = [17 x i8] c"%d:\09%*s\09%d:\09%*s\0A\00"
define void @print_menu() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 6, i32* %1
store i32 20, i32* %2
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8*, i64 %7
store i64 %7, i64* %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds i8*, i8** %9, i64 1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds i8*, i8** %9, i64 2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8** %12
%13 = getelementptr inbounds i8*, i8** %9, i64 3
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds i8*, i8** %9, i64 4
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds i8*, i8** %9, i64 5
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i8** %15
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %5
br label %17
17: ; preds = %41, %0
%18 = load i32, i32* %5
%19 = load i32, i32* %1
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %46
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %9, i64 %25
%27 = load i8*, i8** %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
%30 = load i32, i32* %2
%31 = load i32, i32* %5
%32 = load i32, i32* %1
%33 = icmp sge i32 %31, %32
br i1 %33, label %34, label %35
34: ; preds = %21
br label %41
35: ; preds = %21
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %9, i64 %38
%40 = load i8*, i8** %39
br label %41
41: ; preds = %35, %34
%42 = phi i8* [ null, %34 ], [ %40, %35 ]
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 %22, i32 %23, i8* %27, i32 %29, i32 %30, i8* %42)
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 2
store i32 %45, i32* %5
br label %17
46: ; preds = %17
%47 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Add a new record\00"
@.str.1 = [16 x i8] c"Modify a record\00"
@.str.2 = [15 x i8] c"Print a record\00"
@.str.3 = [15 x i8] c"Print all info\00"
@.str.4 = [16 x i8] c"Delete a record\00"
@.str.5 = [17 x i8] c"Quit the program\00"
@.str.7 = [17 x i8] c"%d:\09%*s\09%d:\09%*s\0A\00"
@str = [27 x i8] c"What would you like to do?\00"
define void @print_menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 0, i32 20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1, i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i32 4, i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 5, i32 20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
ret void
}