#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_palettized_run_mosaic(unsigned char **,
                                              unsigned char **, unsigned int,
                                              unsigned char, unsigned int,
                                              scalar_t__, int /*<<< orphan*/,
                                              scalar_t__, int, int, int,
                                              unsigned int, void const *);
void plot_palettized_runs_mosaic(
    unsigned char (*screen1)[2], unsigned char (*screen2)[2],
    unsigned output_surface_offset, unsigned char depth, unsigned tile_address,
    unsigned tileset_mask, unsigned tileset_address, unsigned vram_mask,
    unsigned line_count, int pixel_in_tile, int pixel_count,
    unsigned palette_mask, const void *cache) {
  tile_address &= tileset_mask;
  tile_address += tileset_address;
  tile_address &= vram_mask;
  do {
    plot_palettized_run_mosaic(screen1, screen2, output_surface_offset, depth,
                               tile_address, (0 - 1), 0, (0 - 1), 1,
                               pixel_in_tile, pixel_count, palette_mask, cache);
  } while (output_surface_offset += 256, --line_count);
}


x86 assembly (clang, -O0):
<plot_palettized_runs_mosaic>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %cl,%al
mov    0x40(%rbp),%rcx
mov    0x38(%rbp),%ecx
mov    0x30(%rbp),%ecx
mov    0x28(%rbp),%ecx
mov    0x20(%rbp),%ecx
mov    0x18(%rbp),%ecx
mov    0x10(%rbp),%ecx
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %al,-0x25(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
mov    -0x30(%rbp),%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x10(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x18(%rbp),%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x25(%rbp),%cl
mov    -0x2c(%rbp),%r8d
mov    0x28(%rbp),%ebx
mov    0x30(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x40(%rbp),%rax
mov    $0xffffffffffffffff,%r9
xor    %r14d,%r14d
movzbl %cl,%ecx
movl   $0x0,(%rsp)
movq   $0xffffffffffffffff,0x8(%rsp)
ff ff
movl   $0x1,0x10(%rsp)
mov    %ebx,0x18(%rsp)
mov    %r11d,0x20(%rsp)
mov    %r10d,0x28(%rsp)
mov    %rax,0x30(%rsp)
call   1030 <plot_palettized_run_mosaic@plt>
mov    -0x24(%rbp),%eax
add    $0x100,%eax
mov    %eax,-0x24(%rbp)
mov    0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,0x20(%rbp)
cmp    $0x0,%eax
jne    1164 <plot_palettized_runs_mosaic+0x54>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot_palettized_runs_mosaic>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
and    %r9d,%r12d
add    0x40(%rsp),%r12d
mov    0x50(%rsp),%r13d
and    0x48(%rsp),%r12d
movzbl %cl,%ebx
nopl   0x0(%rax,%rax,1)
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r12d,%r8d
mov    $0xffffffffffffffff,%r9
push   0x78(%rsp)
mov    0x78(%rsp),%eax
push   %rax
mov    0x78(%rsp),%eax
push   %rax
mov    0x78(%rsp),%eax
push   %rax
push   $0x1
push   $0xffffffffffffffff
push   $0x0
call   1030 <plot_palettized_run_mosaic@plt>
add    $0x40,%rsp
add    $0x100,%ebp
add    $0xffffffff,%r13d
jne    1140 <plot_palettized_runs_mosaic+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @plot_palettized_runs_mosaic([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i8* %12) {
%14 = alloca [2 x i8]*
%15 = alloca [2 x i8]*
%16 = alloca i32
%17 = alloca i8
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i8*
store [2 x i8]* %0, [2 x i8]** %14
store [2 x i8]* %1, [2 x i8]** %15
store i32 %2, i32* %16
store i8 %3, i8* %17
store i32 %4, i32* %18
store i32 %5, i32* %19
store i32 %6, i32* %20
store i32 %7, i32* %21
store i32 %8, i32* %22
store i32 %9, i32* %23
store i32 %10, i32* %24
store i32 %11, i32* %25
store i8* %12, i8** %26
%27 = load i32, i32* %19
%28 = load i32, i32* %18
%29 = and i32 %28, %27
store i32 %29, i32* %18
%30 = load i32, i32* %20
%31 = load i32, i32* %18
%32 = add i32 %31, %30
store i32 %32, i32* %18
%33 = load i32, i32* %21
%34 = load i32, i32* %18
%35 = and i32 %34, %33
store i32 %35, i32* %18
br label %36
36: ; preds = %49, %13
%37 = load [2 x i8]*, [2 x i8]** %14
%38 = bitcast [2 x i8]* %37 to i8**
%39 = load [2 x i8]*, [2 x i8]** %15
%40 = bitcast [2 x i8]* %39 to i8**
%41 = load i32, i32* %16
%42 = load i8, i8* %17
%43 = load i32, i32* %18
%44 = load i32, i32* %23
%45 = load i32, i32* %24
%46 = load i32, i32* %25
%47 = load i8*, i8** %26
%48 = call i32 @plot_palettized_run_mosaic(i8** %38, i8** %40, i32 %41, i8 zeroext %42, i32 %43, i64 -1, i32 0, i64 -1, i32 1, i32 %44, i32 %45, i32 %46, i8* %47)
br label %49
49: ; preds = %36
%50 = load i32, i32* %16
%51 = add i32 %50, 256
store i32 %51, i32* %16
%52 = load i32, i32* %22
%53 = add i32 %52, -1
store i32 %53, i32* %22
%54 = icmp ne i32 %53, 0
br i1 %54, label %36, label %55
55: ; preds = %49
ret void
}

LLVM IR (-O2):
define void @plot_palettized_runs_mosaic([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i8* %12) {
%14 = and i32 %5, %4
%15 = add i32 %14, %6
%16 = and i32 %15, %7
%17 = bitcast [2 x i8]* %0 to i8**
%18 = bitcast [2 x i8]* %1 to i8**
br label %19
19: ; preds = %19, %13
%20 = phi i32 [ %8, %13 ], [ %24, %19 ]
%21 = phi i32 [ %2, %13 ], [ %23, %19 ]
%22 = tail call i32 @plot_palettized_run_mosaic(i8** %17, i8** %18, i32 %21, i8 zeroext %3, i32 %16, i64 -1, i32 0, i64 -1, i32 1, i32 %9, i32 %10, i32 %11, i8* %12)
%23 = add i32 %21, 256
%24 = add i32 %20, -1
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %19
26: ; preds = %19
ret void
}