#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*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ GL_POLYGON_BIT;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glCullFace(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glPopAttrib();
int /*<<< orphan*/ glPushAttrib(int /*<<< orphan*/);
int /*<<< orphan*/ glTexCoord2i(int, int);
int /*<<< orphan*/ glVertex3f(float, float, float);
void quad(float min_x, float max_x, float min_y, float max_y, float min_z,
          float max_z, GLenum cullFace) {
  float x = min_x, z = min_z;
  float split_factor = 1;
  float len_x = (max_x == min_x ? 0 : split_factor);
  float len_y = (max_y == min_y ? 0 : split_factor);
  float len_z = (max_z == min_z ? 0 : split_factor);
  glPushAttrib(GL_POLYGON_BIT);
  glCullFace(cullFace);
  glBegin(GL_QUADS);
  while ((len_x == 0 && z < max_z) || (len_z == 0 && x < max_x)) {
    float y = min_y;
    while (y < max_y) {
      glTexCoord2i(0, 0);
      glVertex3f(x, y, z);
      glTexCoord2i(1, 0);
      glVertex3f(x + len_x, y, z + len_z);
      glTexCoord2i(1, 1);
      glVertex3f(x + len_x, y + len_y, z + len_z);
      glTexCoord2i(0, 1);
      glVertex3f(x, y + len_y, z);
      y += len_y;
    }
    x += len_x;
    z += len_z;
  }
  glEnd();
  glPopAttrib();
}


x86 assembly (clang, -O0):
<quad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe4b(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x4(%rbp),%xmm0
jne    11dc <quad+0x6c>
jp     11dc <quad+0x6c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    11e6 <quad+0x76>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    1212 <quad+0xa2>
jp     1212 <quad+0xa2>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    121c <quad+0xac>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
ucomiss -0x14(%rbp),%xmm0
jne    1248 <quad+0xd8>
jp     1248 <quad+0xd8>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
jmp    1252 <quad+0xe2>
movss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   1070 <glPushAttrib@plt>
mov    -0x1c(%rbp),%edi
call   1090 <glCullFace@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  -0x2c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12af <quad+0x13f>
jp     12af <quad+0x13f>
movss  -0x24(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
mov    $0x1,%al
ucomiss %xmm1,%xmm0
mov    %al,-0x45(%rbp)
ja     12e4 <quad+0x174>
movss  -0x34(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0x46(%rbp)
jne    12de <quad+0x16e>
jp     12de <quad+0x16e>
movss  -0x20(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0x46(%rbp)
mov    -0x46(%rbp),%al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    12f4 <quad+0x184>
jmp    13e3 <quad+0x273>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    13c0 <quad+0x250>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <glTexCoord2i@plt>
movss  -0x20(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
call   1040 <glVertex3f@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <glTexCoord2i@plt>
movss  -0x20(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
addss  -0x34(%rbp),%xmm2
call   1040 <glVertex3f@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <glTexCoord2i@plt>
movss  -0x20(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
addss  -0x30(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
addss  -0x34(%rbp),%xmm2
call   1040 <glVertex3f@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <glTexCoord2i@plt>
movss  -0x20(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
addss  -0x30(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
call   1040 <glVertex3f@plt>
movss  -0x30(%rbp),%xmm0
addss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
jmp    12fe <quad+0x18e>
movss  -0x2c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x34(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1280 <quad+0x110>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    $0x0,%al
call   1060 <glPopAttrib@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quad>:
push   %rbx
sub    $0x60,%rsp
mov    %edi,%ebx
movss  %xmm5,0x1c(%rsp)
movss  %xmm4,0x20(%rsp)
movss  %xmm3,0x24(%rsp)
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
movaps %xmm1,%xmm6
cmpeqss %xmm0,%xmm6
movss  0xe55(%rip),%xmm0
andnps %xmm0,%xmm6
movaps %xmm6,0x40(%rsp)
movaps %xmm3,%xmm1
cmpeqss %xmm2,%xmm1
andnps %xmm0,%xmm1
movaps %xmm1,0x50(%rsp)
movaps %xmm5,%xmm1
cmpeqss %xmm4,%xmm1
andnps %xmm0,%xmm1
movaps %xmm1,0x30(%rsp)
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
call   1070 <glPushAttrib@plt>
mov    %ebx,%edi
call   1090 <glCullFace@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  0x10(%rsp),%xmm8
movss  0x14(%rsp),%xmm3
movss  0x18(%rsp),%xmm2
movss  0x24(%rsp),%xmm1
movss  0x1c(%rsp),%xmm0
movss  0x20(%rsp),%xmm5
movaps %xmm8,%xmm6
nop
movaps %xmm6,%xmm4
movaps %xmm5,%xmm7
ucomiss %xmm8,%xmm3
jne    1233 <quad+0xc3>
jp     1233 <quad+0xc3>
ucomiss %xmm7,%xmm0
ja     124d <quad+0xdd>
ucomiss 0x20(%rsp),%xmm0
jne    1363 <quad+0x1f3>
jp     1363 <quad+0x1f3>
ucomiss %xmm4,%xmm3
jbe    1363 <quad+0x1f3>
ucomiss %xmm2,%xmm1
movaps 0x40(%rsp),%xmm6
addss  %xmm4,%xmm6
movaps 0x30(%rsp),%xmm5
addss  %xmm7,%xmm5
jbe    1220 <quad+0xb0>
movss  %xmm2,0x4(%rsp)
movss  %xmm4,0x2c(%rsp)
movss  %xmm7,0x28(%rsp)
movss  %xmm5,0xc(%rsp)
movss  %xmm6,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %edi,%edi
xor    %esi,%esi
call   1030 <glTexCoord2i@plt>
movss  0x2c(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x28(%rsp),%xmm2
call   1040 <glVertex3f@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <glTexCoord2i@plt>
movss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
call   1040 <glVertex3f@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <glTexCoord2i@plt>
movss  0x4(%rsp),%xmm1
addss  0x50(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm2
call   1040 <glVertex3f@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <glTexCoord2i@plt>
movss  0x2c(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
movss  0x28(%rsp),%xmm2
call   1040 <glVertex3f@plt>
movss  0x24(%rsp),%xmm1
ucomiss 0x4(%rsp),%xmm1
ja     1290 <quad+0x120>
movss  0x1c(%rsp),%xmm0
movss  0x18(%rsp),%xmm2
movss  0x14(%rsp),%xmm3
movss  0x10(%rsp),%xmm8
movss  0xc(%rsp),%xmm5
movss  0x8(%rsp),%xmm6
jmp    1220 <quad+0xb0>
xor    %eax,%eax
call   1050 <glEnd@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
jmp    1060 <glPopAttrib@plt>

LLVM IR (-O0):
@GL_POLYGON_BIT = global i32 0
@GL_QUADS = global i32 0
define void @quad(float %0, float %1, float %2, float %3, float %4, float %5, i32 %6) {
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca i32
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
store i32 %6, i32* %14
%22 = load float, float* %8
store float %22, float* %15
%23 = load float, float* %12
store float %23, float* %16
store float 1.000000e+00, float* %17
%24 = load float, float* %9
%25 = load float, float* %8
%26 = fcmp oeq float %24, %25
br i1 %26, label %27, label %28
27: ; preds = %7
br label %30
28: ; preds = %7
%29 = load float, float* %17
br label %30
30: ; preds = %28, %27
%31 = phi float [ 0.000000e+00, %27 ], [ %29, %28 ]
store float %31, float* %18
%32 = load float, float* %11
%33 = load float, float* %10
%34 = fcmp oeq float %32, %33
br i1 %34, label %35, label %36
35: ; preds = %30
br label %38
36: ; preds = %30
%37 = load float, float* %17
br label %38
38: ; preds = %36, %35
%39 = phi float [ 0.000000e+00, %35 ], [ %37, %36 ]
store float %39, float* %19
%40 = load float, float* %13
%41 = load float, float* %12
%42 = fcmp oeq float %40, %41
br i1 %42, label %43, label %44
43: ; preds = %38
br label %46
44: ; preds = %38
%45 = load float, float* %17
br label %46
46: ; preds = %44, %43
%47 = phi float [ 0.000000e+00, %43 ], [ %45, %44 ]
store float %47, float* %20
%48 = load i32, i32* @GL_POLYGON_BIT
%49 = call i32 @glPushAttrib(i32 %48)
%50 = load i32, i32* %14
%51 = call i32 @glCullFace(i32 %50)
%52 = load i32, i32* @GL_QUADS
%53 = call i32 @glBegin(i32 %52)
br label %54
54: ; preds = %114, %46
%55 = load float, float* %18
%56 = fcmp oeq float %55, 0.000000e+00
br i1 %56, label %57, label %61
57: ; preds = %54
%58 = load float, float* %16
%59 = load float, float* %13
%60 = fcmp olt float %58, %59
br i1 %60, label %70, label %61
61: ; preds = %57, %54
%62 = load float, float* %20
%63 = fcmp oeq float %62, 0.000000e+00
br i1 %63, label %64, label %68
64: ; preds = %61
%65 = load float, float* %15
%66 = load float, float* %9
%67 = fcmp olt float %65, %66
br label %68
68: ; preds = %64, %61
%69 = phi i1 [ false, %61 ], [ %67, %64 ]
br label %70
70: ; preds = %68, %57
%71 = phi i1 [ true, %57 ], [ %69, %68 ]
br i1 %71, label %72, label %121
72: ; preds = %70
%73 = load float, float* %10
store float %73, float* %21
br label %74
74: ; preds = %78, %72
%75 = load float, float* %21
%76 = load float, float* %11
%77 = fcmp olt float %75, %76
br i1 %77, label %78, label %114
78: ; preds = %74
%79 = call i32 @glTexCoord2i(i32 0, i32 0)
%80 = load float, float* %15
%81 = load float, float* %21
%82 = load float, float* %16
%83 = call i32 @glVertex3f(float %80, float %81, float %82)
%84 = call i32 @glTexCoord2i(i32 1, i32 0)
%85 = load float, float* %15
%86 = load float, float* %18
%87 = fadd float %85, %86
%88 = load float, float* %21
%89 = load float, float* %16
%90 = load float, float* %20
%91 = fadd float %89, %90
%92 = call i32 @glVertex3f(float %87, float %88, float %91)
%93 = call i32 @glTexCoord2i(i32 1, i32 1)
%94 = load float, float* %15
%95 = load float, float* %18
%96 = fadd float %94, %95
%97 = load float, float* %21
%98 = load float, float* %19
%99 = fadd float %97, %98
%100 = load float, float* %16
%101 = load float, float* %20
%102 = fadd float %100, %101
%103 = call i32 @glVertex3f(float %96, float %99, float %102)
%104 = call i32 @glTexCoord2i(i32 0, i32 1)
%105 = load float, float* %15
%106 = load float, float* %21
%107 = load float, float* %19
%108 = fadd float %106, %107
%109 = load float, float* %16
%110 = call i32 @glVertex3f(float %105, float %108, float %109)
%111 = load float, float* %19
%112 = load float, float* %21
%113 = fadd float %112, %111
store float %113, float* %21
br label %74
114: ; preds = %74
%115 = load float, float* %18
%116 = load float, float* %15
%117 = fadd float %116, %115
store float %117, float* %15
%118 = load float, float* %20
%119 = load float, float* %16
%120 = fadd float %119, %118
store float %120, float* %16
br label %54
121: ; preds = %70
%122 = call i32 (...) @glEnd()
%123 = call i32 (...) @glPopAttrib()
ret void
}

LLVM IR (-O2):
@GL_POLYGON_BIT = global i32 0
@GL_QUADS = global i32 0
define void @quad(float %0, float %1, float %2, float %3, float %4, float %5, i32 %6) {
%8 = fcmp oeq float %1, %0
%9 = select i1 %8, float 0.000000e+00, float 1.000000e+00
%10 = fcmp oeq float %3, %2
%11 = select i1 %10, float 0.000000e+00, float 1.000000e+00
%12 = fcmp oeq float %5, %4
%13 = select i1 %12, float 0.000000e+00, float 1.000000e+00
%14 = load i32, i32* @GL_POLYGON_BIT
%15 = tail call i32 @glPushAttrib(i32 %14)
%16 = tail call i32 @glCullFace(i32 %6)
%17 = load i32, i32* @GL_QUADS
%18 = tail call i32 @glBegin(i32 %17)
%19 = fcmp olt float %2, %3
br label %20
20: ; preds = %31, %7
%21 = phi float [ %4, %7 ], [ %30, %31 ]
%22 = phi float [ %0, %7 ], [ %29, %31 ]
%23 = fcmp olt float %21, %5
%24 = select i1 %8, i1 %23, i1 false
br i1 %24, label %28, label %25
25: ; preds = %20
%26 = fcmp olt float %22, %1
%27 = select i1 %12, i1 %26, i1 false
br i1 %27, label %28, label %44
28: ; preds = %20, %25
%29 = fadd float %9, %22
%30 = fadd float %13, %21
br i1 %19, label %32, label %31
31: ; preds = %32, %28
br label %20
32: ; preds = %28, %32
%33 = phi float [ %39, %32 ], [ %2, %28 ]
%34 = tail call i32 @glTexCoord2i(i32 0, i32 0)
%35 = tail call i32 @glVertex3f(float %22, float %33, float %21)
%36 = tail call i32 @glTexCoord2i(i32 1, i32 0)
%37 = tail call i32 @glVertex3f(float %29, float %33, float %30)
%38 = tail call i32 @glTexCoord2i(i32 1, i32 1)
%39 = fadd float %11, %33
%40 = tail call i32 @glVertex3f(float %29, float %39, float %30)
%41 = tail call i32 @glTexCoord2i(i32 0, i32 1)
%42 = tail call i32 @glVertex3f(float %22, float %39, float %21)
%43 = fcmp olt float %39, %3
br i1 %43, label %32, label %31
44: ; preds = %25
%45 = tail call i32 (...) @glEnd()
%46 = tail call i32 (...) @glPopAttrib()
ret void
}