#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 *);
int tio_get_cols();
int /*<<< orphan*/ tio_move_cursor(int, int);
int /*<<< orphan*/ tio_set_text_bold();
int /*<<< orphan*/ tio_set_text_normal();
void menu_print_header(char *v) {
  int i;
  int term_cols = tio_get_cols();
  tio_move_cursor(1, 2);
  tio_set_text_normal();
  tio_set_text_bold();
  printf("B-MENU v%s", v);
  tio_set_text_normal();
  tio_move_cursor(2, 1);
  for (i = 0; i < term_cols; ++i)
    printf("%s", "\xe2\x95\x90");
}


x86 assembly (clang, -O0):
<menu_print_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <tio_get_cols@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <tio_move_cursor@plt>
mov    $0x0,%al
call   1050 <tio_set_text_normal@plt>
mov    $0x0,%al
call   1030 <tio_set_text_bold@plt>
mov    -0x8(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <tio_set_text_normal@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <tio_move_cursor@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11dd <menu_print_header+0x8d>
lea    0xe45(%rip),%rdi
lea    0xe41(%rip),%rsi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <menu_print_header+0x60>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_print_header>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <tio_get_cols@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <tio_move_cursor@plt>
xor    %eax,%eax
call   1050 <tio_set_text_normal@plt>
xor    %eax,%eax
call   1030 <tio_set_text_bold@plt>
lea    0xe7b(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <tio_set_text_normal@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <tio_move_cursor@plt>
test   %ebx,%ebx
jle    11d0 <menu_print_header+0x80>
lea    0xe5a(%rip),%r14
lea    0xe56(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
add    $0xffffffff,%ebx
jne    11c0 <menu_print_header+0x70>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"B-MENU v%s\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"\E2\95\90\00"
define void @menu_print_header(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (...) @tio_get_cols()
store i32 %5, i32* %4
%6 = call i32 @tio_move_cursor(i32 1, i32 2)
%7 = call i32 (...) @tio_set_text_normal()
%8 = call i32 (...) @tio_set_text_bold()
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (...) @tio_set_text_normal()
%12 = call i32 @tio_move_cursor(i32 2, i32 1)
store i32 0, i32* %3
br label %13
13: ; preds = %19, %1
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %13
22: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"B-MENU v%s\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"\E2\95\90\00"
define void @menu_print_header(i8* %0) {
%2 = tail call i32 (...) @tio_get_cols()
%3 = tail call i32 @tio_move_cursor(i32 1, i32 2)
%4 = tail call i32 (...) @tio_set_text_normal()
%5 = tail call i32 (...) @tio_set_text_bold()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = tail call i32 (...) @tio_set_text_normal()
%8 = tail call i32 @tio_move_cursor(i32 2, i32 1)
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %15
10: ; preds = %1, %10
%11 = phi i32 [ %13, %10 ], [ 0, %1 ]
%12 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %2
br i1 %14, label %15, label %10
15: ; preds = %10, %1
ret void
}