#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_TRIANGLE_STRIP;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glNormal3f(double, double, double);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(double, int, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glScalef(double, double, double);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glVertex2f(float, float);
void drawPlane(int w, int h) {
  int i, j;
  float dw = 1.0 / w;
  float dh = 1.0 / h;
  glPushMatrix();
  glRotatef(-90.0, 1, 0, 0);
  glScalef(1.9, 1.9, 1.0);
  glTranslatef(-0.5, -0.5, 0.0);
  glNormal3f(0.0, 0.0, 1.0);
  for (j = 0; j < h; ++j) {
    glBegin(GL_TRIANGLE_STRIP);
    for (i = 0; i <= w; ++i) {
      glVertex2f(dw * i, dh * (j + 1));
      glVertex2f(dw * i, dh * j);
    }
    glEnd();
  }
  glPopMatrix();
}


x86 assembly (clang, -O0):
<drawPlane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe55(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe3b(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <glPushMatrix@plt>
movsd  0xe37(%rip),%xmm0
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   10a0 <glRotatef@plt>
movsd  0xe19(%rip),%xmm1
movsd  0xe01(%rip),%xmm2
movaps %xmm1,%xmm0
call   1050 <glScalef@plt>
movsd  0xdf9(%rip),%xmm1
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm0
call   1080 <glTranslatef@plt>
xorps  %xmm1,%xmm1
movsd  0xddb(%rip),%xmm2
movaps %xmm1,%xmm0
call   10b0 <glNormal3f@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12cb <drawPlane+0x13b>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     12b6 <drawPlane+0x126>
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm2,%xmm1
call   1070 <glVertex2f@plt>
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtsi2ssl -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm1
call   1070 <glVertex2f@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1255 <drawPlane+0xc5>
mov    $0x0,%al
call   1030 <glEnd@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1234 <drawPlane+0xa4>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawPlane>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r12d
mov    %edi,%r14d
xor    %eax,%eax
call   1060 <glPushMatrix@plt>
movsd  0xe55(%rip),%xmm0
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <glRotatef@plt>
movsd  0xe47(%rip),%xmm0
movaps %xmm0,%xmm1
movsd  0xe2c(%rip),%xmm2
call   1050 <glScalef@plt>
movsd  0xe37(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm1
call   1080 <glTranslatef@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movsd  0xe06(%rip),%xmm2
call   10b0 <glNormal3f@plt>
test   %r12d,%r12d
jle    12ff <drawPlane+0x16f>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  0xde8(%rip),%xmm2
movapd %xmm2,%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
divsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movss  %xmm0,0x8(%rsp)
lea    0x1(%r14),%ebp
mov    0x2da7(%rip),%r15
xor    %ebx,%ebx
jmp    1273 <drawPlane+0xe3>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <glEnd@plt>
mov    %r13d,%ebx
cmp    %r12d,%r13d
je     12ff <drawPlane+0x16f>
mov    (%r15),%edi
call   1090 <glBegin@plt>
lea    0x1(%rbx),%r13d
test   %r14d,%r14d
movss  0x4(%rsp),%xmm1
js     1260 <drawPlane+0xd0>
xorps  %xmm2,%xmm2
cvtsi2ss %r13d,%xmm2
xorps  %xmm3,%xmm3
cvtsi2ss %ebx,%xmm3
movss  0x8(%rsp),%xmm0
mulss  %xmm0,%xmm2
movss  %xmm2,0x10(%rsp)
mulss  %xmm0,%xmm3
movss  %xmm3,0xc(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x4(%rsp),%xmm1
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    12c0 <drawPlane+0x130>
jmp    1260 <drawPlane+0xd0>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <glPopMatrix@plt>

LLVM IR (-O0):
@GL_TRIANGLE_STRIP = global i32 0
define void @drawPlane(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fdiv double 1.000000e+00, %10
%12 = fptrunc double %11 to float
store float %12, float* %7
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = fdiv double 1.000000e+00, %14
%16 = fptrunc double %15 to float
store float %16, float* %8
%17 = call i32 (...) @glPushMatrix()
%18 = call i32 @glRotatef(double -9.000000e+01, i32 1, i32 0, i32 0)
%19 = call i32 @glScalef(double 1.900000e+00, double 1.900000e+00, double 1.000000e+00)
%20 = call i32 @glTranslatef(double -5.000000e-01, double -5.000000e-01, double 0.000000e+00)
%21 = call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
store i32 0, i32* %6
br label %22
22: ; preds = %58, %2
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %61
26: ; preds = %22
%27 = load i32, i32* @GL_TRIANGLE_STRIP
%28 = call i32 @glBegin(i32 %27)
store i32 0, i32* %5
br label %29
29: ; preds = %53, %26
%30 = load i32, i32* %5
%31 = load i32, i32* %3
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %56
33: ; preds = %29
%34 = load float, float* %7
%35 = load i32, i32* %5
%36 = sitofp i32 %35 to float
%37 = fmul float %34, %36
%38 = load float, float* %8
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
%41 = sitofp i32 %40 to float
%42 = fmul float %38, %41
%43 = call i32 @glVertex2f(float %37, float %42)
%44 = load float, float* %7
%45 = load i32, i32* %5
%46 = sitofp i32 %45 to float
%47 = fmul float %44, %46
%48 = load float, float* %8
%49 = load i32, i32* %6
%50 = sitofp i32 %49 to float
%51 = fmul float %48, %50
%52 = call i32 @glVertex2f(float %47, float %51)
br label %53
53: ; preds = %33
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %29
56: ; preds = %29
%57 = call i32 (...) @glEnd()
br label %58
58: ; preds = %56
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %22
61: ; preds = %22
%62 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLE_STRIP = global i32 0
define void @drawPlane(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = fdiv double 1.000000e+00, %3
%5 = fptrunc double %4 to float
%6 = sitofp i32 %1 to double
%7 = fdiv double 1.000000e+00, %6
%8 = fptrunc double %7 to float
%9 = tail call i32 (...) @glPushMatrix()
%10 = tail call i32 @glRotatef(double -9.000000e+01, i32 1, i32 0, i32 0)
%11 = tail call i32 @glScalef(double 1.900000e+00, double 1.900000e+00, double 1.000000e+00)
%12 = tail call i32 @glTranslatef(double -5.000000e-01, double -5.000000e-01, double 0.000000e+00)
%13 = tail call i32 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%14 = icmp sgt i32 %1, 0
br i1 %14, label %15, label %38
15: ; preds = %2
%16 = icmp slt i32 %0, 0
br label %17
17: ; preds = %15, %35
%18 = phi i32 [ 0, %15 ], [ %21, %35 ]
%19 = load i32, i32* @GL_TRIANGLE_STRIP
%20 = tail call i32 @glBegin(i32 %19)
%21 = add nuw nsw i32 %18, 1
br i1 %16, label %35, label %22
22: ; preds = %17
%23 = sitofp i32 %21 to float
%24 = fmul float %8, %23
%25 = sitofp i32 %18 to float
%26 = fmul float %8, %25
br label %27
27: ; preds = %22, %27
%28 = phi i32 [ 0, %22 ], [ %33, %27 ]
%29 = sitofp i32 %28 to float
%30 = fmul float %5, %29
%31 = tail call i32 @glVertex2f(float %30, float %24)
%32 = tail call i32 @glVertex2f(float %30, float %26)
%33 = add nuw i32 %28, 1
%34 = icmp eq i32 %28, %0
br i1 %34, label %35, label %27
35: ; preds = %27, %17
%36 = tail call i32 (...) @glEnd()
%37 = icmp eq i32 %21, %1
br i1 %37, label %38, label %17
38: ; preds = %35, %2
%39 = tail call i32 (...) @glPopMatrix()
ret void
}