#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 GLsizei;
typedef int GLint;
typedef int GLenum;

/* Variables and functions */
#define GL_ABGR_EXT 159
#define GL_ALPHA 158
#define GL_BITMAP 157
#define GL_BLUE 156
#define GL_BYTE 155
#define GL_COLOR_INDEX 154
#define GL_DEPTH_COMPONENT 153
#define GL_FLOAT 152
#define GL_GREEN 151
#define GL_INT 150
#define GL_LUMINANCE 149
#define GL_LUMINANCE_ALPHA 148
#define GL_RED 147
#define GL_RGB 146
#define GL_RGBA 145
#define GL_SHORT 144
#define GL_STENCIL_INDEX 143
#define GL_UNSIGNED_BYTE 142
#define GL_UNSIGNED_BYTE_2_3_3_REV 141
#define GL_UNSIGNED_BYTE_3_3_2 140
#define GL_UNSIGNED_INT 139
#define GL_UNSIGNED_INT_10_10_10_2 138
#define GL_UNSIGNED_INT_2_10_10_10_REV 137
#define GL_UNSIGNED_INT_8_8_8_8 136
#define GL_UNSIGNED_INT_8_8_8_8_REV 135
#define GL_UNSIGNED_SHORT 134
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 133
#define GL_UNSIGNED_SHORT_4_4_4_4 132
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 131
#define GL_UNSIGNED_SHORT_5_5_5_1 130
#define GL_UNSIGNED_SHORT_5_6_5 129
#define GL_UNSIGNED_SHORT_5_6_5_REV 128
GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) {
  GLint elements, esize;
  switch (format) {
  case GL_COLOR_INDEX:
  case GL_STENCIL_INDEX:
  case GL_DEPTH_COMPONENT:
    elements = 1;
    break;
  case GL_RED:
  case GL_GREEN:
  case GL_BLUE:
  case GL_ALPHA:
  case GL_LUMINANCE:
    elements = 1;
    break;
  case GL_LUMINANCE_ALPHA:
    elements = 2;
    break;
  case GL_RGB:
    elements = 3;
    break;
  case GL_RGBA:
  case GL_ABGR_EXT:
    elements = 4;
    break;
  default:
    return 0;
  }
  switch (type) {
  case GL_BITMAP:
    if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) {
      return (h * ((w + 7) / 8));
    } else {
      return 0;
    }
  case GL_BYTE:
  case GL_UNSIGNED_BYTE:
    esize = 1;
    break;
  case GL_UNSIGNED_BYTE_3_3_2:
  case GL_UNSIGNED_BYTE_2_3_3_REV:
    esize = 1;
    elements = 1;
    break;
  case GL_SHORT:
  case GL_UNSIGNED_SHORT:
    esize = 2;
    break;
  case GL_UNSIGNED_SHORT_5_6_5:
  case GL_UNSIGNED_SHORT_5_6_5_REV:
  case GL_UNSIGNED_SHORT_4_4_4_4:
  case GL_UNSIGNED_SHORT_4_4_4_4_REV:
  case GL_UNSIGNED_SHORT_5_5_5_1:
  case GL_UNSIGNED_SHORT_1_5_5_5_REV:
    esize = 2;
    elements = 1;
    break;
  case GL_INT:
  case GL_UNSIGNED_INT:
  case GL_FLOAT:
    esize = 4;
    break;
  case GL_UNSIGNED_INT_8_8_8_8:
  case GL_UNSIGNED_INT_8_8_8_8_REV:
  case GL_UNSIGNED_INT_10_10_10_2:
  case GL_UNSIGNED_INT_2_10_10_10_REV:
    esize = 4;
    elements = 1;
    break;
  default:
    return 0;
  }
  return elements * esize * w * h;
}


x86 assembly (clang, -O0):
<__glDrawPixels_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff71,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x10,%eax
ja     1177 <__glDrawPixels_size+0x77>
mov    -0x28(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x18(%rbp)
jmp    1183 <__glDrawPixels_size+0x83>
movl   $0x1,-0x18(%rbp)
jmp    1183 <__glDrawPixels_size+0x83>
movl   $0x2,-0x18(%rbp)
jmp    1183 <__glDrawPixels_size+0x83>
movl   $0x3,-0x18(%rbp)
jmp    1183 <__glDrawPixels_size+0x83>
movl   $0x4,-0x18(%rbp)
jmp    1183 <__glDrawPixels_size+0x83>
movl   $0x0,-0x4(%rbp)
jmp    1271 <__glDrawPixels_size+0x171>
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x1d,%eax
ja     1253 <__glDrawPixels_size+0x153>
mov    -0x30(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x9a,-0x8(%rbp)
je     11c6 <__glDrawPixels_size+0xc6>
cmpl   $0x8f,-0x8(%rbp)
jne    11ea <__glDrawPixels_size+0xea>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%eax
add    $0x7,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1271 <__glDrawPixels_size+0x171>
movl   $0x0,-0x4(%rbp)
jmp    1271 <__glDrawPixels_size+0x171>
movl   $0x1,-0x1c(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x1,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x2,-0x1c(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x2,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x4,-0x1c(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x4,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
jmp    125f <__glDrawPixels_size+0x15f>
movl   $0x0,-0x4(%rbp)
jmp    1271 <__glDrawPixels_size+0x171>
mov    -0x18(%rbp),%eax
imul   -0x1c(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__glDrawPixels_size>:
lea    -0x8f(%rdi),%r8d
xor    %eax,%eax
cmp    $0x10,%r8d
ja     1186 <__glDrawPixels_size+0x86>
mov    $0x1ad7d,%r9d
bt     %r8d,%r9d
jae    1186 <__glDrawPixels_size+0x86>
add    $0xffffff80,%esi
cmp    $0x1d,%esi
ja     1186 <__glDrawPixels_size+0x86>
movslq %r8d,%r8
lea    0xf4b(%rip),%r9
mov    (%r9,%r8,4),%r8d
mov    $0x1,%r9d
lea    0xec2(%rip),%r10
movslq (%r10,%rsi,4),%rsi
add    %r10,%rsi
jmp    *%rsi
mov    $0x2,%r9d
jmp    1155 <__glDrawPixels_size+0x55>
mov    $0x4,%r9d
mov    $0x1,%r8d
jmp    1179 <__glDrawPixels_size+0x79>
mov    $0x4,%r9d
jmp    1179 <__glDrawPixels_size+0x79>
mov    $0x2,%r9d
jmp    1179 <__glDrawPixels_size+0x79>
mov    $0x1,%r8d
mov    $0x1,%r9d
imul   %r9d,%r8d
imul   %edx,%ecx
imul   %r8d,%ecx
mov    %ecx,%eax
ret
cmp    $0x9a,%edi
je     1197 <__glDrawPixels_size+0x97>
cmp    $0x8f,%edi
jne    1186 <__glDrawPixels_size+0x86>
lea    0x7(%rdx),%eax
add    $0xe,%edx
test   %eax,%eax
cmovns %eax,%edx
sar    $0x3,%edx
imul   %ecx,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @__glDrawPixels_size(i32 %0, i32 %1, i32 %2, i32 %3) {
%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* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%12 = load i32, i32* %6
switch i32 %12, label %18 [
i32 154, label %13
i32 143, label %13
i32 153, label %13
i32 147, label %14
i32 151, label %14
i32 156, label %14
i32 158, label %14
i32 149, label %14
i32 148, label %15
i32 146, label %16
i32 145, label %17
i32 159, label %17
]
13: ; preds = %4, %4, %4
store i32 1, i32* %10
br label %19
14: ; preds = %4, %4, %4, %4, %4
store i32 1, i32* %10
br label %19
15: ; preds = %4
store i32 2, i32* %10
br label %19
16: ; preds = %4
store i32 3, i32* %10
br label %19
17: ; preds = %4, %4
store i32 4, i32* %10
br label %19
18: ; preds = %4
store i32 0, i32* %5
br label %49
19: ; preds = %17, %16, %15, %14, %13
%20 = load i32, i32* %7
switch i32 %20, label %40 [
i32 157, label %21
i32 155, label %34
i32 142, label %34
i32 140, label %35
i32 141, label %35
i32 144, label %36
i32 134, label %36
i32 129, label %37
i32 128, label %37
i32 132, label %37
i32 131, label %37
i32 130, label %37
i32 133, label %37
i32 150, label %38
i32 139, label %38
i32 152, label %38
i32 136, label %39
i32 135, label %39
i32 138, label %39
i32 137, label %39
]
21: ; preds = %19
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 154
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 143
br i1 %26, label %27, label %33
27: ; preds = %24, %21
%28 = load i32, i32* %9
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 7
%31 = sdiv i32 %30, 8
%32 = mul nsw i32 %28, %31
store i32 %32, i32* %5
br label %49
33: ; preds = %24
store i32 0, i32* %5
br label %49
34: ; preds = %19, %19
store i32 1, i32* %11
br label %41
35: ; preds = %19, %19
store i32 1, i32* %11
store i32 1, i32* %10
br label %41
36: ; preds = %19, %19
store i32 2, i32* %11
br label %41
37: ; preds = %19, %19, %19, %19, %19, %19
store i32 2, i32* %11
store i32 1, i32* %10
br label %41
38: ; preds = %19, %19, %19
store i32 4, i32* %11
br label %41
39: ; preds = %19, %19, %19, %19
store i32 4, i32* %11
store i32 1, i32* %10
br label %41
40: ; preds = %19
store i32 0, i32* %5
br label %49
41: ; preds = %39, %38, %37, %36, %35, %34
%42 = load i32, i32* %10
%43 = load i32, i32* %11
%44 = mul nsw i32 %42, %43
%45 = load i32, i32* %8
%46 = mul nsw i32 %44, %45
%47 = load i32, i32* %9
%48 = mul nsw i32 %46, %47
store i32 %48, i32* %5
br label %49
49: ; preds = %41, %40, %33, %27, %18
%50 = load i32, i32* %5
ret i32 %50
}

LLVM IR (-O2):
@switch.table.__glDrawPixels_size = [17 x i32] [i32 1, i32 1, i32 4, i32 3, i32 1, i32 2, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 4]
define i32 @__glDrawPixels_size(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add i32 %0, -143
%6 = icmp ult i32 %5, 17
br i1 %6, label %7, label %31
7: ; preds = %4
%8 = lshr i32 109949, %5
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %31, label %11
11: ; preds = %7
%12 = sext i32 %5 to i64
%13 = getelementptr inbounds [17 x i32], [17 x i32]* @switch.table.__glDrawPixels_size, i64 0, i64 %12
%14 = load i32, i32* %13
switch i32 %1, label %31 [
i32 157, label %15
i32 155, label %25
i32 142, label %25
i32 140, label %20
i32 141, label %20
i32 144, label %21
i32 134, label %21
i32 129, label %22
i32 128, label %22
i32 132, label %22
i32 131, label %22
i32 130, label %22
i32 133, label %22
i32 150, label %23
i32 139, label %23
i32 152, label %23
i32 136, label %24
i32 135, label %24
i32 138, label %24
i32 137, label %24
]
15: ; preds = %11
switch i32 %0, label %31 [
i32 154, label %16
i32 143, label %16
]
16: ; preds = %15, %15
%17 = add nsw i32 %2, 7
%18 = sdiv i32 %17, 8
%19 = mul nsw i32 %18, %3
br label %31
20: ; preds = %11, %11
br label %25
21: ; preds = %11, %11
br label %25
22: ; preds = %11, %11, %11, %11, %11, %11
br label %25
23: ; preds = %11, %11, %11
br label %25
24: ; preds = %11, %11, %11, %11
br label %25
25: ; preds = %11, %11, %24, %23, %22, %21, %20
%26 = phi i32 [ 1, %24 ], [ %14, %23 ], [ 1, %22 ], [ %14, %21 ], [ 1, %20 ], [ %14, %11 ], [ %14, %11 ]
%27 = phi i32 [ 4, %24 ], [ 4, %23 ], [ 2, %22 ], [ 2, %21 ], [ 1, %20 ], [ 1, %11 ], [ 1, %11 ]
%28 = mul i32 %3, %2
%29 = mul i32 %28, %26
%30 = mul i32 %29, %27
br label %31
31: ; preds = %7, %4, %11, %15, %25, %16
%32 = phi i32 [ %30, %25 ], [ %19, %16 ], [ 0, %4 ], [ 0, %15 ], [ 0, %11 ], [ 0, %7 ]
ret i32 %32
}