#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *);
void cli_updateDesiredState(uint8_t desiredState) {
  if (desiredState == (1 << 1)) {
    attron(COLOR_PAIR(3));
    move(8, 15);
    printw("LOCKED  ");
    attroff(COLOR_PAIR(3));
  }
  if (desiredState == (1 << 2)) {
    attron(COLOR_PAIR(1));
    move(8, 15);
    printw("UNLOCKED");
    attroff(COLOR_PAIR(1));
  }
}


x86 assembly (clang, -O0):
<cli_updateDesiredState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    11a2 <cli_updateDesiredState+0x52>
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    $0x8,%edi
mov    $0xf,%esi
call   1070 <move@plt>
lea    0xe74(%rip),%rdi
call   1050 <printw@plt>
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
cmpl   $0x4,-0x4(%rbp)
jne    11e9 <cli_updateDesiredState+0x99>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    $0x8,%edi
mov    $0xf,%esi
call   1070 <move@plt>
lea    0xe36(%rip),%rdi
call   1050 <printw@plt>
mov    $0x1,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_updateDesiredState>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
je     116c <cli_updateDesiredState+0x1c>
cmp    $0x4,%edi
jne    11b2 <cli_updateDesiredState+0x62>
lea    0xea4(%rip),%r14
mov    $0x1,%ebx
jmp    1178 <cli_updateDesiredState+0x28>
lea    0xe8d(%rip),%r14
mov    $0x3,%ebx
mov    %ebx,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1040 <attron@plt>
mov    $0x8,%edi
mov    $0xf,%esi
call   1070 <move@plt>
mov    %r14,%rdi
call   1050 <printw@plt>
mov    %ebx,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <attroff@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"LOCKED \00"
@.str.1 = [9 x i8] c"UNLOCKED\00"
define void @cli_updateDesiredState(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 2
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = call i32 @COLOR_PAIR(i32 3)
%7 = call i32 @attron(i32 %6)
%8 = call i32 @move(i32 8, i32 15)
%9 = call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @COLOR_PAIR(i32 3)
%11 = call i32 @attroff(i32 %10)
br label %12
12: ; preds = %5, %1
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = call i32 @COLOR_PAIR(i32 1)
%17 = call i32 @attron(i32 %16)
%18 = call i32 @move(i32 8, i32 15)
%19 = call i32 @printw(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @COLOR_PAIR(i32 1)
%21 = call i32 @attroff(i32 %20)
br label %22
22: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"LOCKED \00"
@.str.1 = [9 x i8] c"UNLOCKED\00"
define void @cli_updateDesiredState(i32 %0) {
switch i32 %0, label %12 [
i32 2, label %3
i32 4, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 1, %2 ], [ 3, %1 ]
%5 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %1 ]
%6 = tail call i32 @COLOR_PAIR(i32 %4)
%7 = tail call i32 @attron(i32 %6)
%8 = tail call i32 @move(i32 8, i32 15)
%9 = tail call i32 @printw(i8* %5)
%10 = tail call i32 @COLOR_PAIR(i32 %4)
%11 = tail call i32 @attroff(i32 %10)
br label %12
12: ; preds = %3, %1
ret void
}