#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 */
unsigned char DeFullbright(unsigned char);
void DeFullbrightPixels(unsigned char *data, const int count,
                        const bool preserve_255) {
  for (int p = 0; p < count; p++) {
    if (!preserve_255 || data[p] != 255)
      data[p] = DeFullbright(data[p]);
  }
}


x86 assembly (clang, -O0):
<DeFullbrightPixels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1187 <DeFullbrightPixels+0x77>
cmpl   $0x0,-0x10(%rbp)
je     1156 <DeFullbrightPixels+0x46>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0xff,%eax
je     1174 <DeFullbrightPixels+0x64>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <DeFullbright@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1179 <DeFullbrightPixels+0x69>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <DeFullbrightPixels+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DeFullbrightPixels>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1153 <DeFullbrightPixels+0x43>
mov    %edx,%r14d
mov    %rdi,%rbx
mov    %esi,%r15d
xor    %ebp,%ebp
jmp    1144 <DeFullbrightPixels+0x34>
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <DeFullbright@plt>
mov    %al,(%rbx,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%r15
je     1153 <DeFullbrightPixels+0x43>
movzbl (%rbx,%rbp,1),%eax
test   %r14d,%r14d
je     1130 <DeFullbrightPixels+0x20>
cmp    $0xff,%al
je     113b <DeFullbrightPixels+0x2b>
jmp    1130 <DeFullbrightPixels+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @DeFullbrightPixels(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %35, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %5
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %38
12: ; preds = %8
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = icmp ne i32 %21, 255
br i1 %22, label %23, label %34
23: ; preds = %15, %12
%24 = load i8*, i8** %4
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = call zeroext i8 @DeFullbright(i8 zeroext %28)
%30 = load i8*, i8** %4
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 %29, i8* %33
br label %34
34: ; preds = %23, %15
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %8
38: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @DeFullbrightPixels(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = icmp ne i32 %2, 0
%7 = zext i32 %1 to i64
br label %9
8: ; preds = %18, %3
ret void
9: ; preds = %5, %18
%10 = phi i64 [ 0, %5 ], [ %19, %18 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, -1
%14 = select i1 %6, i1 %13, i1 false
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = getelementptr inbounds i8, i8* %0, i64 %10
%17 = tail call zeroext i8 @DeFullbright(i8 zeroext %12)
store i8 %17, i8* %16
br label %18
18: ; preds = %9, %15
%19 = add nuw nsw i64 %10, 1
%20 = icmp eq i64 %19, %7
br i1 %20, label %8, label %9
}