#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_STRIP;
float cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex3f(float, float, float);
float sin(float);
void drawCircle(float cx, float cy, float r) {
  float i, theta, fi;
  fi = 2.0f * 3.14f / 100.0f;
  glBegin(GL_LINE_STRIP);
  for (i = 0; i < 100; i++) {
    theta = i * 2.0f * 3.14f / 100.0f;
    glVertex3f(cx + r * cos(theta), cy + r * sin(theta), -5.0f);
    glVertex3f(cx + r * cos(theta + fi), cy + r * sin(theta + fi), -5.0f);
  }
  glEnd();
}


x86 assembly (clang, -O0):
<drawCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  0xe91(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe72(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    12e1 <drawCircle+0x191>
movss  0xe6c(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  0xe5b(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe47(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <cos@plt>
movss  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x3c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sin@plt>
movss  -0x38(%rbp),%xmm1
movss  -0x34(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x30(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  0xdca(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
call   1060 <cos@plt>
movss  -0x2c(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x28(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
call   1050 <sin@plt>
movss  -0x24(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x1c(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  0xd43(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0xd42(%rip),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    118a <drawCircle+0x3a>
mov    $0x0,%al
call   1040 <glEnd@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawCircle>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x1c(%rsp)
movss  %xmm0,0x18(%rsp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
addss  %xmm0,%xmm0
mulss  0xe6d(%rip),%xmm0
divss  0xe69(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
mulss  0xc(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xc(%rsp),%xmm1
addss  0x1c(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
movss  0xe28(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0x10(%rsp),%xmm0
addss  0xe19(%rip),%xmm0
movss  %xmm0,0x10(%rsp)
call   1060 <cos@plt>
mulss  0xc(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x10(%rsp),%xmm0
call   1050 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xc(%rsp),%xmm1
addss  0x1c(%rsp),%xmm1
movss  0x14(%rsp),%xmm0
movss  0xdd0(%rip),%xmm2
call   1030 <glVertex3f@plt>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1180 <drawCircle+0x30>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1040 <glEnd@plt>

LLVM IR (-O0):
@GL_LINE_STRIP = global i32 0
define void @drawCircle(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
store float 0x3FB013A940000000, float* %9
%10 = load i32, i32* @GL_LINE_STRIP
%11 = call i32 @glBegin(i32 %10)
store float 0.000000e+00, float* %7
br label %12
12: ; preds = %46, %3
%13 = load float, float* %7
%14 = fcmp olt float %13, 1.000000e+02
br i1 %14, label %15, label %49
15: ; preds = %12
%16 = load float, float* %7
%17 = fmul float %16, 2.000000e+00
%18 = fmul float %17, 0x40091EB860000000
%19 = fdiv float %18, 1.000000e+02
store float %19, float* %8
%20 = load float, float* %4
%21 = load float, float* %6
%22 = load float, float* %8
%23 = call float @cos(float %22)
%24 = call float @llvm.fmuladd.f32(float %21, float %23, float %20)
%25 = load float, float* %5
%26 = load float, float* %6
%27 = load float, float* %8
%28 = call float @sin(float %27)
%29 = call float @llvm.fmuladd.f32(float %26, float %28, float %25)
%30 = call i32 @glVertex3f(float %24, float %29, float -5.000000e+00)
%31 = load float, float* %4
%32 = load float, float* %6
%33 = load float, float* %8
%34 = load float, float* %9
%35 = fadd float %33, %34
%36 = call float @cos(float %35)
%37 = call float @llvm.fmuladd.f32(float %32, float %36, float %31)
%38 = load float, float* %5
%39 = load float, float* %6
%40 = load float, float* %8
%41 = load float, float* %9
%42 = fadd float %40, %41
%43 = call float @sin(float %42)
%44 = call float @llvm.fmuladd.f32(float %39, float %43, float %38)
%45 = call i32 @glVertex3f(float %37, float %44, float -5.000000e+00)
br label %46
46: ; preds = %15
%47 = load float, float* %7
%48 = fadd float %47, 1.000000e+00
store float %48, float* %7
br label %12
49: ; preds = %12
%50 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_LINE_STRIP = global i32 0
define void @drawCircle(float %0, float %1, float %2) {
%4 = load i32, i32* @GL_LINE_STRIP
%5 = tail call i32 @glBegin(i32 %4)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ 0, %3 ], [ %23, %6 ]
%8 = sitofp i32 %7 to float
%9 = fmul float %8, 2.000000e+00
%10 = fmul float %9, 0x40091EB860000000
%11 = fdiv float %10, 1.000000e+02
%12 = tail call float @cos(float %11)
%13 = tail call float @llvm.fmuladd.f32(float %2, float %12, float %0)
%14 = tail call float @sin(float %11)
%15 = tail call float @llvm.fmuladd.f32(float %2, float %14, float %1)
%16 = tail call i32 @glVertex3f(float %13, float %15, float -5.000000e+00)
%17 = fadd float %11, 0x3FB013A940000000
%18 = tail call float @cos(float %17)
%19 = tail call float @llvm.fmuladd.f32(float %2, float %18, float %0)
%20 = tail call float @sin(float %17)
%21 = tail call float @llvm.fmuladd.f32(float %2, float %20, float %1)
%22 = tail call i32 @glVertex3f(float %19, float %21, float -5.000000e+00)
%23 = add nuw nsw i32 %7, 1
%24 = icmp eq i32 %23, 100
br i1 %24, label %25, label %6
25: ; preds = %6
%26 = tail call i32 (...) @glEnd()
ret void
}