#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_FAN;
float cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glTranslatef(float, float, int /*<<< orphan*/);
int /*<<< orphan*/ glVertex2f(float, float);
float sin(double);
void drawCircle(float x, float y, float r) {
  double angle;
  glPushMatrix();
  glTranslatef(x, y, 0);
  glBegin(GL_TRIANGLE_FAN);
  glVertex2f(0, 0);
  for (angle = 0.0; angle <= 2 * 3.14159265358979323846;
       angle += 3.14159265358979323846 / 24) {
    glVertex2f(r * cos(angle), r * sin(angle));
  }
  glEnd();
  glPopMatrix();
}


x86 assembly (clang, -O0):
<drawCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    $0x0,%al
call   1060 <glPushMatrix@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
xor    %edi,%edi
call   1090 <glTranslatef@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1070 <glVertex2f@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe28(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1249 <drawCircle+0xc9>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
mulss  %xmm2,%xmm1
call   1070 <glVertex2f@plt>
movsd  0xdce(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d0 <drawCircle+0x50>
mov    $0x0,%al
call   1030 <glEnd@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawCircle>:
sub    $0x18,%rsp
movss  %xmm2,0x14(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1060 <glPushMatrix@plt>
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
xor    %edi,%edi
call   1090 <glTranslatef@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
call   1070 <glVertex2f@plt>
xorpd  %xmm0,%xmm0
nop
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1080 <cos@plt>
mulss  0x14(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0x14(%rsp),%xmm1
movss  0x4(%rsp),%xmm0
call   1070 <glVertex2f@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xde6(%rip),%xmm0
movsd  0xde6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11d0 <drawCircle+0x50>
xor    %eax,%eax
call   1030 <glEnd@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1040 <glPopMatrix@plt>

LLVM IR (-O0):
@GL_TRIANGLE_FAN = global i32 0
define void @drawCircle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca double
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = call i32 (...) @glPushMatrix()
%9 = load float, float* %4
%10 = load float, float* %5
%11 = call i32 @glTranslatef(float %9, float %10, i32 0)
%12 = load i32, i32* @GL_TRIANGLE_FAN
%13 = call i32 @glBegin(i32 %12)
%14 = call i32 @glVertex2f(float 0.000000e+00, float 0.000000e+00)
store double 0.000000e+00, double* %7
br label %15
15: ; preds = %28, %3
%16 = load double, double* %7
%17 = fcmp ole double %16, 0x401921FB54442D18
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load float, float* %6
%20 = load double, double* %7
%21 = call float @cos(double %20)
%22 = fmul float %19, %21
%23 = load float, float* %6
%24 = load double, double* %7
%25 = call float @sin(double %24)
%26 = fmul float %23, %25
%27 = call i32 @glVertex2f(float %22, float %26)
br label %28
28: ; preds = %18
%29 = load double, double* %7
%30 = fadd double %29, 0x3FC0C152382D7365
store double %30, double* %7
br label %15
31: ; preds = %15
%32 = call i32 (...) @glEnd()
%33 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLE_FAN = global i32 0
define void @drawCircle(float %0, float %1, float %2) {
%4 = tail call i32 (...) @glPushMatrix()
%5 = tail call i32 @glTranslatef(float %0, float %1, i32 0)
%6 = load i32, i32* @GL_TRIANGLE_FAN
%7 = tail call i32 @glBegin(i32 %6)
%8 = tail call i32 @glVertex2f(float 0.000000e+00, float 0.000000e+00)
br label %9
9: ; preds = %3, %9
%10 = phi double [ 0.000000e+00, %3 ], [ %16, %9 ]
%11 = tail call float @cos(double %10)
%12 = fmul float %11, %2
%13 = tail call float @sin(double %10)
%14 = fmul float %13, %2
%15 = tail call i32 @glVertex2f(float %12, float %14)
%16 = fadd double %10, 0x3FC0C152382D7365
%17 = fcmp ugt double %16, 0x401921FB54442D18
br i1 %17, label %18, label %9
18: ; preds = %9
%19 = tail call i32 (...) @glEnd()
%20 = tail call i32 (...) @glPopMatrix()
ret void
}