#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*/ plot4_palettized_clipped(unsigned char **, unsigned char **,
                                            unsigned int, unsigned char,
                                            unsigned int, int, int, int,
                                            unsigned int, unsigned int,
                                            void const *);
void plot_palettized_line(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,
                          int xflip, unsigned line_count,
                          unsigned line_increment, unsigned palette_mask,
                          unsigned clip_left, unsigned clip_right,
                          const void *cache) {
  tile_address &= tileset_mask;
  tile_address += tileset_address;
  tile_address &= vram_mask;
  plot4_palettized_clipped(screen1, screen2, output_surface_offset, depth,
                           tile_address, xflip, 0, 4, palette_mask, clip_left,
                           cache);
  plot4_palettized_clipped(screen1, screen2, output_surface_offset + 4, depth,
                           tile_address, xflip, 4, 0, palette_mask, clip_right,
                           cache);
}


x86 assembly (clang, -O0):
<plot_palettized_line>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %cl,%al
mov    0x50(%rbp),%rcx
mov    0x48(%rbp),%ecx
mov    0x40(%rbp),%ecx
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,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x28(%rbp),%eax
and    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x10(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x18(%rbp),%eax
and    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x1d(%rbp),%cl
mov    -0x24(%rbp),%r8d
mov    0x20(%rbp),%r9d
mov    0x38(%rbp),%r11d
mov    0x40(%rbp),%r10d
mov    0x50(%rbp),%rax
xor    %ebx,%ebx
movzbl %cl,%ecx
movl   $0x0,(%rsp)
movl   $0x4,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <plot4_palettized_clipped@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x4,%edx
mov    -0x1d(%rbp),%cl
mov    -0x24(%rbp),%r8d
mov    0x20(%rbp),%r9d
mov    0x38(%rbp),%r11d
mov    0x48(%rbp),%r10d
mov    0x50(%rbp),%rax
xor    %ebx,%ebx
movzbl %cl,%ecx
movl   $0x4,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11d,0x10(%rsp)
mov    %r10d,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1030 <plot4_palettized_clipped@plt>
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot_palettized_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%r12
mov    %rdi,%r13
mov    0x50(%rsp),%eax
mov    0x68(%rsp),%r11d
mov    0x70(%rsp),%r10d
mov    0x80(%rsp),%r15
and    %r9d,%ebx
add    0x40(%rsp),%ebx
and    0x48(%rsp),%ebx
sub    $0x8,%rsp
mov    %ebx,%r8d
mov    %eax,%r9d
push   %r15
push   %r10
push   %r11
push   $0x4
push   $0x0
call   1030 <plot4_palettized_clipped@plt>
add    $0x30,%rsp
add    $0x4,%ebp
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %ebx,%r8d
mov    0x58(%rsp),%r9d
push   %r15
mov    0x88(%rsp),%eax
push   %rax
mov    0x80(%rsp),%eax
push   %rax
push   $0x0
push   $0x4
call   1030 <plot4_palettized_clipped@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @plot_palettized_line([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, i32 %12, i32 %13, i8* %14) {
%16 = alloca [2 x i8]*
%17 = alloca [2 x i8]*
%18 = alloca i32
%19 = alloca i8
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i8*
store [2 x i8]* %0, [2 x i8]** %16
store [2 x i8]* %1, [2 x i8]** %17
store i32 %2, i32* %18
store i8 %3, i8* %19
store i32 %4, i32* %20
store i32 %5, i32* %21
store i32 %6, i32* %22
store i32 %7, i32* %23
store i32 %8, i32* %24
store i32 %9, i32* %25
store i32 %10, i32* %26
store i32 %11, i32* %27
store i32 %12, i32* %28
store i32 %13, i32* %29
store i8* %14, i8** %30
%31 = load i32, i32* %21
%32 = load i32, i32* %20
%33 = and i32 %32, %31
store i32 %33, i32* %20
%34 = load i32, i32* %22
%35 = load i32, i32* %20
%36 = add i32 %35, %34
store i32 %36, i32* %20
%37 = load i32, i32* %23
%38 = load i32, i32* %20
%39 = and i32 %38, %37
store i32 %39, i32* %20
%40 = load [2 x i8]*, [2 x i8]** %16
%41 = bitcast [2 x i8]* %40 to i8**
%42 = load [2 x i8]*, [2 x i8]** %17
%43 = bitcast [2 x i8]* %42 to i8**
%44 = load i32, i32* %18
%45 = load i8, i8* %19
%46 = load i32, i32* %20
%47 = load i32, i32* %24
%48 = load i32, i32* %27
%49 = load i32, i32* %28
%50 = load i8*, i8** %30
%51 = call i32 @plot4_palettized_clipped(i8** %41, i8** %43, i32 %44, i8 zeroext %45, i32 %46, i32 %47, i32 0, i32 4, i32 %48, i32 %49, i8* %50)
%52 = load [2 x i8]*, [2 x i8]** %16
%53 = bitcast [2 x i8]* %52 to i8**
%54 = load [2 x i8]*, [2 x i8]** %17
%55 = bitcast [2 x i8]* %54 to i8**
%56 = load i32, i32* %18
%57 = add i32 %56, 4
%58 = load i8, i8* %19
%59 = load i32, i32* %20
%60 = load i32, i32* %24
%61 = load i32, i32* %27
%62 = load i32, i32* %29
%63 = load i8*, i8** %30
%64 = call i32 @plot4_palettized_clipped(i8** %53, i8** %55, i32 %57, i8 zeroext %58, i32 %59, i32 %60, i32 4, i32 0, i32 %61, i32 %62, i8* %63)
ret void
}

LLVM IR (-O2):
define void @plot_palettized_line([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, i32 %12, i32 %13, i8* %14) {
%16 = and i32 %5, %4
%17 = add i32 %16, %6
%18 = and i32 %17, %7
%19 = bitcast [2 x i8]* %0 to i8**
%20 = bitcast [2 x i8]* %1 to i8**
%21 = tail call i32 @plot4_palettized_clipped(i8** %19, i8** %20, i32 %2, i8 zeroext %3, i32 %18, i32 %8, i32 0, i32 4, i32 %11, i32 %12, i8* %14)
%22 = add i32 %2, 4
%23 = tail call i32 @plot4_palettized_clipped(i8** %19, i8** %20, i32 %22, i8 zeroext %3, i32 %18, i32 %8, i32 4, i32 0, i32 %11, i32 %13, i8* %14)
ret void
}