#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_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_LINE_LOOP;
double cos(int);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex3d(double, double, int /*<<< orphan*/);
int /*<<< orphan*/ glutSwapBuffers();
double sin(int);
void wyswietl() {
  glClearColor(0.0, 0.0, 1.0, 1.0);
  glClear(GL_COLOR_BUFFER_BIT);
  int n;
  glBegin(GL_LINE_LOOP);
  n = 10;
  double PI = 3.14, fi, x, y;
  fi = 2 * PI / n;
  for (int i = 0; i < n; i++) {
    x = cos(i * fi);
    y = sin(i * fi);
    glVertex3d(x, y, 0);
  }
  glEnd();
  glFlush();
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<wyswietl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xorps  %xmm1,%xmm1
movsd  0xe6d(%rip),%xmm3
movaps %xmm1,%xmm0
movaps %xmm3,%xmm2
call   1070 <glClearColor@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
movl   $0xa,-0x4(%rbp)
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe1a(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    125b <wyswietl+0xcb>
cvtsi2sdl -0x2c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   10a0 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sin@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1200 <wyswietl+0x70>
mov    $0x0,%al
call   1060 <glEnd@plt>
mov    $0x0,%al
call   1090 <glFlush@plt>
mov    $0x0,%al
call   1050 <glutSwapBuffers@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wyswietl>:
push   %rax
movsd  0xe67(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movaps %xmm2,%xmm3
call   1070 <glClearColor@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
call   10b0 <glBegin@plt>
xor    %edi,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
xor    %edi,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
xor    %edi,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x1,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x1,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x1,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x2,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x3,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x3,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x3,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x4,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x4,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x5,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x5,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
mov    $0x5,%edi
call   10a0 <cos@plt>
movsd  %xmm0,(%rsp)
mov    $0x5,%edi
call   1080 <sin@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
xor    %edi,%edi
call   1040 <glVertex3d@plt>
xor    %eax,%eax
call   1060 <glEnd@plt>
xor    %eax,%eax
call   1090 <glFlush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glutSwapBuffers@plt>

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

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @wyswietl() {
%1 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 1.000000e+00, double 1.000000e+00)
%2 = load i32, i32* @GL_COLOR_BUFFER_BIT
%3 = tail call i32 @glClear(i32 %2)
%4 = load i32, i32* @GL_LINE_LOOP
%5 = tail call i32 @glBegin(i32 %4)
%6 = tail call double @cos(i32 0)
%7 = tail call double @sin(i32 0)
%8 = tail call i32 @glVertex3d(double %6, double %7, i32 0)
%9 = tail call double @cos(i32 0)
%10 = tail call double @sin(i32 0)
%11 = tail call i32 @glVertex3d(double %9, double %10, i32 0)
%12 = tail call double @cos(i32 1)
%13 = tail call double @sin(i32 1)
%14 = tail call i32 @glVertex3d(double %12, double %13, i32 0)
%15 = tail call double @cos(i32 1)
%16 = tail call double @sin(i32 1)
%17 = tail call i32 @glVertex3d(double %15, double %16, i32 0)
%18 = tail call double @cos(i32 2)
%19 = tail call double @sin(i32 2)
%20 = tail call i32 @glVertex3d(double %18, double %19, i32 0)
%21 = tail call double @cos(i32 3)
%22 = tail call double @sin(i32 3)
%23 = tail call i32 @glVertex3d(double %21, double %22, i32 0)
%24 = tail call double @cos(i32 3)
%25 = tail call double @sin(i32 3)
%26 = tail call i32 @glVertex3d(double %24, double %25, i32 0)
%27 = tail call double @cos(i32 4)
%28 = tail call double @sin(i32 4)
%29 = tail call i32 @glVertex3d(double %27, double %28, i32 0)
%30 = tail call double @cos(i32 5)
%31 = tail call double @sin(i32 5)
%32 = tail call i32 @glVertex3d(double %30, double %31, i32 0)
%33 = tail call double @cos(i32 5)
%34 = tail call double @sin(i32 5)
%35 = tail call i32 @glVertex3d(double %33, double %34, i32 0)
%36 = tail call i32 (...) @glEnd()
%37 = tail call i32 (...) @glFlush()
%38 = tail call i32 (...) @glutSwapBuffers()
ret void
}