#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_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);
  plot_mosaic_work(screen1, screen2, output_surface_offset, depth, pixel,
                   pixel_count);
}


x86 assembly (clang, -O0):
<plot_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
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
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_mosaic>:
mov    0x8(%rsp),%r10d
shl    $0x3,%r8d
add    0x18(%rsp),%r8
movslq %r9d,%rax
movzbl (%rax,%r8,1),%r8d
mov    %r10d,%r9d
jmp    1030 <plot_mosaic_work@plt>

LLVM IR (-O0):
define void @plot_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 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
store i8 %28, i8* %19
%29 = load [2 x i8]*, [2 x i8]** %10
%30 = bitcast [2 x i8]* %29 to i8**
%31 = load [2 x i8]*, [2 x i8]** %11
%32 = bitcast [2 x i8]* %31 to i8**
%33 = load i32, i32* %12
%34 = load i8, i8* %13
%35 = load i8, i8* %19
%36 = load i32, i32* %16
%37 = call i32 @plot_mosaic_work(i8** %30, i8** %32, i32 %33, i8 zeroext %34, i8 zeroext %35, i32 %36)
ret void
}

LLVM IR (-O2):
define void @plot_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 = sext i32 %5 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = bitcast [2 x i8]* %0 to i8**
%17 = bitcast [2 x i8]* %1 to i8**
%18 = tail call i32 @plot_mosaic_work(i8** %16, i8** %17, i32 %2, i8 zeroext %3, i8 zeroext %15, i32 %6)
ret void
}