#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*/ DRM_DEBUG(char *, char const *, unsigned int, char *, char *,
                             char *, char *, char *, char *, char *, char *,
                             char *, char *, char *, char *);
void mach64_print_dirty(const char *msg, unsigned int flags) {
  DRM_DEBUG("%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\n", msg, flags,
            (flags & 0x0001) ? "dst_off_pitch, " : "",
            (flags & 0x0004) ? "z_alpha_cntl, " : "",
            (flags & 0x0008) ? "scale_3d_cntl, " : "",
            (flags & 0x0010) ? "dp_fog_clr, " : "",
            (flags & 0x0020) ? "dp_write_mask, " : "",
            (flags & 0x0040) ? "dp_pix_width, " : "",
            (flags & 0x0080) ? "setup_cntl, " : "",
            (flags & 0x0100) ? "misc, " : "",
            (flags & 0x0200) ? "texture, " : "",
            (flags & 0x0400) ? "tex0 image, " : "",
            (flags & 0x0800) ? "tex1 image, " : "",
            (flags & 0x1000) ? "cliprects, " : "");
}


x86 assembly (clang, -O0):
<mach64_print_dirty>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,-0x30(%rbp)
mov    %esi,-0x34(%rbp)
mov    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
mov    -0x34(%rbp),%edi
and    $0x1,%edi
lea    0xee8(%rip),%rcx
lea    0xee2(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
mov    -0x34(%rbp),%edi
and    $0x4,%edi
lea    0xecd(%rip),%r8
lea    0xed7(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r8
mov    -0x34(%rbp),%edi
and    $0x8,%edi
lea    0xeb2(%rip),%r9
lea    0xecb(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r9
mov    -0x34(%rbp),%r10d
and    $0x10,%r10d
lea    0xe95(%rip),%rax
lea    0xebe(%rip),%rdi
cmp    $0x0,%r10d
cmovne %rdi,%rax
mov    %rax,-0x48(%rbp)
mov    -0x34(%rbp),%edi
and    $0x20,%edi
lea    0xe75(%rip),%r13
lea    0xeab(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r13
mov    -0x34(%rbp),%edi
and    $0x40,%edi
lea    0xe5a(%rip),%r12
lea    0xea0(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r12
mov    -0x34(%rbp),%edi
and    $0x80,%edi
lea    0xe3c(%rip),%r15
lea    0xe91(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r15
mov    -0x34(%rbp),%edi
and    $0x100,%edi
lea    0xe1e(%rip),%r14
lea    0xe80(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r14
mov    -0x34(%rbp),%edi
and    $0x200,%edi
lea    0xe00(%rip),%rbx
lea    0xe69(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rbx
mov    -0x34(%rbp),%edi
and    $0x400,%edi
lea    0xde2(%rip),%r11
lea    0xe55(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r11
mov    -0x34(%rbp),%edi
and    $0x800,%edi
lea    0xdc4(%rip),%r10
lea    0xe44(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%r10
mov    -0x34(%rbp),%eax
and    $0x1000,%eax
mov    %eax,-0x54(%rbp)
lea    0xda4(%rip),%rdi
lea    0xe31(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x54(%rbp),%eax
cmp    $0x0,%eax
mov    -0x50(%rbp),%rax
cmovne %rax,%rdi
mov    -0x48(%rbp),%rax
mov    %rdi,-0x40(%rbp)
lea    0xd58(%rip),%rdi
mov    %rax,(%rsp)
mov    -0x40(%rbp),%rax
mov    %r13,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r15,0x18(%rsp)
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
mov    %r11,0x30(%rsp)
mov    %r10,0x38(%rsp)
mov    %rax,0x40(%rsp)
call   1030 <DRM_DEBUG@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<mach64_print_dirty>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
test   $0x1,%dl
lea    0xf1a(%rip),%rdi
lea    0xf14(%rip),%rcx
cmove  %rdi,%rcx
test   $0x4,%dl
lea    0xf16(%rip),%r8
cmove  %rdi,%r8
test   $0x8,%dl
lea    0xf17(%rip),%r9
cmove  %rdi,%r9
test   $0x10,%dl
lea    0xf19(%rip),%r10
cmove  %rdi,%r10
movd   %edx,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0xe90(%rip),%xmm1
pand   %xmm0,%xmm1
pand   0xe94(%rip),%xmm0
pxor   %xmm2,%xmm2
pcmpeqd %xmm2,%xmm0
pcmpeqd %xmm2,%xmm1
packssdw %xmm0,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%ebp
lea    0xee6(%rip),%r11
test   $0x80,%bpl
cmovne %rdi,%r11
lea    0xee7(%rip),%r14
test   $0x40,%bpl
cmovne %rdi,%r14
lea    0xee7(%rip),%r15
test   $0x20,%bpl
cmovne %rdi,%r15
lea    0xee5(%rip),%r12
test   $0x10,%bpl
cmovne %rdi,%r12
lea    0xedd(%rip),%r13
test   $0x8,%bpl
cmovne %rdi,%r13
lea    0xed8(%rip),%rax
test   $0x4,%bpl
cmovne %rdi,%rax
lea    0xed6(%rip),%rbx
test   $0x2,%bpl
cmovne %rdi,%rbx
test   $0x1,%bpl
lea    0xed0(%rip),%rbp
cmovne %rdi,%rbp
sub    $0x8,%rsp
lea    0xe09(%rip),%rdi
push   %rbp
push   %rbx
push   %rax
push   %r13
push   %r12
push   %r15
push   %r14
push   %r11
push   %r10
call   1030 <DRM_DEBUG@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\0A\00"
@.str.1 = [16 x i8] c"dst_off_pitch, \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [15 x i8] c"z_alpha_cntl, \00"
@.str.4 = [16 x i8] c"scale_3d_cntl, \00"
@.str.5 = [13 x i8] c"dp_fog_clr, \00"
@.str.6 = [16 x i8] c"dp_write_mask, \00"
@.str.7 = [15 x i8] c"dp_pix_width, \00"
@.str.8 = [13 x i8] c"setup_cntl, \00"
@.str.9 = [7 x i8] c"misc, \00"
@.str.10 = [10 x i8] c"texture, \00"
@.str.11 = [13 x i8] c"tex0 image, \00"
@.str.12 = [13 x i8] c"tex1 image, \00"
@.str.13 = [12 x i8] c"cliprects, \00"
define void @mach64_print_dirty(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%12 = load i32, i32* %4
%13 = and i32 %12, 4
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%17 = load i32, i32* %4
%18 = and i32 %17, 8
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%22 = load i32, i32* %4
%23 = and i32 %22, 16
%24 = icmp ne i32 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%27 = load i32, i32* %4
%28 = and i32 %27, 32
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%32 = load i32, i32* %4
%33 = and i32 %32, 64
%34 = icmp ne i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%37 = load i32, i32* %4
%38 = and i32 %37, 128
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%42 = load i32, i32* %4
%43 = and i32 %42, 256
%44 = icmp ne i32 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%47 = load i32, i32* %4
%48 = and i32 %47, 512
%49 = icmp ne i32 %48, 0
%50 = zext i1 %49 to i64
%51 = select i1 %49, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%52 = load i32, i32* %4
%53 = and i32 %52, 1024
%54 = icmp ne i32 %53, 0
%55 = zext i1 %54 to i64
%56 = select i1 %54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%57 = load i32, i32* %4
%58 = and i32 %57, 2048
%59 = icmp ne i32 %58, 0
%60 = zext i1 %59 to i64
%61 = select i1 %59, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%62 = load i32, i32* %4
%63 = and i32 %62, 4096
%64 = icmp ne i32 %63, 0
%65 = zext i1 %64 to i64
%66 = select i1 %64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%67 = call i32 @DRM_DEBUG(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6, i8* %11, i8* %16, i8* %21, i8* %26, i8* %31, i8* %36, i8* %41, i8* %46, i8* %51, i8* %56, i8* %61, i8* %66)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s\0A\00"
@.str.1 = [16 x i8] c"dst_off_pitch, \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [15 x i8] c"z_alpha_cntl, \00"
@.str.4 = [16 x i8] c"scale_3d_cntl, \00"
@.str.5 = [13 x i8] c"dp_fog_clr, \00"
@.str.6 = [16 x i8] c"dp_write_mask, \00"
@.str.7 = [15 x i8] c"dp_pix_width, \00"
@.str.8 = [13 x i8] c"setup_cntl, \00"
@.str.9 = [7 x i8] c"misc, \00"
@.str.10 = [10 x i8] c"texture, \00"
@.str.11 = [13 x i8] c"tex0 image, \00"
@.str.12 = [13 x i8] c"tex1 image, \00"
@.str.13 = [12 x i8] c"cliprects, \00"
define void @mach64_print_dirty(i8* %0, i32 %1) {
%3 = and i32 %1, 1
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%6 = and i32 %1, 4
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0)
%9 = and i32 %1, 8
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0)
%12 = and i32 %1, 16
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0)
%15 = insertelement <8 x i32> poison, i32 %1, i64 0
%16 = shufflevector <8 x i32> %15, <8 x i32> poison, <8 x i32> zeroinitializer
%17 = and <8 x i32> %16, <i32 4096, i32 2048, i32 1024, i32 512, i32 256, i32 128, i32 64, i32 32>
%18 = icmp eq <8 x i32> %17, zeroinitializer
%19 = extractelement <8 x i1> %18, i64 7
%20 = select i1 %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0)
%21 = extractelement <8 x i1> %18, i64 6
%22 = select i1 %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0)
%23 = extractelement <8 x i1> %18, i64 5
%24 = select i1 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0)
%25 = extractelement <8 x i1> %18, i64 4
%26 = select i1 %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0)
%27 = extractelement <8 x i1> %18, i64 3
%28 = select i1 %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0)
%29 = extractelement <8 x i1> %18, i64 2
%30 = select i1 %29, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0)
%31 = extractelement <8 x i1> %18, i64 1
%32 = select i1 %31, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0)
%33 = extractelement <8 x i1> %18, i64 0
%34 = select i1 %33, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.13, i64 0, i64 0)
%35 = tail call i32 @DRM_DEBUG(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %5, i8* %8, i8* %11, i8* %14, i8* %20, i8* %22, i8* %24, i8* %26, i8* %28, i8* %30, i8* %32, i8* %34)
ret void
}