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

/* Variables and functions */
int /*<<< orphan*/ XGetGeometry(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/ *, int *, int *,
                                unsigned int *, unsigned int *, unsigned int *,
                                unsigned int *);
unsigned char *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ updiv(unsigned int, int);
unsigned char *newpixgrid(Display *dpy, Drawable d) {
  Window _0;
  int _1, _2;
  unsigned int width, height;
  unsigned int _3, _4;
  XGetGeometry(dpy, d, &_0, &_1, &_2, &width, &height, &_3, &_4);
  return malloc(updiv(width * height, 8));
}


x86 assembly (clang, -O0):
<newpixgrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
lea    -0x1c(%rbp),%r9
lea    -0x20(%rbp),%r11
lea    -0x24(%rbp),%r10
lea    -0x28(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <XGetGeometry@plt>
mov    -0x1c(%rbp),%edi
imul   -0x20(%rbp),%edi
mov    $0x8,%esi
call   1030 <updiv@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newpixgrid>:
sub    $0x30,%rsp
lea    0x1c(%rsp),%rax
lea    0x20(%rsp),%r10
lea    0x14(%rsp),%r11
lea    0x2c(%rsp),%rdx
lea    0x28(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0x18(%rsp),%r9
push   %rax
push   %r10
push   %r11
call   1050 <XGetGeometry@plt>
add    $0x20,%rsp
mov    0xc(%rsp),%edi
imul   0x10(%rsp),%edi
mov    $0x8,%esi
call   1030 <updiv@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i8* @newpixgrid(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = call i32 @XGetGeometry(i32* %12, i32 %13, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = mul i32 %15, %16
%18 = call i32 @updiv(i32 %17, i32 8)
%19 = call i8* @malloc(i32 %18)
ret i8* %19
}

LLVM IR (-O2):
define noalias i8* @newpixgrid(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = bitcast i32* %9 to i8*
%17 = call i32 @XGetGeometry(i32* %0, i32 %1, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32* %9)
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = mul i32 %19, %18
%21 = call i32 @updiv(i32 %20, i32 8)
%22 = call i8* @malloc(i32 %21)
ret i8* %22
}