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

/* Variables and functions */
int /*<<< orphan*/ GL_QUAD_STRIP;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glEvalCoord2d(double, float);
void DrawMapEval2(float du, float dv) {
  float u, v, tmp;
  glColor3f(1.0, 0.0, 0.0);
  for (v = 0.0; v < 1.0; v += dv) {
    glBegin(GL_QUAD_STRIP);
    for (u = 0.0; u <= 1.0; u += du) {
      glEvalCoord2d(u, v);
      tmp = (v + dv < 1.0) ? (v + dv) : 1.0;
      glEvalCoord2d(u, tmp);
    }
    glEvalCoord2d(1.0, v);
    glEvalCoord2d(1.0, v + dv);
    glEnd();
  }
}


x86 assembly (clang, -O0):
<DrawMapEval2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movsd  0xea6(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1040 <glColor3f@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe82(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    128f <DrawMapEval2+0x14f>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     124b <DrawMapEval2+0x10b>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
call   1050 <glEvalCoord2d@plt>
movss  -0x10(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe1e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1204 <DrawMapEval2+0xc4>
movss  -0x10(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1216 <DrawMapEval2+0xd6>
movsd  0xdf4(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1216 <DrawMapEval2+0xd6>
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
call   1050 <glEvalCoord2d@plt>
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    119e <DrawMapEval2+0x5e>
movss  -0x10(%rbp),%xmm1
movsd  0xda8(%rip),%xmm0
call   1050 <glEvalCoord2d@plt>
movss  -0x10(%rbp),%xmm1
addss  -0x8(%rbp),%xmm1
movsd  0xd91(%rip),%xmm0
call   1050 <glEvalCoord2d@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    116d <DrawMapEval2+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawMapEval2>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
movsd  0xea7(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1040 <glColor3f@plt>
xorps  %xmm0,%xmm0
mov    0x2e7a(%rip),%rbx
xorps  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
mov    (%rbx),%edi
call   1060 <glBegin@plt>
movss  (%rsp),%xmm0
addss  0x8(%rsp),%xmm0
movss  %xmm0,(%rsp)
minss  0xe5e(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
xorps  %xmm2,%xmm2
xorps  %xmm1,%xmm1
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm2,0x18(%rsp)
movss  %xmm1,0x14(%rsp)
movaps %xmm2,%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <glEvalCoord2d@plt>
movsd  0x18(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
call   1050 <glEvalCoord2d@plt>
movss  0x14(%rsp),%xmm1
addss  0xc(%rsp),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
movss  0xe02(%rip),%xmm0
ucomiss %xmm1,%xmm0
jae    11c0 <DrawMapEval2+0x80>
movsd  0xded(%rip),%xmm0
movss  0x4(%rsp),%xmm1
call   1050 <glEvalCoord2d@plt>
movsd  0xdda(%rip),%xmm0
movss  (%rsp),%xmm1
call   1050 <glEvalCoord2d@plt>
xor    %eax,%eax
call   1030 <glEnd@plt>
movss  (%rsp),%xmm1
movss  0xdc4(%rip),%xmm0
ucomiss %xmm1,%xmm0
movaps %xmm1,%xmm0
ja     1180 <DrawMapEval2+0x40>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@GL_QUAD_STRIP = global i32 0
define void @DrawMapEval2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
store float 0.000000e+00, float* %6
br label %9
9: ; preds = %55, %2
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fcmp olt double %11, 1.000000e+00
br i1 %12, label %13, label %59
13: ; preds = %9
%14 = load i32, i32* @GL_QUAD_STRIP
%15 = call i32 @glBegin(i32 %14)
store float 0.000000e+00, float* %5
br label %16
16: ; preds = %43, %13
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = fcmp ole double %18, 1.000000e+00
br i1 %19, label %20, label %47
20: ; preds = %16
%21 = load float, float* %5
%22 = fpext float %21 to double
%23 = load float, float* %6
%24 = call i32 @glEvalCoord2d(double %22, float %23)
%25 = load float, float* %6
%26 = load float, float* %4
%27 = fadd float %25, %26
%28 = fpext float %27 to double
%29 = fcmp olt double %28, 1.000000e+00
br i1 %29, label %30, label %35
30: ; preds = %20
%31 = load float, float* %6
%32 = load float, float* %4
%33 = fadd float %31, %32
%34 = fpext float %33 to double
br label %36
35: ; preds = %20
br label %36
36: ; preds = %35, %30
%37 = phi double [ %34, %30 ], [ 1.000000e+00, %35 ]
%38 = fptrunc double %37 to float
store float %38, float* %7
%39 = load float, float* %5
%40 = fpext float %39 to double
%41 = load float, float* %7
%42 = call i32 @glEvalCoord2d(double %40, float %41)
br label %43
43: ; preds = %36
%44 = load float, float* %3
%45 = load float, float* %5
%46 = fadd float %45, %44
store float %46, float* %5
br label %16
47: ; preds = %16
%48 = load float, float* %6
%49 = call i32 @glEvalCoord2d(double 1.000000e+00, float %48)
%50 = load float, float* %6
%51 = load float, float* %4
%52 = fadd float %50, %51
%53 = call i32 @glEvalCoord2d(double 1.000000e+00, float %52)
%54 = call i32 (...) @glEnd()
br label %55
55: ; preds = %47
%56 = load float, float* %4
%57 = load float, float* %6
%58 = fadd float %57, %56
store float %58, float* %6
br label %9
59: ; preds = %9
ret void
}

LLVM IR (-O2):
@GL_QUAD_STRIP = global i32 0
define void @DrawMapEval2(float %0, float %1) {
%3 = tail call i32 @glColor3f(double 1.000000e+00, double 0.000000e+00, double 0.000000e+00)
br label %4
4: ; preds = %2, %19
%5 = phi float [ 0.000000e+00, %2 ], [ %8, %19 ]
%6 = load i32, i32* @GL_QUAD_STRIP
%7 = tail call i32 @glBegin(i32 %6)
%8 = fadd float %5, %1
%9 = fcmp olt float %8, 1.000000e+00
%10 = select i1 %9, float %8, float 1.000000e+00
br label %11
11: ; preds = %4, %11
%12 = phi double [ 0.000000e+00, %4 ], [ %17, %11 ]
%13 = phi float [ 0.000000e+00, %4 ], [ %16, %11 ]
%14 = tail call i32 @glEvalCoord2d(double %12, float %5)
%15 = tail call i32 @glEvalCoord2d(double %12, float %10)
%16 = fadd float %13, %0
%17 = fpext float %16 to double
%18 = fcmp ugt float %16, 1.000000e+00
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = tail call i32 @glEvalCoord2d(double 1.000000e+00, float %5)
%21 = tail call i32 @glEvalCoord2d(double 1.000000e+00, float %8)
%22 = tail call i32 (...) @glEnd()
br i1 %9, label %4, label %23
23: ; preds = %19
ret void
}