#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:
  case DirectColor:
    return True;
  case StaticGray:
  case TrueColor:
  case StaticColor:
    return False;
  default:
    abort();
    return False;
  }
}


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     117c <has_writable_cells+0x5c>
jmp    1155 <has_writable_cells+0x35>
mov    -0x1c(%rbp),%eax
add    $0xffffff7d,%eax
sub    $0x2,%eax
ja     118d <has_writable_cells+0x6d>
jmp    116b <has_writable_cells+0x4b>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <has_writable_cells+0x74>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <has_writable_cells+0x74>
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 133, label %9
i32 129, label %11
i32 128, label %11
i32 130, label %11
]
9: ; preds = %2, %2, %2
%10 = load i32, i32* @True
store i32 %10, i32* %3
br label %15
11: ; preds = %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* @True]
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
}