#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;
int cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(float, float, float, float);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2f(int, int);
int sin(float);
void display(void) {
  int j, n = 1010, n2;
  n2 = 2 * n;
  float i, theta = 360 / (float)n2;
  glClear(GL_COLOR_BUFFER_BIT);
  glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  glBegin(GL_LINE_LOOP);
  for (i = theta, j = 0; i <= 360, j < n2; i += theta, j++) {
    if (j % 2 == 0)
      glVertex2f(0.5 * cos(i * 3.14159265 / 180),
                 0.5 * sin(i * 3.14159265 / 180));
    else
      glVertex2f(1 * cos(i * 3.14159265 / 180), 1 * sin(i * 3.14159265 / 180));
  }
  glEnd();
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3f2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm1
movss  0xe5b(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1050 <glClearColor@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1321 <display+0x1a1>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1298 <display+0x118>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xddf(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1090 <cos@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdd6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd9e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <sin@plt>
mov    -0x18(%rbp),%edi
cvtsi2sd %eax,%xmm1
movsd  0xd92(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
call   1080 <glVertex2f@plt>
jmp    12ff <display+0x17f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd67(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd53(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1090 <cos@plt>
shl    $0x0,%eax
mov    %eax,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd37(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd23(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <sin@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
shl    $0x0,%esi
call   1080 <glVertex2f@plt>
jmp    1304 <display+0x184>
movss  -0x14(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ec <display+0x6c>
mov    $0x0,%al
call   1040 <glEnd@plt>
mov    $0x0,%al
call   1070 <glFlush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1050 <glClearColor@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   10a0 <glBegin@plt>
movss  0xe47(%rip),%xmm0
xor    %ebp,%ebp
jmp    11ec <display+0x6c>
nopl   (%rax)
movss  (%rsp),%xmm0
call   1060 <sin@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1080 <glVertex2f@plt>
movss  0x4(%rsp),%xmm0
addss  0xe1f(%rip),%xmm0
add    $0x1,%ebp
cmp    $0x7e4,%ebp
je     1257 <display+0xd7>
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
mulsd  0xe0a(%rip),%xmm0
divsd  0xe0a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
call   1090 <cos@plt>
mov    %eax,%ebx
test   $0x1,%bpl
jne    11c0 <display+0x40>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xded(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ebx
movss  (%rsp),%xmm0
call   1060 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xdcc(%rip),%xmm0
cvttsd2si %xmm0,%esi
mov    %ebx,%edi
jmp    11ce <display+0x4e>
xor    %eax,%eax
call   1040 <glEnd@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <glFlush@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @display() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 1010, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 2, %6
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
%10 = fdiv float 3.600000e+02, %9
store float %10, float* %5
%11 = load i32, i32* @GL_COLOR_BUFFER_BIT
%12 = call i32 @glClear(i32 %11)
%13 = call i32 @glClearColor(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
%14 = load i32, i32* @GL_LINE_LOOP
%15 = call i32 @glBegin(i32 %14)
%16 = load float, float* %5
store float %16, float* %4
store i32 0, i32* %1
br label %17
17: ; preds = %65, %0
%18 = load float, float* %4
%19 = fcmp ole float %18, 3.600000e+02
%20 = zext i1 %19 to i32
%21 = load i32, i32* %1
%22 = load i32, i32* %3
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %71
24: ; preds = %17
%25 = load i32, i32* %1
%26 = srem i32 %25, 2
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %48
28: ; preds = %24
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = fmul double %30, 0x400921FB53C8D4F1
%32 = fdiv double %31, 1.800000e+02
%33 = fptrunc double %32 to float
%34 = call i32 @cos(float %33)
%35 = sitofp i32 %34 to double
%36 = fmul double 5.000000e-01, %35
%37 = fptosi double %36 to i32
%38 = load float, float* %4
%39 = fpext float %38 to double
%40 = fmul double %39, 0x400921FB53C8D4F1
%41 = fdiv double %40, 1.800000e+02
%42 = fptrunc double %41 to float
%43 = call i32 @sin(float %42)
%44 = sitofp i32 %43 to double
%45 = fmul double 5.000000e-01, %44
%46 = fptosi double %45 to i32
%47 = call i32 @glVertex2f(i32 %37, i32 %46)
br label %64
48: ; preds = %24
%49 = load float, float* %4
%50 = fpext float %49 to double
%51 = fmul double %50, 0x400921FB53C8D4F1
%52 = fdiv double %51, 1.800000e+02
%53 = fptrunc double %52 to float
%54 = call i32 @cos(float %53)
%55 = mul nsw i32 1, %54
%56 = load float, float* %4
%57 = fpext float %56 to double
%58 = fmul double %57, 0x400921FB53C8D4F1
%59 = fdiv double %58, 1.800000e+02
%60 = fptrunc double %59 to float
%61 = call i32 @sin(float %60)
%62 = mul nsw i32 1, %61
%63 = call i32 @glVertex2f(i32 %55, i32 %62)
br label %64
64: ; preds = %48, %28
br label %65
65: ; preds = %64
%66 = load float, float* %5
%67 = load float, float* %4
%68 = fadd float %67, %66
store float %68, float* %4
%69 = load i32, i32* %1
%70 = add nsw i32 %69, 1
store i32 %70, i32* %1
br label %17
71: ; preds = %17
%72 = call i32 (...) @glEnd()
%73 = call i32 (...) @glFlush()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_LINE_LOOP = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 @glClearColor(float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00)
%4 = load i32, i32* @GL_LINE_LOOP
%5 = tail call i32 @glBegin(i32 %4)
br label %6
6: ; preds = %0, %28
%7 = phi i32 [ 0, %0 ], [ %30, %28 ]
%8 = phi float [ 0x3FC6CFD780000000, %0 ], [ %29, %28 ]
%9 = and i32 %7, 1
%10 = icmp eq i32 %9, 0
%11 = fpext float %8 to double
%12 = fmul double %11, 0x400921FB53C8D4F1
%13 = fdiv double %12, 1.800000e+02
%14 = fptrunc double %13 to float
%15 = tail call i32 @cos(float %14)
br i1 %10, label %16, label %25
16: ; preds = %6
%17 = sitofp i32 %15 to double
%18 = fmul double %17, 5.000000e-01
%19 = fptosi double %18 to i32
%20 = tail call i32 @sin(float %14)
%21 = sitofp i32 %20 to double
%22 = fmul double %21, 5.000000e-01
%23 = fptosi double %22 to i32
%24 = tail call i32 @glVertex2f(i32 %19, i32 %23)
br label %28
25: ; preds = %6
%26 = tail call i32 @sin(float %14)
%27 = tail call i32 @glVertex2f(i32 %15, i32 %26)
br label %28
28: ; preds = %16, %25
%29 = fadd float %8, 0x3FC6CFD780000000
%30 = add nuw nsw i32 %7, 1
%31 = icmp eq i32 %30, 2020
br i1 %31, label %32, label %6
32: ; preds = %28
%33 = tail call i32 (...) @glEnd()
%34 = tail call i32 (...) @glFlush()
ret void
}