#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_BOLD;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ printw(char *, char *);
int field_menu(int priority, int field_set, char *fieldname) {
  int ret_val = 0;
  if (priority != 0) {
    if (priority == 1) {
      attron(A_BOLD);
      printw("%s ", fieldname);
      attroff(A_BOLD);
    } else
      printw("%s ", fieldname);
    if (field_set == 1)
      addch('*');
    ret_val = 1;
  }
  return (ret_val);
}


x86 assembly (clang, -O0):
<field_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     11c9 <field_menu+0x89>
cmpl   $0x1,-0x4(%rbp)
jne    119e <field_menu+0x5e>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1040 <attron@plt>
mov    -0x10(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1050 <printw@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
jmp    11ae <field_menu+0x6e>
mov    -0x10(%rbp),%rsi
lea    0xe57(%rip),%rdi
call   1050 <printw@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11c2 <field_menu+0x82>
mov    $0x2a,%edi
call   1060 <addch@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<field_menu>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
test   %edi,%edi
je     11a1 <field_menu+0x61>
mov    %rdx,%rbx
mov    %esi,%r14d
cmp    $0x1,%ebp
jne    117d <field_menu+0x3d>
mov    0x2e84(%rip),%rbp
mov    0x0(%rbp),%edi
call   1040 <attron@plt>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printw@plt>
mov    0x0(%rbp),%edi
call   1030 <attroff@plt>
jmp    118c <field_menu+0x4c>
lea    0xe7c(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printw@plt>
mov    $0x1,%ebp
cmp    $0x1,%r14d
jne    11a1 <field_menu+0x61>
mov    $0x2a,%edi
call   1060 <addch@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@A_BOLD = global i32 0
@.str = [4 x i8] c"%s \00"
define i32 @field_menu(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* @A_BOLD
%15 = call i32 @attron(i32 %14)
%16 = load i8*, i8** %6
%17 = call i32 @printw(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @A_BOLD
%19 = call i32 @attroff(i32 %18)
br label %23
20: ; preds = %10
%21 = load i8*, i8** %6
%22 = call i32 @printw(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %13
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @addch(i8 signext 42)
br label %28
28: ; preds = %26, %23
store i32 1, i32* %7
br label %29
29: ; preds = %28, %3
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
@A_BOLD = global i32 0
@.str = [4 x i8] c"%s \00"
define i32 @field_menu(i32 %0, i32 %1, i8* %2) {
switch i32 %0, label %10 [
i32 0, label %16
i32 1, label %4
]
4: ; preds = %3
%5 = load i32, i32* @A_BOLD
%6 = tail call i32 @attron(i32 %5)
%7 = tail call i32 @printw(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = load i32, i32* @A_BOLD
%9 = tail call i32 @attroff(i32 %8)
br label %12
10: ; preds = %3
%11 = tail call i32 @printw(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %12
12: ; preds = %10, %4
%13 = icmp eq i32 %1, 1
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = tail call i32 @addch(i8 signext 42)
br label %16
16: ; preds = %12, %14, %3
%17 = phi i32 [ %0, %3 ], [ 1, %14 ], [ 1, %12 ]
ret i32 %17
}