#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  double member_0;
  double member_1;
  double member_2;
  double member_3;
};
typedef scalar_t__ GLuint;
typedef TYPE_1__ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_COMPILE;
int /*<<< orphan*/ GL_QUAD_STRIP;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glCallList(scalar_t__);
int /*<<< orphan*/ glColor4fv(TYPE_1__ *);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glEndList();
scalar_t__ glGenLists(int);
int /*<<< orphan*/ glNewList(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ glNormal3f(double, double, double);
int /*<<< orphan*/ glVertex3f(float, double, float);
void DrawGround(void) {
  static GLuint ground = 0;
  if (ground == 0) {
    const int rows = 20, columns = 20;
    float sizeA = 1.25, sizeB = 0.2;
    float x, z;
    int i, j;
    GLfloat mat[2][4] = {{0.0, 0.6, 0.0, 1.0}, {0.1, 0.8, 0.1, 1.0}};
    ground = glGenLists(1);
    glNewList(ground, GL_COMPILE);
    glNormal3f(0.0, 1.0, 0.0);
    x = -(columns * (sizeA + sizeB)) / 4;
    for (i = 0; i <= rows; i++) {
      float size = (i & 1) ? sizeA : sizeB;
      z = -(rows * (sizeA + sizeB)) / 4;
      glBegin(GL_QUAD_STRIP);
      for (j = 0; j <= columns; j++) {
        glColor4fv(mat[(i + j) % 2]);
        glVertex3f(x + size, 0.0, z);
        glVertex3f(x, 0.0, z);
        if (j & 1)
          z += sizeA;
        else
          z += sizeB;
      }
      glEnd();
      x += size;
    }
    glEndList();
  }
  glCallList(ground);
}


x86 assembly (clang, -O0):
<DrawGround>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
cmpq   $0x0,0x2ec5(%rip)
jne    1426 <DrawGround+0x286>
movl   $0x14,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movss  0xe3d(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe2c(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1060 <memset@plt>
movsd  0xe2c(%rip),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
movsd  0xe04(%rip),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  0xdfc(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xdf4(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xddc(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xdc4(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    $0x1,%edi
call   1090 <glGenLists@plt>
mov    %rax,0x2e13(%rip)
mov    0x2e0c(%rip),%rdi
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
call   1050 <glNewList@plt>
xorps  %xmm2,%xmm2
movsd  0xd8b(%rip),%xmm1
movaps %xmm2,%xmm0
call   10c0 <glNormal3f@plt>
movss  -0xc(%rbp),%xmm1
addss  -0x10(%rbp),%xmm1
movss  0xd65(%rip),%xmm0
mulss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd48(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x14,-0x1c(%rbp)
jg     141f <DrawGround+0x27f>
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     12f3 <DrawGround+0x153>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x128(%rbp)
ff
jmp    1300 <DrawGround+0x160>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x128(%rbp)
ff
movss  -0x128(%rbp),%xmm0
ff
movss  %xmm0,-0x124(%rbp)
ff
movss  -0xc(%rbp),%xmm1
addss  -0x10(%rbp),%xmm1
movss  0xce2(%rip),%xmm0
mulss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xcc5(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    0x2c9d(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x14,-0x20(%rbp)
jg     13f8 <DrawGround+0x258>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
lea    -0x120(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
call   1030 <glColor4fv@plt>
movss  -0x14(%rbp),%xmm0
addss  -0x124(%rbp),%xmm0
ff
movss  -0x18(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1040 <glVertex3f@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1040 <glVertex3f@plt>
mov    -0x20(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13d6 <DrawGround+0x236>
movss  -0xc(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    13e5 <DrawGround+0x245>
movss  -0x10(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    13ea <DrawGround+0x24a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1359 <DrawGround+0x1b9>
mov    $0x0,%al
call   1070 <glEnd@plt>
movss  -0x124(%rbp),%xmm0
ff
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12c8 <DrawGround+0x128>
mov    $0x0,%al
call   10b0 <glEndList@plt>
mov    0x2c4b(%rip),%rdi
call   1080 <glCallList@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawGround>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    0x2ecb(%rip),%rdi
test   %rdi,%rdi
jne    1371 <DrawGround+0x1e1>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movabs $0x3fe3333333333333,%rax
33 e3 3f
mov    %rax,0x18(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x28(%rsp)
movaps 0xdcf(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xdd0(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
mov    $0x1,%edi
call   1080 <glGenLists@plt>
mov    %rax,0x2e17(%rip)
mov    0x2d78(%rip),%rcx
mov    (%rcx),%esi
mov    %rax,%rdi
call   1050 <glNewList@plt>
movsd  0xdae(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   10b0 <glNormal3f@plt>
movss  0xdab(%rip),%xmm0
mov    0x2d5c(%rip),%r14
lea    0xd95(%rip),%r15
movss  %xmm0,0x8(%rsp)
xor    %r12d,%r12d
nopl   0x0(%rax)
xor    %ebx,%ebx
test   $0x1,%r12b
sete   %bl
mov    (%r14),%edi
call   1090 <glBegin@plt>
movss  (%r15,%rbx,4),%xmm0
addss  0x8(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
xor    %ebx,%ebx
movss  0xd63(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r12,%rbx,1),%eax
and    $0x1,%eax
shl    $0x7,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
call   1030 <glColor4fv@plt>
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
movss  0x4(%rsp),%xmm2
call   1040 <glVertex3f@plt>
xorps  %xmm1,%xmm1
movss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm2
call   1040 <glVertex3f@plt>
xor    %eax,%eax
test   $0x1,%bl
sete   %al
movss  0x4(%rsp),%xmm0
addss  (%r15,%rax,4),%xmm0
movss  %xmm0,0x4(%rsp)
add    $0x1,%ebx
cmp    $0x15,%ebx
jne    12e0 <DrawGround+0x150>
xor    %eax,%eax
call   1060 <glEnd@plt>
add    $0x1,%r12d
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
cmp    $0x15,%r12d
jne    12a0 <DrawGround+0x110>
xor    %eax,%eax
call   10a0 <glEndList@plt>
mov    0x2cff(%rip),%rdi
call   1070 <glCallList@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { double, double, double, double }
@DrawGround.ground = internal global i64 0
@GL_COMPILE = global i32 0
@GL_QUAD_STRIP = global i32 0
define void @DrawGround() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x [4 x %struct.TYPE_3__]]
%10 = alloca float
%11 = load i64, i64* @DrawGround.ground
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %103
13: ; preds = %0
store i32 20, i32* %1
store i32 20, i32* %2
store float 1.250000e+00, float* %3
store float 0x3FC99999A0000000, float* %4
%14 = bitcast [2 x [4 x %struct.TYPE_3__]]* %9 to i8*
%15 = bitcast i8* %14 to [2 x [4 x %struct.TYPE_3__]]*
%16 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %15, i32 0, i32 0
%17 = getelementptr inbounds [4 x %struct.TYPE_3__], [4 x %struct.TYPE_3__]* %16, i32 0, i32 0
%18 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %17, i32 0, i32 1
store double 6.000000e-01, double* %18
%19 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %17, i32 0, i32 3
store double 1.000000e+00, double* %19
%20 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %15, i32 0, i32 1
%21 = getelementptr inbounds [4 x %struct.TYPE_3__], [4 x %struct.TYPE_3__]* %20, i32 0, i32 0
%22 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 0
store double 1.000000e-01, double* %22
%23 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 1
store double 8.000000e-01, double* %23
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 2
store double 1.000000e-01, double* %24
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %21, i32 0, i32 3
store double 1.000000e+00, double* %25
%26 = call i64 @glGenLists(i32 1)
store i64 %26, i64* @DrawGround.ground
%27 = load i64, i64* @DrawGround.ground
%28 = load i32, i32* @GL_COMPILE
%29 = call i32 @glNewList(i64 %27, i32 %28)
%30 = call i32 @glNormal3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%31 = load float, float* %3
%32 = load float, float* %4
%33 = fadd float %31, %32
%34 = fmul float 2.000000e+01, %33
%35 = fneg float %34
%36 = fdiv float %35, 4.000000e+00
store float %36, float* %5
store i32 0, i32* %7
br label %37
37: ; preds = %98, %13
%38 = load i32, i32* %7
%39 = icmp sle i32 %38, 20
br i1 %39, label %40, label %101
40: ; preds = %37
%41 = load i32, i32* %7
%42 = and i32 %41, 1
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = load float, float* %3
br label %48
46: ; preds = %40
%47 = load float, float* %4
br label %48
48: ; preds = %46, %44
%49 = phi float [ %45, %44 ], [ %47, %46 ]
store float %49, float* %10
%50 = load float, float* %3
%51 = load float, float* %4
%52 = fadd float %50, %51
%53 = fmul float 2.000000e+01, %52
%54 = fneg float %53
%55 = fdiv float %54, 4.000000e+00
store float %55, float* %6
%56 = load i32, i32* @GL_QUAD_STRIP
%57 = call i32 @glBegin(i32 %56)
store i32 0, i32* %8
br label %58
58: ; preds = %90, %48
%59 = load i32, i32* %8
%60 = icmp sle i32 %59, 20
br i1 %60, label %61, label %93
61: ; preds = %58
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = add nsw i32 %62, %63
%65 = srem i32 %64, 2
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %9, i64 0, i64 %66
%68 = getelementptr inbounds [4 x %struct.TYPE_3__], [4 x %struct.TYPE_3__]* %67, i64 0, i64 0
%69 = call i32 @glColor4fv(%struct.TYPE_3__* %68)
%70 = load float, float* %5
%71 = load float, float* %10
%72 = fadd float %70, %71
%73 = load float, float* %6
%74 = call i32 @glVertex3f(float %72, double 0.000000e+00, float %73)
%75 = load float, float* %5
%76 = load float, float* %6
%77 = call i32 @glVertex3f(float %75, double 0.000000e+00, float %76)
%78 = load i32, i32* %8
%79 = and i32 %78, 1
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %85
81: ; preds = %61
%82 = load float, float* %3
%83 = load float, float* %6
%84 = fadd float %83, %82
store float %84, float* %6
br label %89
85: ; preds = %61
%86 = load float, float* %4
%87 = load float, float* %6
%88 = fadd float %87, %86
store float %88, float* %6
br label %89
89: ; preds = %85, %81
br label %90
90: ; preds = %89
%91 = load i32, i32* %8
%92 = add nsw i32 %91, 1
store i32 %92, i32* %8
br label %58
93: ; preds = %58
%94 = call i32 (...) @glEnd()
%95 = load float, float* %10
%96 = load float, float* %5
%97 = fadd float %96, %95
store float %97, float* %5
br label %98
98: ; preds = %93
%99 = load i32, i32* %7
%100 = add nsw i32 %99, 1
store i32 %100, i32* %7
br label %37
101: ; preds = %37
%102 = call i32 (...) @glEndList()
br label %103
103: ; preds = %101, %0
%104 = load i64, i64* @DrawGround.ground
%105 = call i32 @glCallList(i64 %104)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { double, double, double, double }
@DrawGround.ground = internal unnamed_addr global i64 0
@GL_COMPILE = global i32 0
@GL_QUAD_STRIP = global i32 0
define void @DrawGround() {
%1 = alloca [2 x [4 x %struct.TYPE_3__]]
%2 = load i64, i64* @DrawGround.ground
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %48
4: ; preds = %0
%5 = bitcast [2 x [4 x %struct.TYPE_3__]]* %1 to i8*
%6 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %1, i64 0, i64 0, i64 0, i32 1
store double 6.000000e-01, double* %6
%7 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %1, i64 0, i64 0, i64 0, i32 3
store double 1.000000e+00, double* %7
%8 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %1, i64 0, i64 1, i64 0, i32 0
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 1.000000e-01, double 8.000000e-01>, <2 x double>* %9
%10 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %1, i64 0, i64 1, i64 0, i32 2
%11 = bitcast double* %10 to <2 x double>*
store <2 x double> <double 1.000000e-01, double 1.000000e+00>, <2 x double>* %11
%12 = tail call i64 @glGenLists(i32 1)
store i64 %12, i64* @DrawGround.ground
%13 = load i32, i32* @GL_COMPILE
%14 = tail call i32 @glNewList(i64 %12, i32 %13)
%15 = tail call i32 @glNormal3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
br label %16
16: ; preds = %4, %41
%17 = phi float [ -7.250000e+00, %4 ], [ %24, %41 ]
%18 = phi i32 [ 0, %4 ], [ %43, %41 ]
%19 = and i32 %18, 1
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, float 0x3FC99999A0000000, float 1.250000e+00
%22 = load i32, i32* @GL_QUAD_STRIP
%23 = call i32 @glBegin(i32 %22)
%24 = fadd float %17, %21
br label %25
25: ; preds = %16, %25
%26 = phi i32 [ 0, %16 ], [ %39, %25 ]
%27 = phi float [ -7.250000e+00, %16 ], [ %38, %25 ]
%28 = add nuw nsw i32 %26, %18
%29 = and i32 %28, 1
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds [2 x [4 x %struct.TYPE_3__]], [2 x [4 x %struct.TYPE_3__]]* %1, i64 0, i64 %30, i64 0
%32 = call i32 @glColor4fv(%struct.TYPE_3__* %31)
%33 = call i32 @glVertex3f(float %24, double 0.000000e+00, float %27)
%34 = call i32 @glVertex3f(float %17, double 0.000000e+00, float %27)
%35 = and i32 %26, 1
%36 = icmp eq i32 %35, 0
%37 = select i1 %36, float 0x3FC99999A0000000, float 1.250000e+00
%38 = fadd float %27, %37
%39 = add nuw nsw i32 %26, 1
%40 = icmp eq i32 %39, 21
br i1 %40, label %41, label %25
41: ; preds = %25
%42 = call i32 (...) @glEnd()
%43 = add nuw nsw i32 %18, 1
%44 = icmp eq i32 %43, 21
br i1 %44, label %45, label %16
45: ; preds = %41
%46 = call i32 (...) @glEndList()
%47 = load i64, i64* @DrawGround.ground
br label %48
48: ; preds = %45, %0
%49 = phi i64 [ %47, %45 ], [ %2, %0 ]
%50 = call i32 @glCallList(i64 %49)
ret void
}