#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*/ glVertex2f(float, float);
void drawPlane(int w, int h) {
  int i, j;
  float dw = 1.0 / w;
  float dh = 1.0 / h;
  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();
  }
}


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  0xea5(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe8b(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm1,%xmm1
movsd  0xe73(%rip),%xmm2
movaps %xmm1,%xmm0
call   1060 <glNormal3f@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1233 <drawPlane+0xf3>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     121e <drawPlane+0xde>
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   1040 <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   1040 <glVertex2f@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11bd <drawPlane+0x7d>
mov    $0x0,%al
call   1030 <glEnd@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119c <drawPlane+0x5c>
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
movsd  0xea4(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1060 <glNormal3f@plt>
test   %r12d,%r12d
jle    125f <drawPlane+0x11f>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  0xe80(%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    0x2e3f(%rip),%r15
xor    %ebx,%ebx
jmp    11d3 <drawPlane+0x93>
nopl   (%rax)
xor    %eax,%eax
call   1030 <glEnd@plt>
mov    %r13d,%ebx
cmp    %r12d,%r13d
je     125f <drawPlane+0x11f>
mov    (%r15),%edi
call   1050 <glBegin@plt>
lea    0x1(%rbx),%r13d
test   %r14d,%r14d
movss  0x4(%rsp),%xmm1
js     11c0 <drawPlane+0x80>
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   1040 <glVertex2f@plt>
movss  0x14(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <glVertex2f@plt>
movss  0x4(%rsp),%xmm1
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1220 <drawPlane+0xe0>
jmp    11c0 <drawPlane+0x80>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
store i32 0, i32* %6
br label %18
18: ; preds = %54, %2
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %57
22: ; preds = %18
%23 = load i32, i32* @GL_TRIANGLE_STRIP
%24 = call i32 @glBegin(i32 %23)
store i32 0, i32* %5
br label %25
25: ; preds = %49, %22
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %52
29: ; preds = %25
%30 = load float, float* %7
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to float
%33 = fmul float %30, %32
%34 = load float, float* %8
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
%37 = sitofp i32 %36 to float
%38 = fmul float %34, %37
%39 = call i32 @glVertex2f(float %33, float %38)
%40 = load float, float* %7
%41 = load i32, i32* %5
%42 = sitofp i32 %41 to float
%43 = fmul float %40, %42
%44 = load float, float* %8
%45 = load i32, i32* %6
%46 = sitofp i32 %45 to float
%47 = fmul float %44, %46
%48 = call i32 @glVertex2f(float %43, float %47)
br label %49
49: ; preds = %29
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %25
52: ; preds = %25
%53 = call i32 (...) @glEnd()
br label %54
54: ; preds = %52
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %18
57: ; preds = %18
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 @glNormal3f(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %34
11: ; preds = %2
%12 = icmp slt i32 %0, 0
br label %13
13: ; preds = %11, %31
%14 = phi i32 [ 0, %11 ], [ %17, %31 ]
%15 = load i32, i32* @GL_TRIANGLE_STRIP
%16 = tail call i32 @glBegin(i32 %15)
%17 = add nuw nsw i32 %14, 1
br i1 %12, label %31, label %18
18: ; preds = %13
%19 = sitofp i32 %17 to float
%20 = fmul float %8, %19
%21 = sitofp i32 %14 to float
%22 = fmul float %8, %21
br label %23
23: ; preds = %18, %23
%24 = phi i32 [ 0, %18 ], [ %29, %23 ]
%25 = sitofp i32 %24 to float
%26 = fmul float %5, %25
%27 = tail call i32 @glVertex2f(float %26, float %20)
%28 = tail call i32 @glVertex2f(float %26, float %22)
%29 = add nuw i32 %24, 1
%30 = icmp eq i32 %24, %0
br i1 %30, label %31, label %23
31: ; preds = %23, %13
%32 = tail call i32 (...) @glEnd()
%33 = icmp eq i32 %17, %1
br i1 %33, label %34, label %13
34: ; preds = %31, %2
ret void
}