#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(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(float, float);
float sin(float);
void DrawCircle() {
  float fx = 0.0;
  float fy = 0.0;
  int nDegrees = 0;
  glBegin(GL_TRIANGLE_FAN);
  glVertex2f(0.0, 0.0);
  for (nDegrees = 0; nDegrees < 360; nDegrees += 10) {
    fx = sin((float)nDegrees * 3.14159265 / 180);
    fy = cos((float)nDegrees * 3.14159265 / 180);
    glVertex2f(fx, fy);
  }
  glVertex2f(0.0f, 1.0f);
  glEnd();
}


x86 assembly (clang, -O0):
<DrawCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1050 <glVertex2f@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x168,-0xc(%rbp)
jge    1217 <DrawCircle+0xc7>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe63(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x4(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe34(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe20(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <cos@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1050 <glVertex2f@plt>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
jmp    118f <DrawCircle+0x3f>
xorps  %xmm0,%xmm0
movss  0xdde(%rip),%xmm1
call   1050 <glVertex2f@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawCircle>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1050 <glVertex2f@plt>
mov    $0xfffffff6,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xa,%ebx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe6a(%rip),%xmm0
divsd  0xe6a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
call   1040 <sin@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
call   1050 <glVertex2f@plt>
cmp    $0x15e,%ebx
jb     1180 <DrawCircle+0x30>
movss  0xe34(%rip),%xmm1
xorps  %xmm0,%xmm0
call   1050 <glVertex2f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_TRIANGLE_FAN = global i32 0
define void @DrawCircle() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
store float 0.000000e+00, float* %1
store float 0.000000e+00, float* %2
store i32 0, i32* %3
%4 = load i32, i32* @GL_TRIANGLE_FAN
%5 = call i32 @glBegin(i32 %4)
%6 = call i32 @glVertex2f(float 0.000000e+00, float 0.000000e+00)
store i32 0, i32* %3
br label %7
7: ; preds = %28, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 360
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = fpext float %12 to double
%14 = fmul double %13, 0x400921FB53C8D4F1
%15 = fdiv double %14, 1.800000e+02
%16 = fptrunc double %15 to float
%17 = call float @sin(float %16)
store float %17, float* %1
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to float
%20 = fpext float %19 to double
%21 = fmul double %20, 0x400921FB53C8D4F1
%22 = fdiv double %21, 1.800000e+02
%23 = fptrunc double %22 to float
%24 = call float @cos(float %23)
store float %24, float* %2
%25 = load float, float* %1
%26 = load float, float* %2
%27 = call i32 @glVertex2f(float %25, float %26)
br label %28
28: ; preds = %10
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 10
store i32 %30, i32* %3
br label %7
31: ; preds = %7
%32 = call i32 @glVertex2f(float 0.000000e+00, float 1.000000e+00)
%33 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLE_FAN = global i32 0
define void @DrawCircle() {
%1 = load i32, i32* @GL_TRIANGLE_FAN
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glVertex2f(float 0.000000e+00, float 0.000000e+00)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %14, %4 ]
%6 = sitofp i32 %5 to float
%7 = fpext float %6 to double
%8 = fmul double %7, 0x400921FB53C8D4F1
%9 = fdiv double %8, 1.800000e+02
%10 = fptrunc double %9 to float
%11 = tail call float @sin(float %10)
%12 = tail call float @cos(float %10)
%13 = tail call i32 @glVertex2f(float %11, float %12)
%14 = add nuw nsw i32 %5, 10
%15 = icmp ult i32 %5, 350
br i1 %15, label %4, label %16
16: ; preds = %4
%17 = tail call i32 @glVertex2f(float 0.000000e+00, float 1.000000e+00)
%18 = tail call i32 (...) @glEnd()
ret void
}