#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*/ plot_mosaic_work(unsigned char **, unsigned char **,
                                    unsigned int, unsigned char, unsigned char,
                                    int);
void plot_palettized_even_mosaic(unsigned char (*screen1)[2],
                                 unsigned char (*screen2)[2],
                                 unsigned output_surface_offset,
                                 unsigned char depth, unsigned tile_address,
                                 int pixel_in_tile, int pixel_count,
                                 unsigned palette_mask, const void *cache) {
  unsigned char pixel;
  pixel = *((unsigned char *)cache + tile_address * 8 + pixel_in_tile * 2);
  pixel &= palette_mask;
  plot_mosaic_work(screen1, screen2, output_surface_offset, depth, pixel,
                   pixel_count);
}


x86 assembly (clang, -O0):
<plot_palettized_even_mosaic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %cl,%al
mov    0x20(%rbp),%rcx
mov    0x18(%rbp),%ecx
mov    0x10(%rbp),%ecx
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    0x20(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
add    %rcx,%rax
mov    -0x20(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
mov    0x18(%rbp),%ecx
movzbl -0x21(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x21(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x15(%rbp),%cl
mov    -0x21(%rbp),%al
mov    0x10(%rbp),%r9d
movzbl %cl,%ecx
movzbl %al,%r8d
call   1030 <plot_mosaic_work@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot_palettized_even_mosaic>:
mov    0x8(%rsp),%r10d
shl    $0x3,%r8d
add    0x18(%rsp),%r8
movslq %r9d,%rax
mov    (%r8,%rax,2),%al
and    0x10(%rsp),%al
movzbl %al,%r8d
mov    %r10d,%r9d
jmp    1030 <plot_mosaic_work@plt>

LLVM IR (-O0):
define void @plot_palettized_even_mosaic([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* %8) {
%10 = alloca [2 x i8]*
%11 = alloca [2 x i8]*
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8
store [2 x i8]* %0, [2 x i8]** %10
store [2 x i8]* %1, [2 x i8]** %11
store i32 %2, i32* %12
store i8 %3, i8* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i8* %8, i8** %18
%20 = load i8*, i8** %18
%21 = load i32, i32* %14
%22 = mul i32 %21, 8
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i32, i32* %15
%26 = mul nsw i32 %25, 2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %24, i64 %27
%29 = load i8, i8* %28
store i8 %29, i8* %19
%30 = load i32, i32* %17
%31 = load i8, i8* %19
%32 = zext i8 %31 to i32
%33 = and i32 %32, %30
%34 = trunc i32 %33 to i8
store i8 %34, i8* %19
%35 = load [2 x i8]*, [2 x i8]** %10
%36 = bitcast [2 x i8]* %35 to i8**
%37 = load [2 x i8]*, [2 x i8]** %11
%38 = bitcast [2 x i8]* %37 to i8**
%39 = load i32, i32* %12
%40 = load i8, i8* %13
%41 = load i8, i8* %19
%42 = load i32, i32* %16
%43 = call i32 @plot_mosaic_work(i8** %36, i8** %38, i32 %39, i8 zeroext %40, i8 zeroext %41, i32 %42)
ret void
}

LLVM IR (-O2):
define void @plot_palettized_even_mosaic([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* nocapture %8) {
%10 = shl i32 %4, 3
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = shl nsw i32 %5, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = trunc i32 %7 to i8
%18 = and i8 %16, %17
%19 = bitcast [2 x i8]* %0 to i8**
%20 = bitcast [2 x i8]* %1 to i8**
%21 = tail call i32 @plot_mosaic_work(i8** %19, i8** %20, i32 %2, i8 zeroext %3, i8 zeroext %18, i32 %6)
ret void
}