#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 */
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Colormap;

/* Variables and functions */
int /*<<< orphan*/ XFreeColors(int /*<<< orphan*/ *, int /*<<< orphan*/,
                               unsigned long *, int, unsigned long);
int /*<<< orphan*/ free(char *);
void free_cells(Display *dpy, Colormap cmap, unsigned long pixels[],
                int npixels, int p) {
  XFreeColors(dpy, cmap, pixels, p, (unsigned long)0);
  XFreeColors(dpy, cmap, &(pixels[p + 1]), npixels - p - 1, (unsigned long)0);
  free((char *)pixels);
}


x86 assembly (clang, -O0):
<free_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <XFreeColors@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x1c(%rbp),%ecx
sub    -0x20(%rbp),%ecx
sub    $0x1,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <XFreeColors@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_cells>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %esi,%r15d
mov    %rdi,%r12
mov    %r8d,%ecx
xor    %r8d,%r8d
call   1040 <XFreeColors@plt>
movslq %ebx,%rcx
lea    0x8(,%rcx,8),%rdx
add    %rbp,%rdx
not    %ecx
add    %r14d,%ecx
mov    %r12,%rdi
mov    %r15d,%esi
xor    %r8d,%r8d
call   1040 <XFreeColors@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_cells(i32* %0, i32 %1, i64* %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64*
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i64* %2, i64** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = load i64*, i64** %8
%14 = load i32, i32* %10
%15 = call i32 @XFreeColors(i32* %11, i32 %12, i64* %13, i32 %14, i64 0)
%16 = load i32*, i32** %6
%17 = load i32, i32* %7
%18 = load i64*, i64** %8
%19 = load i32, i32* %10
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %18, i64 %21
%23 = load i32, i32* %9
%24 = load i32, i32* %10
%25 = sub nsw i32 %23, %24
%26 = sub nsw i32 %25, 1
%27 = call i32 @XFreeColors(i32* %16, i32 %17, i64* %22, i32 %26, i64 0)
%28 = load i64*, i64** %8
%29 = bitcast i64* %28 to i8*
%30 = call i32 @free(i8* %29)
ret void
}

LLVM IR (-O2):
define void @free_cells(i32* %0, i32 %1, i64* %2, i32 %3, i32 %4) {
%6 = tail call i32 @XFreeColors(i32* %0, i32 %1, i64* %2, i32 %4, i64 0)
%7 = add nsw i32 %4, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i64, i64* %2, i64 %8
%10 = xor i32 %4, -1
%11 = add i32 %10, %3
%12 = tail call i32 @XFreeColors(i32* %0, i32 %1, i64* %9, i32 %11, i64 0)
%13 = bitcast i64* %2 to i8*
%14 = tail call i32 @free(i8* %13)
ret void
}