#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*/ st(unsigned char *, unsigned char, int);
void setanswerbright(unsigned char answer, char bright) {
  unsigned char xofs, yofs, v;
  switch (answer) {
  default:
  case 0:
    yofs = 15;
    xofs = 2;
    v = (((0) << 7) | ((0) << 6) | ((0) << 3) | (6));
    break;
  case 1:
    yofs = 15;
    xofs = 16;
    v = (((0) << 7) | ((0) << 6) | ((0) << 3) | (4));
    break;
  case 2:
    yofs = 19;
    xofs = 2;
    v = (((0) << 7) | ((0) << 6) | ((0) << 3) | (5));
    break;
  case 3:
    yofs = 19;
    xofs = 16;
    v = (((0) << 7) | ((0) << 6) | ((0) << 3) | (2));
    break;
  }
  if (bright) {
    v |= (((0) << 7) | ((1) << 6) | ((0) << 3) | (0));
  }
  if (bright < 0)
    v = 0;
  st((unsigned char *)0x5800 + yofs * 32 + xofs, v, 14);
  *((unsigned char *)0x5820 + yofs * 32 + xofs) = v;
  *((unsigned char *)0x582d + yofs * 32 + xofs) = v;
  *((unsigned char *)0x5840 + yofs * 32 + xofs) = v;
  *((unsigned char *)0x584d + yofs * 32 + xofs) = v;
  st((unsigned char *)0x5860 + yofs * 32 + xofs, v, 14);
}


x86 assembly (clang, -O0):
<setanswerbright>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     114a <setanswerbright+0x3a>
mov    -0x10(%rbp),%rax
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    114f <setanswerbright+0x3f>
movb   $0xf,-0x4(%rbp)
movb   $0x2,-0x3(%rbp)
movb   $0x6,-0x5(%rbp)
jmp    118e <setanswerbright+0x7e>
movb   $0xf,-0x4(%rbp)
movb   $0x10,-0x3(%rbp)
movb   $0x4,-0x5(%rbp)
jmp    118e <setanswerbright+0x7e>
movb   $0x13,-0x4(%rbp)
movb   $0x2,-0x3(%rbp)
movb   $0x5,-0x5(%rbp)
jmp    118e <setanswerbright+0x7e>
movb   $0x13,-0x4(%rbp)
movb   $0x10,-0x3(%rbp)
movb   $0x2,-0x5(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     11a2 <setanswerbright+0x92>
movzbl -0x5(%rbp),%eax
or     $0x40,%eax
mov    %al,-0x5(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x0,%eax
jge    11b3 <setanswerbright+0xa3>
movb   $0x0,-0x5(%rbp)
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
cltq
mov    $0x5800,%edi
add    %rax,%rdi
movzbl -0x3(%rbp),%eax
cltq
add    %rax,%rdi
mov    $0xe,%edx
movzbl -0x5(%rbp),%esi
call   1030 <st@plt>
mov    -0x5(%rbp),%dl
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
movslq %eax,%rcx
mov    $0x5820,%eax
add    %rcx,%rax
movzbl -0x3(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x5(%rbp),%dl
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
movslq %eax,%rcx
mov    $0x582d,%eax
add    %rcx,%rax
movzbl -0x3(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x5(%rbp),%dl
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
movslq %eax,%rcx
mov    $0x5840,%eax
add    %rcx,%rax
movzbl -0x3(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x5(%rbp),%dl
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
movslq %eax,%rcx
mov    $0x584d,%eax
add    %rcx,%rax
movzbl -0x3(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
movzbl -0x4(%rbp),%eax
shl    $0x5,%eax
cltq
mov    $0x5860,%edi
add    %rax,%rdi
movzbl -0x3(%rbp),%eax
cltq
add    %rax,%rdi
mov    $0xe,%edx
movzbl -0x5(%rbp),%esi
call   1030 <st@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setanswerbright>:
push   %r15
push   %r14
push   %rbx
add    $0xff,%dil
cmp    $0x2,%dil
ja     1149 <setanswerbright+0x39>
movsbq %dil,%rax
lea    0xed6(%rip),%rcx
mov    (%rcx,%rax,8),%r14
lea    0xee3(%rip),%rcx
mov    (%rcx,%rax,8),%r15
movzbl %dil,%ecx
shl    $0x3,%ecx
mov    $0x20504,%eax
shr    %cl,%eax
jmp    1157 <setanswerbright+0x47>
mov    $0x6,%al
mov    $0x1e0,%r15d
mov    $0x2,%r14d
movzbl %al,%ecx
or     $0x40,%al
movzbl %al,%eax
xor    %edx,%edx
test   %sil,%sil
cmove  %ecx,%eax
cmovs  %edx,%eax
lea    (%r15,%r14,1),%rdi
add    $0x5800,%rdi
movzbl %al,%ebx
mov    %ebx,%esi
mov    $0xe,%edx
call   1030 <st@plt>
mov    %bl,0x5820(%r15,%r14,1)
mov    %bl,0x582d(%r15,%r14,1)
mov    %bl,0x5840(%r15,%r14,1)
mov    %bl,0x584d(%r15,%r14,1)
lea    0x5860(%r15,%r14,1),%rdi
mov    %ebx,%esi
mov    $0xe,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <st@plt>

LLVM IR (-O0):
define void @setanswerbright(i8 zeroext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
switch i32 %9, label %10 [
i32 0, label %11
i32 1, label %12
i32 2, label %13
i32 3, label %14
]
10: ; preds = %2
br label %11
11: ; preds = %2, %10
store i8 15, i8* %6
store i8 2, i8* %5
store i8 6, i8* %7
br label %15
12: ; preds = %2
store i8 15, i8* %6
store i8 16, i8* %5
store i8 4, i8* %7
br label %15
13: ; preds = %2
store i8 19, i8* %6
store i8 2, i8* %5
store i8 5, i8* %7
br label %15
14: ; preds = %2
store i8 19, i8* %6
store i8 16, i8* %5
store i8 2, i8* %7
br label %15
15: ; preds = %14, %13, %12, %11
%16 = load i8, i8* %4
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = or i32 %20, 64
%22 = trunc i32 %21 to i8
store i8 %22, i8* %7
br label %23
23: ; preds = %18, %15
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i8 0, i8* %7
br label %28
28: ; preds = %27, %23
%29 = load i8, i8* %6
%30 = zext i8 %29 to i32
%31 = mul nsw i32 %30, 32
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* inttoptr (i64 22528 to i8*), i64 %32
%34 = load i8, i8* %5
%35 = zext i8 %34 to i32
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %33, i64 %36
%38 = load i8, i8* %7
%39 = call i32 @st(i8* %37, i8 zeroext %38, i32 14)
%40 = load i8, i8* %7
%41 = load i8, i8* %6
%42 = zext i8 %41 to i32
%43 = mul nsw i32 %42, 32
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* inttoptr (i64 22560 to i8*), i64 %44
%46 = load i8, i8* %5
%47 = zext i8 %46 to i32
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
store i8 %40, i8* %49
%50 = load i8, i8* %7
%51 = load i8, i8* %6
%52 = zext i8 %51 to i32
%53 = mul nsw i32 %52, 32
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* inttoptr (i64 22573 to i8*), i64 %54
%56 = load i8, i8* %5
%57 = zext i8 %56 to i32
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %55, i64 %58
store i8 %50, i8* %59
%60 = load i8, i8* %7
%61 = load i8, i8* %6
%62 = zext i8 %61 to i32
%63 = mul nsw i32 %62, 32
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* inttoptr (i64 22592 to i8*), i64 %64
%66 = load i8, i8* %5
%67 = zext i8 %66 to i32
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %65, i64 %68
store i8 %60, i8* %69
%70 = load i8, i8* %7
%71 = load i8, i8* %6
%72 = zext i8 %71 to i32
%73 = mul nsw i32 %72, 32
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* inttoptr (i64 22605 to i8*), i64 %74
%76 = load i8, i8* %5
%77 = zext i8 %76 to i32
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %75, i64 %78
store i8 %70, i8* %79
%80 = load i8, i8* %6
%81 = zext i8 %80 to i32
%82 = mul nsw i32 %81, 32
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* inttoptr (i64 22624 to i8*), i64 %83
%85 = load i8, i8* %5
%86 = zext i8 %85 to i32
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %84, i64 %87
%89 = load i8, i8* %7
%90 = call i32 @st(i8* %88, i8 zeroext %89, i32 14)
ret void
}

LLVM IR (-O2):
@switch.table.setanswerbright = [3 x i64] [i64 16, i64 2, i64 16]
@switch.table.setanswerbright.1 = [3 x i64] [i64 480, i64 608, i64 608]
define void @setanswerbright(i8 zeroext %0, i8 signext %1) {
%3 = add i8 %0, -1
%4 = icmp ult i8 %3, 3
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [3 x i64], [3 x i64]* @switch.table.setanswerbright, i64 0, i64 %6
%8 = load i64, i64* %7
%9 = sext i8 %3 to i64
%10 = getelementptr inbounds [3 x i64], [3 x i64]* @switch.table.setanswerbright.1, i64 0, i64 %9
%11 = load i64, i64* %10
%12 = zext i8 %3 to i24
%13 = shl nuw nsw i24 %12, 3
%14 = lshr i24 132356, %13
%15 = trunc i24 %14 to i8
br label %16
16: ; preds = %5, %2
%17 = phi i64 [ 2, %2 ], [ %8, %5 ]
%18 = phi i64 [ 480, %2 ], [ %11, %5 ]
%19 = phi i8 [ 6, %2 ], [ %15, %5 ]
%20 = icmp eq i8 %1, 0
%21 = or i8 %19, 64
%22 = select i1 %20, i8 %19, i8 %21
%23 = icmp slt i8 %1, 0
%24 = select i1 %23, i8 0, i8 %22
%25 = getelementptr inbounds i8, i8* inttoptr (i64 22528 to i8*), i64 %18
%26 = getelementptr inbounds i8, i8* %25, i64 %17
%27 = tail call i32 @st(i8* %26, i8 zeroext %24, i32 14)
%28 = getelementptr inbounds i8, i8* inttoptr (i64 22560 to i8*), i64 %18
%29 = getelementptr inbounds i8, i8* %28, i64 %17
store i8 %24, i8* %29
%30 = getelementptr inbounds i8, i8* inttoptr (i64 22573 to i8*), i64 %18
%31 = getelementptr inbounds i8, i8* %30, i64 %17
store i8 %24, i8* %31
%32 = getelementptr inbounds i8, i8* inttoptr (i64 22592 to i8*), i64 %18
%33 = getelementptr inbounds i8, i8* %32, i64 %17
store i8 %24, i8* %33
%34 = getelementptr inbounds i8, i8* inttoptr (i64 22605 to i8*), i64 %18
%35 = getelementptr inbounds i8, i8* %34, i64 %17
store i8 %24, i8* %35
%36 = getelementptr inbounds i8, i8* inttoptr (i64 22624 to i8*), i64 %18
%37 = getelementptr inbounds i8, i8* %36, i64 %17
%38 = tail call i32 @st(i8* %37, i8 zeroext %24, i32 14)
ret void
}