#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;
int /*<<< orphan*/ GL_POLYGON;
int M_PI;
float cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(float, float);
float sin(float);
void graphic_draw_circle(float xc, float yc, float r, int filled) {
  int i;
  const int SIDES = 50;
  if (filled == 1)
    glBegin(GL_POLYGON);
  else
    glBegin(GL_LINE_LOOP);
  for (i = 0; i < SIDES; i++) {
    float alpha = i * 2. * M_PI / SIDES;
    glVertex2f(xc + r * cos(alpha), yc + r * sin(alpha));
  }
  glEnd();
}


x86 assembly (clang, -O0):
<graphic_draw_circle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
movl   $0x32,-0x18(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    118e <graphic_draw_circle+0x3e>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
jmp    119c <graphic_draw_circle+0x4c>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jge    1265 <graphic_draw_circle+0x115>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e1b(%rip),%rax
cvtsi2sdl (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2b(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1060 <cos@plt>
movss  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x2c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <sin@plt>
movss  -0x28(%rbp),%xmm1
movss  -0x24(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x20(%rbp),%xmm0
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
call   1050 <glVertex2f@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a3 <graphic_draw_circle+0x53>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphic_draw_circle>:
push   %r14
push   %rbx
sub    $0x28,%rsp
cmp    $0x1,%edi
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
jne    1177 <graphic_draw_circle+0x27>
mov    0x2e83(%rip),%rax
jmp    117e <graphic_draw_circle+0x2e>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
xorpd  %xmm0,%xmm0
mov    $0x32,%ebx
mov    0x2e4b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,0x20(%rsp)
movsd  0x20(%rsp),%xmm0
addsd  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl (%r14),%xmm1
mulsd  %xmm0,%xmm1
divsd  0xe3c(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x18(%rsp)
call   1060 <cos@plt>
mulss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0x18(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
mulss  0xc(%rsp),%xmm1
addss  0x14(%rsp),%xmm1
movss  0x1c(%rsp),%xmm0
call   1050 <glVertex2f@plt>
movsd  0x20(%rsp),%xmm0
addsd  0xded(%rip),%xmm0
add    $0xffffffff,%ebx
jne    11a0 <graphic_draw_circle+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1030 <glEnd@plt>

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

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