#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_work(unsigned char **, unsigned char **, unsigned int,
                              unsigned char, unsigned int);
void plot4_palettized_clipped_work(unsigned char (*screen1)[2],
                                   unsigned char (*screen2)[2],
                                   unsigned output_surface_offset,
                                   unsigned char depth, unsigned pixels,
                                   unsigned palette_mask, unsigned clip_mask) {
  pixels &= clip_mask;
  if (!pixels)
    return;
  pixels &= palette_mask;
  plot4_work(screen1, screen2, output_surface_offset, depth, pixels);
}


x86 assembly (clang, -O0):
<plot4_palettized_clipped_work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
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    0x10(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    114b <plot4_palettized_clipped_work+0x3b>
jmp    116e <plot4_palettized_clipped_work+0x5e>
mov    -0x20(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x15(%rbp),%al
mov    -0x1c(%rbp),%r8d
movzbl %al,%ecx
call   1030 <plot4_work@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plot4_palettized_clipped_work>:
and    0x8(%rsp),%r8d
je     1122 <plot4_palettized_clipped_work+0x12>
and    %r9d,%r8d
movzbl %cl,%ecx
jmp    1030 <plot4_work@plt>
ret

LLVM IR (-O0):
define void @plot4_palettized_clipped_work([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca [2 x i8]*
%9 = alloca [2 x i8]*
%10 = alloca i32
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store [2 x i8]* %0, [2 x i8]** %8
store [2 x i8]* %1, [2 x i8]** %9
store i32 %2, i32* %10
store i8 %3, i8* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %14
%16 = load i32, i32* %12
%17 = and i32 %16, %15
store i32 %17, i32* %12
%18 = load i32, i32* %12
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %7
br label %33
21: ; preds = %7
%22 = load i32, i32* %13
%23 = load i32, i32* %12
%24 = and i32 %23, %22
store i32 %24, i32* %12
%25 = load [2 x i8]*, [2 x i8]** %8
%26 = bitcast [2 x i8]* %25 to i8**
%27 = load [2 x i8]*, [2 x i8]** %9
%28 = bitcast [2 x i8]* %27 to i8**
%29 = load i32, i32* %10
%30 = load i8, i8* %11
%31 = load i32, i32* %12
%32 = call i32 @plot4_work(i8** %26, i8** %28, i32 %29, i8 zeroext %30, i32 %31)
br label %33
33: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
define void @plot4_palettized_clipped_work([2 x i8]* %0, [2 x i8]* %1, i32 %2, i8 zeroext %3, i32 %4, i32 %5, i32 %6) {
%8 = and i32 %6, %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = and i32 %8, %5
%12 = bitcast [2 x i8]* %0 to i8**
%13 = bitcast [2 x i8]* %1 to i8**
%14 = tail call i32 @plot4_work(i8** %12, i8** %13, i32 %2, i8 zeroext %3, i32 %11)
br label %15
15: ; preds = %7, %10
ret void
}