#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 */
typedef double GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_LINES;
double cos(int);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex3f(double, double, double);
double sin(int);
void drawOrbit() {
  GLfloat x, z;
  GLfloat radius = 1.0;
  int i = 0;
  glBegin(GL_LINES);
  glColor3f(1.0, 1.0, 1.0);
  x = radius * cos(359 * 3.14159 / 180.0);
  z = radius * sin(359 * 3.14159 / 180.0);
  for (i = 0; i < 360; i++) {
    glVertex3f(x, 0.0, z);
    x = (GLfloat)radius * cos(i * 3.14159 / 180.f);
    z = (GLfloat)radius * sin(i * 3.14159 / 180.0);
    glVertex3f(x, 0.0, z);
  }
  glEnd();
}


x86 assembly (clang, -O0):
<drawOrbit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  0xe90(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movsd  0xe6e(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1060 <glColor3f@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    $0x6,%edi
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x6,%edi
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x168,-0x1c(%rbp)
jge    12af <drawOrbit+0x14f>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1030 <glVertex3f@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xdec(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd97(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
xorps  %xmm1,%xmm1
call   1030 <glVertex3f@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ee <drawOrbit+0x8e>
mov    $0x0,%al
call   1040 <glEnd@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawOrbit>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movsd  0xe84(%rip),%xmm0
movapd %xmm0,%xmm1
movapd %xmm0,%xmm2
call   1060 <glColor3f@plt>
mov    $0x6,%edi
call   1070 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x6,%edi
call   1050 <sin@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x168,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
call   1030 <glVertex3f@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0xe2c(%rip),%xmm0
divsd  0xe2c(%rip),%xmm0
cvttsd2si %xmm0,%ebx
mov    %ebx,%edi
call   1070 <cos@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1050 <sin@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm1,%xmm1
movsd  (%rsp),%xmm0
call   1030 <glVertex3f@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
addsd  0xdd9(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0xffffffff,%ebp
jne    11c0 <drawOrbit+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <glEnd@plt>

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

LLVM IR (-O2):
@GL_LINES = global i32 0
define void @drawOrbit() {
%1 = load i32, i32* @GL_LINES
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%4 = tail call double @cos(i32 6)
%5 = tail call double @sin(i32 6)
br label %6
6: ; preds = %0, %6
%7 = phi i32 [ 0, %0 ], [ %18, %6 ]
%8 = phi double [ %4, %0 ], [ %15, %6 ]
%9 = phi double [ %5, %0 ], [ %16, %6 ]
%10 = tail call i32 @glVertex3f(double %8, double 0.000000e+00, double %9)
%11 = sitofp i32 %7 to double
%12 = fmul double %11, 3.141590e+00
%13 = fdiv double %12, 1.800000e+02
%14 = fptosi double %13 to i32
%15 = tail call double @cos(i32 %14)
%16 = tail call double @sin(i32 %14)
%17 = tail call i32 @glVertex3f(double %15, double 0.000000e+00, double %16)
%18 = add nuw nsw i32 %7, 1
%19 = icmp eq i32 %18, 360
br i1 %19, label %20, label %6
20: ; preds = %6
%21 = tail call i32 (...) @glEnd()
ret void
}