#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_TRIANGLES;
double cos(double);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2d(double, double);
double sin(double);
void drawCircle(double x, double y, double radius) {
  double angle, x1, x2, y1, y2;
  int i;
  x1 = x;
  y1 = y;
  glBegin(GL_TRIANGLES);
  for (i = 0; i <= 360; i += 10) {
    angle = ((double)i) / 57.29577957795135;
    x2 = x + (radius * sin(angle));
    y2 = y + (radius * cos(angle));
    glVertex2d(x, y);
    glVertex2d(x1, y1);
    glVertex2d(x2, y2);
    y1 = y2;
    x1 = x2;
  }
  glEnd();
}


x86 assembly (clang, -O0):
<drawCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x168,-0x44(%rbp)
jg     1272 <drawCircle+0x122>
cvtsi2sdl -0x44(%rbp),%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <glVertex2d@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
call   1050 <glVertex2d@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
call   1050 <glVertex2d@plt>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x44(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x44(%rbp)
jmp    1190 <drawCircle+0x40>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawCircle>:
push   %rbx
sub    $0x40,%rsp
movsd  %xmm2,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorpd  %xmm0,%xmm0
mov    $0xfffffff6,%ebx
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm2,0x30(%rsp)
movsd  %xmm0,0x38(%rsp)
divsd  0xe56(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1040 <sin@plt>
mulsd  0x18(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
mulsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <glVertex2d@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
call   1050 <glVertex2d@plt>
movsd  0x20(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1050 <glVertex2d@plt>
movsd  0x38(%rsp),%xmm0
addsd  0xde9(%rip),%xmm0
add    $0xa,%ebx
movsd  0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
cmp    $0x15f,%ebx
jb     1190 <drawCircle+0x40>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_TRIANGLES = global i32 0
define void @drawCircle(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%13 = load double, double* %4
store double %13, double* %8
%14 = load double, double* %5
store double %14, double* %10
%15 = load i32, i32* @GL_TRIANGLES
%16 = call i32 @glBegin(i32 %15)
store i32 0, i32* %12
br label %17
17: ; preds = %45, %3
%18 = load i32, i32* %12
%19 = icmp sle i32 %18, 360
br i1 %19, label %20, label %48
20: ; preds = %17
%21 = load i32, i32* %12
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 0x404CA5DC1AEF1018
store double %23, double* %7
%24 = load double, double* %4
%25 = load double, double* %6
%26 = load double, double* %7
%27 = call double @sin(double %26)
%28 = call double @llvm.fmuladd.f64(double %25, double %27, double %24)
store double %28, double* %9
%29 = load double, double* %5
%30 = load double, double* %6
%31 = load double, double* %7
%32 = call double @cos(double %31)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double %29)
store double %33, double* %11
%34 = load double, double* %4
%35 = load double, double* %5
%36 = call i32 @glVertex2d(double %34, double %35)
%37 = load double, double* %8
%38 = load double, double* %10
%39 = call i32 @glVertex2d(double %37, double %38)
%40 = load double, double* %9
%41 = load double, double* %11
%42 = call i32 @glVertex2d(double %40, double %41)
%43 = load double, double* %11
store double %43, double* %10
%44 = load double, double* %9
store double %44, double* %8
br label %45
45: ; preds = %20
%46 = load i32, i32* %12
%47 = add nsw i32 %46, 10
store i32 %47, i32* %12
br label %17
48: ; preds = %17
%49 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLES = global i32 0
define void @drawCircle(double %0, double %1, double %2) {
%4 = load i32, i32* @GL_TRIANGLES
%5 = tail call i32 @glBegin(i32 %4)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ 0, %3 ], [ %19, %6 ]
%8 = phi double [ %0, %3 ], [ %13, %6 ]
%9 = phi double [ %1, %3 ], [ %15, %6 ]
%10 = sitofp i32 %7 to double
%11 = fdiv double %10, 0x404CA5DC1AEF1018
%12 = tail call double @sin(double %11)
%13 = tail call double @llvm.fmuladd.f64(double %2, double %12, double %0)
%14 = tail call double @cos(double %11)
%15 = tail call double @llvm.fmuladd.f64(double %2, double %14, double %1)
%16 = tail call i32 @glVertex2d(double %0, double %1)
%17 = tail call i32 @glVertex2d(double %8, double %9)
%18 = tail call i32 @glVertex2d(double %13, double %15)
%19 = add nuw nsw i32 %7, 10
%20 = icmp ult i32 %7, 351
br i1 %20, label %6, label %21
21: ; preds = %6
%22 = tail call i32 (...) @glEnd()
ret void
}