#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;
float cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glVertex3f(float, float, float);
float sin(float);
void myCircle(float r, int n) {
  float x, y, z, dq;
  int i;
  dq = 2.0 * 3.1415926534 / (float)n;
  glPushMatrix();
  y = 0.0;
  glBegin(GL_LINE_LOOP);
  for (i = 0; i < n; i++) {
    x = r * cos(dq * (float)i);
    z = r * sin(dq * (float)i);
    glVertex3f(x, y, z);
  }
  glEnd();
  glPopMatrix();
}


x86 assembly (clang, -O0):
<myCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6f(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124c <myCircle+0xdc>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <glVertex3f@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c2 <myCircle+0x52>
mov    $0x0,%al
call   1040 <glEnd@plt>
mov    $0x0,%al
call   1050 <glPopMatrix@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myCircle>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
movss  %xmm0,0x8(%rsp)
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
test   %ebx,%ebx
jle    120d <myCircle+0x9d>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe54(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0xc(%rsp)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
mulss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
call   1080 <cos@plt>
mulss  0x8(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm2
mulss  0x8(%rsp),%xmm2
xorps  %xmm1,%xmm1
movss  0x14(%rsp),%xmm0
call   1030 <glVertex3f@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    11c0 <myCircle+0x50>
xor    %eax,%eax
call   1040 <glEnd@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glPopMatrix@plt>

LLVM IR (-O0):
@GL_LINE_LOOP = global i32 0
define void @myCircle(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
%12 = fpext float %11 to double
%13 = fdiv double 0x401921FB543DA7A8, %12
%14 = fptrunc double %13 to float
store float %14, float* %8
%15 = call i32 (...) @glPushMatrix()
store float 0.000000e+00, float* %6
%16 = load i32, i32* @GL_LINE_LOOP
%17 = call i32 @glBegin(i32 %16)
store i32 0, i32* %9
br label %18
18: ; preds = %41, %2
%19 = load i32, i32* %9
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %44
22: ; preds = %18
%23 = load float, float* %3
%24 = load float, float* %8
%25 = load i32, i32* %9
%26 = sitofp i32 %25 to float
%27 = fmul float %24, %26
%28 = call float @cos(float %27)
%29 = fmul float %23, %28
store float %29, float* %5
%30 = load float, float* %3
%31 = load float, float* %8
%32 = load i32, i32* %9
%33 = sitofp i32 %32 to float
%34 = fmul float %31, %33
%35 = call float @sin(float %34)
%36 = fmul float %30, %35
store float %36, float* %7
%37 = load float, float* %5
%38 = load float, float* %6
%39 = load float, float* %7
%40 = call i32 @glVertex3f(float %37, float %38, float %39)
br label %41
41: ; preds = %22
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
br label %18
44: ; preds = %18
%45 = call i32 (...) @glEnd()
%46 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
@GL_LINE_LOOP = global i32 0
define void @myCircle(float %0, i32 %1) {
%3 = sitofp i32 %1 to float
%4 = fpext float %3 to double
%5 = fdiv double 0x401921FB543DA7A8, %4
%6 = fptrunc double %5 to float
%7 = tail call i32 (...) @glPushMatrix()
%8 = load i32, i32* @GL_LINE_LOOP
%9 = tail call i32 @glBegin(i32 %8)
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %22
11: ; preds = %2, %11
%12 = phi i32 [ %20, %11 ], [ 0, %2 ]
%13 = sitofp i32 %12 to float
%14 = fmul float %6, %13
%15 = tail call float @cos(float %14)
%16 = fmul float %15, %0
%17 = tail call float @sin(float %14)
%18 = fmul float %17, %0
%19 = tail call i32 @glVertex3f(float %16, float 0.000000e+00, float %18)
%20 = add nuw nsw i32 %12, 1
%21 = icmp eq i32 %20, %1
br i1 %21, label %22, label %11
22: ; preds = %11, %2
%23 = tail call i32 (...) @glEnd()
%24 = tail call i32 (...) @glPopMatrix()
ret void
}