#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 cos(float);
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ glVertex2f(float, float);
int sin(float);
void drawCircle(int x, int y, int r) {
  int i;
  float tx, ty;
  float thita = 0;
  float incrThita = 12 * 3.1415 / 180;
  glBegin(GL_LINE_LOOP);
  for (i = 0; i < 30; i++) {
    tx = x + r * sin(thita + incrThita);
    ty = y + r * cos(thita += incrThita);
    glVertex2f(tx, ty);
  }
  glEnd();
  glFlush();
}


x86 assembly (clang, -O0):
<drawCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe7f(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e,-0x10(%rbp)
jge    1229 <drawCircle+0xc9>
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x30(%rbp)
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
call   1040 <sin@plt>
mov    -0x30(%rbp),%ecx
mov    %eax,%edx
mov    -0x2c(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
call   1070 <cos@plt>
mov    -0x28(%rbp),%ecx
mov    %eax,%edx
mov    -0x24(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1060 <glVertex2f@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119b <drawCircle+0x3b>
mov    $0x0,%al
call   1030 <glEnd@plt>
mov    $0x0,%al
call   1050 <glFlush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawCircle>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%r15d
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
mov    $0x1e,%ebp
nopw   0x0(%rax,%rax,1)
movss  (%rsp),%xmm0
addss  0xe63(%rip),%xmm0
movss  %xmm0,(%rsp)
call   1040 <sin@plt>
imul   %ebx,%eax
add    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1070 <cos@plt>
imul   %ebx,%eax
add    %r14d,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  0x4(%rsp),%xmm0
call   1060 <glVertex2f@plt>
add    $0xffffffff,%ebp
jne    1190 <drawCircle+0x30>
xor    %eax,%eax
call   1030 <glEnd@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <glFlush@plt>

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

LLVM IR (-O2):
@GL_LINE_LOOP = global i32 0
define void @drawCircle(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @GL_LINE_LOOP
%5 = tail call i32 @glBegin(i32 %4)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ 0, %3 ], [ %19, %6 ]
%8 = phi float [ 0.000000e+00, %3 ], [ %9, %6 ]
%9 = fadd float %8, 0x3FCACEB620000000
%10 = tail call i32 @sin(float %9)
%11 = mul nsw i32 %10, %2
%12 = add nsw i32 %11, %0
%13 = sitofp i32 %12 to float
%14 = tail call i32 @cos(float %9)
%15 = mul nsw i32 %14, %2
%16 = add nsw i32 %15, %1
%17 = sitofp i32 %16 to float
%18 = tail call i32 @glVertex2f(float %13, float %17)
%19 = add nuw nsw i32 %7, 1
%20 = icmp eq i32 %19, 30
br i1 %20, label %21, label %6
21: ; preds = %6
%22 = tail call i32 (...) @glEnd()
%23 = tail call i32 (...) @glFlush()
ret void
}