#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_LINE_LOOP;
double M_PI;
double cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2d(double, double);
double sin(double);
void elipsa(double a, double b) {
  double t;
  glBegin(GL_LINE_LOOP);
  glVertex2d(a, 0);
  for (t = 0.0; t < 2.0 * M_PI; t += M_PI / 100.0)
    glVertex2d(a * cos(t), b * sin(t));
  glEnd();
}


x86 assembly (clang, -O0):
<elipsa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1050 <glVertex2d@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm0
mov    0x2e4f(%rip),%rax
mulsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    121c <elipsa+0xcc>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm2,%xmm1
call   1050 <glVertex2d@plt>
mov    0x2deb(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xdff(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1185 <elipsa+0x35>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<elipsa>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
call   1050 <glVertex2d@plt>
mov    0x2e63(%rip),%rbx
movsd  (%rbx),%xmm0
addsd  %xmm0,%xmm0
ucomisd 0xe73(%rip),%xmm0
xorpd  %xmm0,%xmm0
jbe    1208 <elipsa+0xb8>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
call   1050 <glVertex2d@plt>
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
divsd  0xe16(%rip),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
addsd  %xmm0,%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
ja     11a0 <elipsa+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_LINE_LOOP = global i32 0
@M_PI = global double 0.000000e+00
define void @elipsa(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load i32, i32* @GL_LINE_LOOP
%7 = call i32 @glBegin(i32 %6)
%8 = load double, double* %3
%9 = call i32 @glVertex2d(double %8, double 0.000000e+00)
store double 0.000000e+00, double* %5
br label %10
10: ; preds = %25, %2
%11 = load double, double* %5
%12 = load double, double* @M_PI
%13 = fmul double 2.000000e+00, %12
%14 = fcmp olt double %11, %13
br i1 %14, label %15, label %30
15: ; preds = %10
%16 = load double, double* %3
%17 = load double, double* %5
%18 = call double @cos(double %17)
%19 = fmul double %16, %18
%20 = load double, double* %4
%21 = load double, double* %5
%22 = call double @sin(double %21)
%23 = fmul double %20, %22
%24 = call i32 @glVertex2d(double %19, double %23)
br label %25
25: ; preds = %15
%26 = load double, double* @M_PI
%27 = fdiv double %26, 1.000000e+02
%28 = load double, double* %5
%29 = fadd double %28, %27
store double %29, double* %5
br label %10
30: ; preds = %10
%31 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_LINE_LOOP = global i32 0
@M_PI = global double 0.000000e+00
define void @elipsa(double %0, double %1) {
%3 = load i32, i32* @GL_LINE_LOOP
%4 = tail call i32 @glBegin(i32 %3)
%5 = tail call i32 @glVertex2d(double %0, double 0.000000e+00)
%6 = load double, double* @M_PI
%7 = fmul double %6, 2.000000e+00
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %21
9: ; preds = %2, %9
%10 = phi double [ %18, %9 ], [ 0.000000e+00, %2 ]
%11 = tail call double @cos(double %10)
%12 = fmul double %11, %0
%13 = tail call double @sin(double %10)
%14 = fmul double %13, %1
%15 = tail call i32 @glVertex2d(double %12, double %14)
%16 = load double, double* @M_PI
%17 = fdiv double %16, 1.000000e+02
%18 = fadd double %10, %17
%19 = fmul double %16, 2.000000e+00
%20 = fcmp olt double %18, %19
br i1 %20, label %9, label %21
21: ; preds = %9, %2
%22 = tail call i32 (...) @glEnd()
ret void
}