#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 print_menu_item(const char *menu_text, int align) {
  int text_len;
  int prefix_num, i;
  text_len = strlen(menu_text);
  prefix_num = (40 - text_len) / 2;
  if (align == 1) {
    for (i = 0; i < prefix_num; i++) {
      putchar(' ');
    }
  }
  printf("%s", menu_text);
  for (i = 0; i < prefix_num; i++) {
    putchar(' ');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_menu_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    $0x28,%eax
sub    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1198 <print_menu_item+0x68>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1193 <print_menu_item+0x63>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <print_menu_item+0x3f>
jmp    1198 <print_menu_item+0x68>
mov    -0x8(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d3 <print_menu_item+0xa3>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11af <print_menu_item+0x7f>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_menu_item>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r12d
mov    $0x28,%eax
sub    %r12d,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
cmp    $0x1,%r15d
jne    117f <print_menu_item+0x4f>
cmp    $0x26,%r12d
jg     117f <print_menu_item+0x4f>
cmp    $0x2,%ebx
mov    $0x1,%ebp
cmovge %ebx,%ebp
xchg   %ax,%ax
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <print_menu_item+0x40>
lea    0xe7a(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
cmp    $0x26,%r12d
jg     11af <print_menu_item+0x7f>
cmp    $0x2,%ebx
mov    $0x1,%ebp
cmovge %ebx,%ebp
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <print_menu_item+0x70>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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