#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(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ glVertex2d(double, double);
void glid(int divx, int divy) {
  int extcn, intcn;
  glNormal3f(0, 0, 1);
  for (extcn = 0; extcn < divy; extcn++) {
    glBegin(GL_TRIANGLE_STRIP);
    for (intcn = 0; intcn < (divx + 1); intcn++) {
      glVertex2d((double)intcn / divx - 0.5, (double)extcn / divy - 0.5);
      glVertex2d((double)intcn / divx - 0.5, (double)(extcn + 1) / divy - 0.5);
    }
    glEnd();
  }
}


x86 assembly (clang, -O0):
<glid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1060 <glNormal3f@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    122f <glid+0xef>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    121a <glid+0xda>
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe55(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe3b(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1040 <glVertex2d@plt>
cvtsi2sdl -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe1c(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xdfd(%rip),%xmm2
subsd  %xmm2,%xmm1
call   1040 <glVertex2d@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1184 <glid+0x44>
mov    $0x0,%al
call   1030 <glEnd@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <glid+0x23>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,%r12d
mov    %edi,%r14d
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <glNormal3f@plt>
test   %r12d,%r12d
jle    1243 <glid+0x103>
cvtsi2sd %r14d,%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r12d,%xmm0
movsd  %xmm0,(%rsp)
lea    0x1(%r14),%ebp
mov    0x2e6a(%rip),%r15
xor    %r13d,%r13d
jmp    11b4 <glid+0x74>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r13d
xor    %eax,%eax
call   1030 <glEnd@plt>
cmp    %r12d,%r13d
je     1243 <glid+0x103>
mov    (%r15),%edi
call   1050 <glBegin@plt>
test   %r14d,%r14d
js     11a0 <glid+0x60>
xorps  %xmm2,%xmm2
cvtsi2sd %r13d,%xmm2
movsd  (%rsp),%xmm0
divsd  %xmm0,%xmm2
add    $0x1,%r13d
xorps  %xmm3,%xmm3
cvtsi2sd %r13d,%xmm3
movsd  0xe1a(%rip),%xmm1
addsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
divsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x10(%rsp)
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
divsd  0x8(%rsp),%xmm0
addsd  0xdeb(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm1
call   1040 <glVertex2d@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
call   1040 <glVertex2d@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1200 <glid+0xc0>
jmp    11a4 <glid+0x64>
add    $0x28,%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 @glid(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 @glNormal3f(i32 0, i32 0, i32 1)
store i32 0, i32* %5
br label %8
8: ; preds = %53, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %56
12: ; preds = %8
%13 = load i32, i32* @GL_TRIANGLE_STRIP
%14 = call i32 @glBegin(i32 %13)
store i32 0, i32* %6
br label %15
15: ; preds = %48, %12
%16 = load i32, i32* %6
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %51
20: ; preds = %15
%21 = load i32, i32* %6
%22 = sitofp i32 %21 to double
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to double
%25 = fdiv double %22, %24
%26 = fsub double %25, 5.000000e-01
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to double
%31 = fdiv double %28, %30
%32 = fsub double %31, 5.000000e-01
%33 = call i32 @glVertex2d(double %26, double %32)
%34 = load i32, i32* %6
%35 = sitofp i32 %34 to double
%36 = load i32, i32* %3
%37 = sitofp i32 %36 to double
%38 = fdiv double %35, %37
%39 = fsub double %38, 5.000000e-01
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
%42 = sitofp i32 %41 to double
%43 = load i32, i32* %4
%44 = sitofp i32 %43 to double
%45 = fdiv double %42, %44
%46 = fsub double %45, 5.000000e-01
%47 = call i32 @glVertex2d(double %39, double %46)
br label %48
48: ; preds = %20
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %15
51: ; preds = %15
%52 = call i32 (...) @glEnd()
br label %53
53: ; preds = %51
%54 = load i32, i32* %5
%55 = add nsw i32 %54, 1
store i32 %55, i32* %5
br label %8
56: ; preds = %8
ret void
}

LLVM IR (-O2):
@GL_TRIANGLE_STRIP = global i32 0
define void @glid(i32 %0, i32 %1) {
%3 = tail call i32 @glNormal3f(i32 0, i32 0, i32 1)
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %36
5: ; preds = %2
%6 = icmp slt i32 %0, 0
%7 = sitofp i32 %0 to double
%8 = sitofp i32 %1 to double
br label %9
9: ; preds = %5, %32
%10 = phi i32 [ 0, %5 ], [ %33, %32 ]
%11 = load i32, i32* @GL_TRIANGLE_STRIP
%12 = tail call i32 @glBegin(i32 %11)
br i1 %6, label %13, label %15
13: ; preds = %9
%14 = add nuw nsw i32 %10, 1
br label %32
15: ; preds = %9
%16 = sitofp i32 %10 to double
%17 = fdiv double %16, %8
%18 = fadd double %17, -5.000000e-01
%19 = add nuw nsw i32 %10, 1
%20 = sitofp i32 %19 to double
%21 = fdiv double %20, %8
%22 = fadd double %21, -5.000000e-01
br label %23
23: ; preds = %15, %23
%24 = phi i32 [ 0, %15 ], [ %30, %23 ]
%25 = sitofp i32 %24 to double
%26 = fdiv double %25, %7
%27 = fadd double %26, -5.000000e-01
%28 = tail call i32 @glVertex2d(double %27, double %18)
%29 = tail call i32 @glVertex2d(double %27, double %22)
%30 = add nuw i32 %24, 1
%31 = icmp eq i32 %24, %0
br i1 %31, label %32, label %23
32: ; preds = %23, %13
%33 = phi i32 [ %14, %13 ], [ %19, %23 ]
%34 = tail call i32 (...) @glEnd()
%35 = icmp eq i32 %33, %1
br i1 %35, label %36, label %9
36: ; preds = %32, %2
ret void
}