#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*/ printstr(char const *);
int /*<<< orphan*/ put_ch(char);
int /*<<< orphan*/ setattr_normal();
int /*<<< orphan*/ setattr_standout();
int strlen(char const *);
void printdropdownitem(const char *name, int sel, int w) {
  if (sel) {
    while (name[0] == ' ' && name[1] == ' ') {
      put_ch(' ');
      name++;
      w--;
    }
    setattr_normal();
  }
  printstr(name);
  if (strlen(name) < w)
    put_ch(' ');
  if (sel)
    setattr_standout();
}


x86 assembly (clang, -O0):
<printdropdownitem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11d2 <printdropdownitem+0x82>
jmp    1171 <printdropdownitem+0x21>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
jne    1197 <printdropdownitem+0x47>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11a7 <printdropdownitem+0x57>
jmp    11cb <printdropdownitem+0x7b>
mov    $0x20,%edi
call   1070 <put_ch@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1171 <printdropdownitem+0x21>
mov    $0x0,%al
call   1040 <setattr_normal@plt>
mov    -0x8(%rbp),%rdi
call   1050 <printstr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x10(%rbp),%eax
jge    11f7 <printdropdownitem+0xa7>
mov    $0x20,%edi
call   1070 <put_ch@plt>
cmpl   $0x0,-0xc(%rbp)
je     1208 <printdropdownitem+0xb8>
mov    $0x0,%al
call   1060 <setattr_standout@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printdropdownitem>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %esi,%r14d
mov    %rdi,%rbx
test   %esi,%esi
je     11a0 <printdropdownitem+0x50>
cmpb   $0x20,(%rbx)
jne    1193 <printdropdownitem+0x43>
nopl   0x0(%rax)
cmpb   $0x20,0x1(%rbx)
jne    1193 <printdropdownitem+0x43>
lea    0x1(%rbx),%rbp
mov    $0x20,%edi
call   1070 <put_ch@plt>
add    $0xffffffff,%r15d
cmpb   $0x20,0x1(%rbx)
mov    %rbp,%rbx
je     1170 <printdropdownitem+0x20>
jmp    1196 <printdropdownitem+0x46>
mov    %rbx,%rbp
xor    %eax,%eax
call   1040 <setattr_normal@plt>
mov    %rbp,%rbx
mov    %rbx,%rdi
call   1050 <printstr@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %r15d,%eax
jge    11bf <printdropdownitem+0x6f>
mov    $0x20,%edi
call   1070 <put_ch@plt>
test   %r14d,%r14d
je     11d5 <printdropdownitem+0x85>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <setattr_standout@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @printdropdownitem(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %32
9: ; preds = %3
br label %10
10: ; preds = %24, %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 32
br i1 %15, label %16, label %22
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 32
br label %22
22: ; preds = %16, %10
%23 = phi i1 [ false, %10 ], [ %21, %16 ]
br i1 %23, label %24, label %30
24: ; preds = %22
%25 = call i32 @put_ch(i8 signext 32)
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
%28 = load i32, i32* %6
%29 = add nsw i32 %28, -1
store i32 %29, i32* %6
br label %10
30: ; preds = %22
%31 = call i32 (...) @setattr_normal()
br label %32
32: ; preds = %30, %3
%33 = load i8*, i8** %4
%34 = call i32 @printstr(i8* %33)
%35 = load i8*, i8** %4
%36 = call i32 @strlen(i8* %35)
%37 = load i32, i32* %6
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = call i32 @put_ch(i8 signext 32)
br label %41
41: ; preds = %39, %32
%42 = load i32, i32* %5
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (...) @setattr_standout()
br label %46
46: ; preds = %44, %41
ret void
}

LLVM IR (-O2):
define void @printdropdownitem(i8* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %23, label %5
5: ; preds = %3
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 32
br i1 %7, label %8, label %19
8: ; preds = %5, %14
%9 = phi i32 [ %16, %14 ], [ %2, %5 ]
%10 = phi i8* [ %11, %14 ], [ %0, %5 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 32
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = tail call i32 @put_ch(i8 signext 32)
%16 = add nsw i32 %9, -1
%17 = load i8, i8* %11
%18 = icmp eq i8 %17, 32
br i1 %18, label %8, label %19
19: ; preds = %8, %14, %5
%20 = phi i8* [ %0, %5 ], [ %11, %14 ], [ %10, %8 ]
%21 = phi i32 [ %2, %5 ], [ %16, %14 ], [ %9, %8 ]
%22 = tail call i32 (...) @setattr_normal()
br label %23
23: ; preds = %19, %3
%24 = phi i8* [ %20, %19 ], [ %0, %3 ]
%25 = phi i32 [ %21, %19 ], [ %2, %3 ]
%26 = tail call i32 @printstr(i8* %24)
%27 = tail call i32 @strlen(i8* %24)
%28 = icmp slt i32 %27, %25
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = tail call i32 @put_ch(i8 signext 32)
br label %31
31: ; preds = %29, %23
br i1 %4, label %34, label %32
32: ; preds = %31
%33 = tail call i32 (...) @setattr_standout()
br label %34
34: ; preds = %32, %31
ret void
}