#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 /*<<< orphan*/ Visual;
typedef int /*<<< orphan*/ Screen;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
#define DirectColor 133
int /*<<< orphan*/ False;
#define GrayScale 132
#define PseudoColor 131
#define StaticColor 130
#define StaticGray 129
int /*<<< orphan*/ True;
#define TrueColor 128
int /*<<< orphan*/ abort();
int visual_class(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
Bool has_writable_cells(Screen *screen, Visual *visual) {
  switch (visual_class(screen, visual)) {
  case GrayScale:
  case PseudoColor:
    return True;
  case StaticGray:
  case TrueColor:
  case StaticColor:
  case DirectColor:
    return False;
  default:
    abort();
  }
}


x86 assembly (clang, -O0):
<has_writable_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <visual_class@plt>
mov    %eax,%ecx
mov    %ecx,%eax
add    $0xffffff80,%eax
mov    %ecx,-0x1c(%rbp)
sub    $0x3,%eax
jb     118f <has_writable_cells+0x6f>
jmp    1155 <has_writable_cells+0x35>
mov    -0x1c(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x2,%eax
jb     117e <has_writable_cells+0x5e>
jmp    116b <has_writable_cells+0x4b>
mov    -0x1c(%rbp),%eax
sub    $0x85,%eax
je     118f <has_writable_cells+0x6f>
jmp    11a0 <has_writable_cells+0x80>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11a7 <has_writable_cells+0x87>
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11a7 <has_writable_cells+0x87>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_writable_cells>:
push   %rax
call   1040 <visual_class@plt>
add    $0xffffff80,%eax
cmp    $0x6,%eax
jae    113f <has_writable_cells+0x1f>
cltq
lea    0x2cb9(%rip),%rcx
mov    (%rcx,%rax,8),%rax
mov    (%rax),%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@True = global i32 0
@False = global i32 0
define i32 @has_writable_cells(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %4
%7 = load i32*, i32** %5
%8 = call i32 @visual_class(i32* %6, i32* %7)
switch i32 %8, label %13 [
i32 132, label %9
i32 131, label %9
i32 129, label %11
i32 128, label %11
i32 130, label %11
i32 133, label %11
]
9: ; preds = %2, %2
%10 = load i32, i32* @True
store i32 %10, i32* %3
br label %15
11: ; preds = %2, %2, %2, %2
%12 = load i32, i32* @False
store i32 %12, i32* %3
br label %15
13: ; preds = %2
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %11, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@True = global i32 0
@False = global i32 0
@switch.table.has_writable_cells = [6 x i32*] [i32* @False, i32* @False, i32* @False, i32* @True, i32* @True, i32* @False]
define i32 @has_writable_cells(i32* %0, i32* %1) {
%3 = tail call i32 @visual_class(i32* %0, i32* %1)
%4 = add i32 %3, -128
%5 = icmp ult i32 %4, 6
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %2
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds [6 x i32*], [6 x i32*]* @switch.table.has_writable_cells, i64 0, i64 %9
%11 = load i32*, i32** %10
%12 = load i32, i32* %11
ret i32 %12
}