#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*/ A_REVERSE;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ addstr(char const *);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ move(int, int);
size_t strlen(char const *);
void mvaddselstr(int y, int x0, int item, int curitem, size_t width,
                 const char *str) {
  size_t i, len;
  len = strlen(str);
  move(y, x0);
  if (curitem == item) {
    attron(A_REVERSE);
  }
  addstr(str);
  if (curitem == item) {
    for (i = len; i < width; i++) {
      addch(' ');
    }
    attroff(A_REVERSE);
  }
}


x86 assembly (clang, -O0):
<mvaddselstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1080 <move@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11ae <mvaddselstr+0x4e>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
call   1050 <attron@plt>
mov    -0x20(%rbp),%rdi
call   1070 <addstr@plt>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1202 <mvaddselstr+0xa2>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    11f4 <mvaddselstr+0x94>
mov    $0x20,%edi
call   1060 <addch@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11cb <mvaddselstr+0x6b>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvaddselstr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%rbx
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebp
mov    %edi,%r15d
mov    %r9,%rdi
call   1040 <strlen@plt>
mov    %rax,(%rsp)
mov    %r15d,%edi
mov    %ebp,%esi
call   1080 <move@plt>
cmp    %r13d,%r12d
jne    11e6 <mvaddselstr+0x86>
mov    0x2e42(%rip),%rbp
mov    0x0(%rbp),%edi
call   1050 <attron@plt>
mov    %r14,%rdi
call   1070 <addstr@plt>
mov    (%rsp),%rax
cmp    %rbx,%rax
jae    11d0 <mvaddselstr+0x70>
sub    %rax,%rbx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1060 <addch@plt>
add    $0xffffffffffffffff,%rbx
jne    11c0 <mvaddselstr+0x60>
mov    0x0(%rbp),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <attroff@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <addstr@plt>

LLVM IR (-O0):
@A_REVERSE = global i32 0
define void @mvaddselstr(i32 %0, i32 %1, i32 %2, i32 %3, i64 %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i64 %4, i64* %11
store i8* %5, i8** %12
%15 = load i8*, i8** %12
%16 = call i64 @strlen(i8* %15)
store i64 %16, i64* %14
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = call i32 @move(i32 %17, i32 %18)
%20 = load i32, i32* %10
%21 = load i32, i32* %9
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %6
%24 = load i32, i32* @A_REVERSE
%25 = call i32 @attron(i32 %24)
br label %26
26: ; preds = %23, %6
%27 = load i8*, i8** %12
%28 = call i32 @addstr(i8* %27)
%29 = load i32, i32* %10
%30 = load i32, i32* %9
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %46
32: ; preds = %26
%33 = load i64, i64* %14
store i64 %33, i64* %13
br label %34
34: ; preds = %40, %32
%35 = load i64, i64* %13
%36 = load i64, i64* %11
%37 = icmp ult i64 %35, %36
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = call i32 @addch(i8 signext 32)
br label %40
40: ; preds = %38
%41 = load i64, i64* %13
%42 = add i64 %41, 1
store i64 %42, i64* %13
br label %34
43: ; preds = %34
%44 = load i32, i32* @A_REVERSE
%45 = call i32 @attroff(i32 %44)
br label %46
46: ; preds = %43, %26
ret void
}

LLVM IR (-O2):
@A_REVERSE = global i32 0
define void @mvaddselstr(i32 %0, i32 %1, i32 %2, i32 %3, i64 %4, i8* %5) {
%7 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%8 = tail call i32 @move(i32 %0, i32 %1)
%9 = icmp eq i32 %3, %2
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = load i32, i32* @A_REVERSE
%12 = tail call i32 @attron(i32 %11)
%13 = tail call i32 @addstr(i8* %5)
%14 = icmp ult i64 %7, %4
br i1 %14, label %15, label %20
15: ; preds = %10, %15
%16 = phi i64 [ %18, %15 ], [ %7, %10 ]
%17 = tail call i32 @addch(i8 signext 32)
%18 = add i64 %16, 1
%19 = icmp eq i64 %18, %4
br i1 %19, label %20, label %15
20: ; preds = %15, %10
%21 = load i32, i32* @A_REVERSE
%22 = tail call i32 @attroff(i32 %21)
br label %25
23: ; preds = %6
%24 = tail call i32 @addstr(i8* %5)
br label %25
25: ; preds = %23, %20
ret void
}