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

/* Variables and functions */
int EvalComputeK(int);
#define GL_COEFF 148
#define GL_DOMAIN 147
#define GL_MAP1_COLOR_4 146
#define GL_MAP1_INDEX 145
#define GL_MAP1_NORMAL 144
#define GL_MAP1_TEXTURE_COORD_1 143
#define GL_MAP1_TEXTURE_COORD_2 142
#define GL_MAP1_TEXTURE_COORD_3 141
#define GL_MAP1_TEXTURE_COORD_4 140
#define GL_MAP1_VERTEX_3 139
#define GL_MAP1_VERTEX_4 138
#define GL_MAP2_COLOR_4 137
#define GL_MAP2_INDEX 136
#define GL_MAP2_NORMAL 135
#define GL_MAP2_TEXTURE_COORD_1 134
#define GL_MAP2_TEXTURE_COORD_2 133
#define GL_MAP2_TEXTURE_COORD_3 132
#define GL_MAP2_TEXTURE_COORD_4 131
#define GL_MAP2_VERTEX_3 130
#define GL_MAP2_VERTEX_4 129
#define GL_ORDER 128
int /*<<< orphan*/ glGetMapiv(int, int const, int *);
GLint __glGetMap_size(GLenum target, GLenum query) {
  GLint k, order = 0, majorMinor[2];
  switch (target) {
  case GL_MAP1_COLOR_4:
  case GL_MAP1_NORMAL:
  case GL_MAP1_INDEX:
  case GL_MAP1_TEXTURE_COORD_1:
  case GL_MAP1_TEXTURE_COORD_2:
  case GL_MAP1_TEXTURE_COORD_3:
  case GL_MAP1_TEXTURE_COORD_4:
  case GL_MAP1_VERTEX_3:
  case GL_MAP1_VERTEX_4:
    switch (query) {
    case GL_COEFF:
      k = EvalComputeK(target);
      glGetMapiv(target, GL_ORDER, &order);
      return (order * k);
    case GL_DOMAIN:
      return 2;
    case GL_ORDER:
      return 1;
    }
    break;
  case GL_MAP2_COLOR_4:
  case GL_MAP2_NORMAL:
  case GL_MAP2_INDEX:
  case GL_MAP2_TEXTURE_COORD_1:
  case GL_MAP2_TEXTURE_COORD_2:
  case GL_MAP2_TEXTURE_COORD_3:
  case GL_MAP2_TEXTURE_COORD_4:
  case GL_MAP2_VERTEX_3:
  case GL_MAP2_VERTEX_4:
    switch (query) {
    case GL_COEFF:
      k = EvalComputeK(target);
      majorMinor[0] = majorMinor[1] = 0;
      glGetMapiv(target, GL_ORDER, majorMinor);
      return (majorMinor[0] * majorMinor[1] * k);
    case GL_DOMAIN:
      return 4;
    case GL_ORDER:
      return 2;
    }
    break;
  }
  return -1;
}


x86 assembly (clang, -O0):
<__glGetMap_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
add    $0xffffff7f,%eax
sub    $0x9,%eax
jb     11e8 <__glGetMap_size+0xc8>
jmp    114e <__glGetMap_size+0x2e>
mov    -0x20(%rbp),%eax
add    $0xffffff76,%eax
sub    $0x8,%eax
ja     127e <__glGetMap_size+0x15e>
jmp    1164 <__glGetMap_size+0x44>
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x80,%eax
je     11d7 <__glGetMap_size+0xb7>
jmp    117a <__glGetMap_size+0x5a>
mov    -0x24(%rbp),%eax
sub    $0x93,%eax
je     11cb <__glGetMap_size+0xab>
jmp    118d <__glGetMap_size+0x6d>
mov    -0x24(%rbp),%eax
sub    $0x94,%eax
jne    11e3 <__glGetMap_size+0xc3>
jmp    11a0 <__glGetMap_size+0x80>
mov    -0x8(%rbp),%edi
call   1030 <EvalComputeK@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x80,%esi
lea    -0x14(%rbp),%rdx
call   1040 <glGetMapiv@plt>
mov    -0x14(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
movl   $0x2,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
movl   $0x1,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
jmp    127e <__glGetMap_size+0x15e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x80,%eax
je     126d <__glGetMap_size+0x14d>
jmp    11fe <__glGetMap_size+0xde>
mov    -0x28(%rbp),%eax
sub    $0x93,%eax
je     1261 <__glGetMap_size+0x141>
jmp    1211 <__glGetMap_size+0xf1>
mov    -0x28(%rbp),%eax
sub    $0x94,%eax
jne    1279 <__glGetMap_size+0x159>
jmp    1224 <__glGetMap_size+0x104>
mov    -0x8(%rbp),%edi
call   1030 <EvalComputeK@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x1c(%rbp),%rdx
mov    $0x80,%esi
call   1040 <glGetMapiv@plt>
mov    -0x1c(%rbp),%eax
imul   -0x18(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
movl   $0x4,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
movl   $0x2,-0x4(%rbp)
jmp    1285 <__glGetMap_size+0x165>
jmp    127e <__glGetMap_size+0x15e>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__glGetMap_size>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
lea    -0x81(%rbx),%eax
cmp    $0x9,%eax
jb     1187 <__glGetMap_size+0x67>
lea    -0x8a(%rbx),%eax
cmp    $0x8,%eax
ja     11ce <__glGetMap_size+0xae>
cmp    $0x80,%esi
je     11dc <__glGetMap_size+0xbc>
cmp    $0x93,%esi
je     11d5 <__glGetMap_size+0xb5>
cmp    $0x94,%esi
jne    11ce <__glGetMap_size+0xae>
mov    %ebx,%edi
call   1030 <EvalComputeK@plt>
mov    %eax,%ebp
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
mov    $0x80,%esi
call   1040 <glGetMapiv@plt>
imul   0xc(%rsp),%ebp
jmp    11e8 <__glGetMap_size+0xc8>
cmp    $0x80,%esi
je     11d5 <__glGetMap_size+0xb5>
cmp    $0x93,%esi
je     11e3 <__glGetMap_size+0xc3>
cmp    $0x94,%esi
jne    11ce <__glGetMap_size+0xae>
mov    %ebx,%edi
call   1030 <EvalComputeK@plt>
mov    %eax,%ebp
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    $0x80,%esi
call   1040 <glGetMapiv@plt>
imul   0x10(%rsp),%ebp
imul   0x14(%rsp),%ebp
jmp    11e8 <__glGetMap_size+0xc8>
mov    $0xffffffff,%ebp
jmp    11e8 <__glGetMap_size+0xc8>
mov    $0x2,%ebp
jmp    11e8 <__glGetMap_size+0xc8>
mov    $0x1,%ebp
jmp    11e8 <__glGetMap_size+0xc8>
mov    $0x4,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @__glGetMap_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %7
%9 = load i32, i32* %4
switch i32 %9, label %43 [
i32 146, label %10
i32 144, label %10
i32 145, label %10
i32 143, label %10
i32 142, label %10
i32 141, label %10
i32 140, label %10
i32 139, label %10
i32 138, label %10
i32 137, label %23
i32 135, label %23
i32 136, label %23
i32 134, label %23
i32 133, label %23
i32 132, label %23
i32 131, label %23
i32 130, label %23
i32 129, label %23
]
10: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2
%11 = load i32, i32* %5
switch i32 %11, label %22 [
i32 148, label %12
i32 147, label %20
i32 128, label %21
]
12: ; preds = %10
%13 = load i32, i32* %4
%14 = call i32 @EvalComputeK(i32 %13)
store i32 %14, i32* %6
%15 = load i32, i32* %4
%16 = call i32 @glGetMapiv(i32 %15, i32 128, i32* %7)
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = mul nsw i32 %17, %18
store i32 %19, i32* %3
br label %44
20: ; preds = %10
store i32 2, i32* %3
br label %44
21: ; preds = %10
store i32 1, i32* %3
br label %44
22: ; preds = %10
br label %43
23: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2
%24 = load i32, i32* %5
switch i32 %24, label %42 [
i32 148, label %25
i32 147, label %40
i32 128, label %41
]
25: ; preds = %23
%26 = load i32, i32* %4
%27 = call i32 @EvalComputeK(i32 %26)
store i32 %27, i32* %6
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 0, i32* %28
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 0, i32* %29
%30 = load i32, i32* %4
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%32 = call i32 @glGetMapiv(i32 %30, i32 128, i32* %31)
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%34 = load i32, i32* %33
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%36 = load i32, i32* %35
%37 = mul nsw i32 %34, %36
%38 = load i32, i32* %6
%39 = mul nsw i32 %37, %38
store i32 %39, i32* %3
br label %44
40: ; preds = %23
store i32 4, i32* %3
br label %44
41: ; preds = %23
store i32 2, i32* %3
br label %44
42: ; preds = %23
br label %43
43: ; preds = %2, %42, %22
store i32 -1, i32* %3
br label %44
44: ; preds = %43, %41, %40, %25, %21, %20, %12
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
define i32 @__glGetMap_size(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = bitcast [2 x i32]* %4 to i8*
switch i32 %0, label %25 [
i32 146, label %7
i32 144, label %7
i32 145, label %7
i32 143, label %7
i32 142, label %7
i32 141, label %7
i32 140, label %7
i32 139, label %7
i32 138, label %7
i32 137, label %14
i32 135, label %14
i32 136, label %14
i32 134, label %14
i32 133, label %14
i32 132, label %14
i32 131, label %14
i32 130, label %14
i32 129, label %14
]
7: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2
switch i32 %1, label %25 [
i32 148, label %8
i32 147, label %26
i32 128, label %13
]
8: ; preds = %7
%9 = tail call i32 @EvalComputeK(i32 %0)
%10 = call i32 @glGetMapiv(i32 %0, i32 128, i32* %3)
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, %9
br label %26
13: ; preds = %7
br label %26
14: ; preds = %2, %2, %2, %2, %2, %2, %2, %2, %2
switch i32 %1, label %25 [
i32 148, label %15
i32 147, label %26
i32 128, label %24
]
15: ; preds = %14
%16 = tail call i32 @EvalComputeK(i32 %0)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 0, i32* %17
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 0, i32* %18
%19 = call i32 @glGetMapiv(i32 %0, i32 128, i32* %18)
%20 = load i32, i32* %18
%21 = load i32, i32* %17
%22 = mul i32 %20, %16
%23 = mul i32 %22, %21
br label %26
24: ; preds = %14
br label %26
25: ; preds = %14, %7, %2
br label %26
26: ; preds = %14, %7, %25, %24, %15, %13, %8
%27 = phi i32 [ -1, %25 ], [ 2, %24 ], [ %23, %15 ], [ 1, %13 ], [ %12, %8 ], [ 2, %7 ], [ 4, %14 ]
ret i32 %27
}