#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 int GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_LINE_STRIP;
float cos(int);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(float, float, float);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glPointSize(float);
int /*<<< orphan*/ glVertex3f(int, int, int);
float sin(int);
void DrawTorus() {
  GLfloat x, y, z, angle;
  angle = 0.f;
  z = 0.f;
  glColor3f(1.f, .2f, .4f);
  glPointSize(3.f);
  glBegin(GL_LINE_STRIP);
  for (angle = 0.f; angle < 8 * 3.1415f; angle += .5f) {
    x = 50.f * cos(angle);
    y = 50.f * sin(angle);
    glVertex3f(x, y, z);
  }
  glEnd();
}


x86 assembly (clang, -O0):
<DrawTorus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movss  0xe76(%rip),%xmm0
movss  0xe72(%rip),%xmm1
movss  0xe6e(%rip),%xmm2
call   1060 <glColor3f@plt>
movss  0xe55(%rip),%xmm0
call   1070 <glPointSize@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
movl   $0x0,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm1
movss  0xe3e(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1242 <DrawTorus+0xd2>
mov    -0x10(%rbp),%edi
call   1080 <cos@plt>
movaps %xmm0,%xmm1
movss  0xe26(%rip),%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sin@plt>
movaps %xmm0,%xmm1
movss  0xe08(%rip),%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <glVertex3f@plt>
cvtsi2ssl -0x10(%rbp),%xmm0
movss  0xde6(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
jmp    11c5 <DrawTorus+0x55>
mov    $0x0,%al
call   1040 <glEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrawTorus>:
push   %rbx
movss  0xe97(%rip),%xmm0
movss  0xe93(%rip),%xmm1
movss  0xe8f(%rip),%xmm2
call   1050 <glColor3f@plt>
movss  0xe86(%rip),%xmm0
call   1060 <glPointSize@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
nopl   0x0(%rax)
xor    %edi,%edi
call   1070 <cos@plt>
movss  0xe61(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ebx
xor    %edi,%edi
call   1040 <sin@plt>
mulss  0xe4a(%rip),%xmm0
cvttss2si %xmm0,%esi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <glVertex3f@plt>
jmp    11a0 <DrawTorus+0x40>

LLVM IR (-O0):
@GL_LINE_STRIP = global i32 0
define void @DrawTorus() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %4
store i32 0, i32* %3
%5 = call i32 @glColor3f(float 1.000000e+00, float 0x3FC99999A0000000, float 0x3FD99999A0000000)
%6 = call i32 @glPointSize(float 3.000000e+00)
%7 = load i32, i32* @GL_LINE_STRIP
%8 = call i32 @glBegin(i32 %7)
store i32 0, i32* %4
br label %9
9: ; preds = %26, %0
%10 = load i32, i32* %4
%11 = sitofp i32 %10 to float
%12 = fcmp olt float %11, 0x403921CAC0000000
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i32, i32* %4
%15 = call float @cos(i32 %14)
%16 = fmul float 5.000000e+01, %15
%17 = fptosi float %16 to i32
store i32 %17, i32* %1
%18 = load i32, i32* %4
%19 = call float @sin(i32 %18)
%20 = fmul float 5.000000e+01, %19
%21 = fptosi float %20 to i32
store i32 %21, i32* %2
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @glVertex3f(i32 %22, i32 %23, i32 %24)
br label %26
26: ; preds = %13
%27 = load i32, i32* %4
%28 = sitofp i32 %27 to float
%29 = fadd float %28, 5.000000e-01
%30 = fptosi float %29 to i32
store i32 %30, i32* %4
br label %9
31: ; preds = %9
%32 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_LINE_STRIP = global i32 0
define void @DrawTorus() {
%1 = tail call i32 @glColor3f(float 1.000000e+00, float 0x3FC99999A0000000, float 0x3FD99999A0000000)
%2 = tail call i32 @glPointSize(float 3.000000e+00)
%3 = load i32, i32* @GL_LINE_STRIP
%4 = tail call i32 @glBegin(i32 %3)
br label %5
5: ; preds = %5, %0
%6 = tail call float @cos(i32 0)
%7 = fmul float %6, 5.000000e+01
%8 = fptosi float %7 to i32
%9 = tail call float @sin(i32 0)
%10 = fmul float %9, 5.000000e+01
%11 = fptosi float %10 to i32
%12 = tail call i32 @glVertex3f(i32 %8, i32 %11, i32 0)
br label %5
}