#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*/ drawLeg(int, double);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(double, double, double, double);
int /*<<< orphan*/ glScalef(double, double, double);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glutWireSphere(double, int, int);
void drawSpider(void) {
  glPushMatrix();
  glPushMatrix();
  glScalef(1.0, 0.7, 1.3);
  glColor3f(1.0, 0.2, 0.2);
  glutWireSphere(0.2, 12, 12);
  glPopMatrix();
  glPushMatrix();
  glTranslatef(0.0, 0.0, 0.2 * 1.3 + 0.06);
  glColor3f(0.5, 0.5, 1.0);
  glutWireSphere(0.06, 6, 6);
  glPopMatrix();
  glRotatef(90.0, 0.0, 1.0, 0.0);
  glPushMatrix();
  glRotatef(80.0, 0.0, 1.0, 0.0);
  for (int i = 0; i < 3; i++) {
    glRotatef(-40.0, 0.0, 1.0, 0.0);
    drawLeg(i * 120.0, 1.0);
  }
  glPopMatrix();
  glRotatef(180.0, 0.0, 1.0, 0.0);
  glPushMatrix();
  glRotatef(-80.0, 0.0, 1.0, 0.0);
  for (int i = 0; i < 3; i++) {
    glRotatef(40.0, 0.0, 1.0, 0.0);
    drawLeg((((i + 1) * 120) % 360) + 60, -1.0);
  }
  glPopMatrix();
  glPopMatrix();
}


x86 assembly (clang, -O0):
<drawSpider>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
movsd  0xe6a(%rip),%xmm0
movsd  0xe92(%rip),%xmm1
movsd  0xe92(%rip),%xmm2
call   1060 <glScalef@plt>
movsd  0xe4d(%rip),%xmm0
movsd  0xe6d(%rip),%xmm2
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
movsd  0xe5d(%rip),%xmm0
mov    $0xc,%esi
mov    %esi,%edi
call   1080 <glutWireSphere@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
xorps  %xmm1,%xmm1
movsd  0xe30(%rip),%xmm2
movaps %xmm1,%xmm0
call   1090 <glTranslatef@plt>
movsd  0xe18(%rip),%xmm1
movsd  0xdf8(%rip),%xmm2
movaps %xmm1,%xmm0
call   1050 <glColor3f@plt>
movsd  0xdf8(%rip),%xmm0
mov    $0x6,%esi
mov    %esi,%edi
call   1080 <glutWireSphere@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
movsd  0xdd5(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xdc2(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
movsd  0xda3(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xda0(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    12cc <drawSpider+0x14c>
movsd  0xde7(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xd74(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xdbf(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xd4f(%rip),%xmm0
call   1030 <drawLeg@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1277 <drawSpider+0xf7>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
movsd  0xd75(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xd22(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
mov    $0x0,%al
call   1070 <glPushMatrix@plt>
movsd  0xd4b(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xd00(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    136d <drawSpider+0x1ed>
movsd  0xd37(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xcd4(%rip),%xmm2
movaps %xmm3,%xmm1
call   10a0 <glRotatef@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
imul   $0x78,%eax,%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x3c,%edi
movsd  0xcfe(%rip),%xmm0
call   1030 <drawLeg@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1317 <drawSpider+0x197>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
mov    $0x0,%al
call   1040 <glPopMatrix@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawSpider>:
push   %rax
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
movsd  0xe69(%rip),%xmm0
movsd  0xe69(%rip),%xmm1
movsd  0xe69(%rip),%xmm2
call   1060 <glScalef@plt>
movsd  0xe64(%rip),%xmm1
movsd  0xe44(%rip),%xmm0
movaps %xmm1,%xmm2
call   1050 <glColor3f@plt>
movsd  0xe4c(%rip),%xmm0
mov    $0xc,%edi
mov    $0xc,%esi
call   1080 <glutWireSphere@plt>
xor    %eax,%eax
call   1040 <glPopMatrix@plt>
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
movsd  0xe2f(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1090 <glTranslatef@plt>
movsd  0xe24(%rip),%xmm0
movaps %xmm0,%xmm1
movsd  0xdf1(%rip),%xmm2
call   1050 <glColor3f@plt>
movsd  0xe14(%rip),%xmm0
mov    $0x6,%edi
mov    $0x6,%esi
call   1080 <glutWireSphere@plt>
xor    %eax,%eax
call   1040 <glPopMatrix@plt>
movsd  0xdfe(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xdb8(%rip),%xmm2
call   10a0 <glRotatef@plt>
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
movsd  0xde4(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xd96(%rip),%xmm2
call   10a0 <glRotatef@plt>
movsd  0xdd1(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xd7b(%rip),%xmm2
call   10a0 <glRotatef@plt>
xor    %edi,%edi
movsd  0xd6c(%rip),%xmm0
call   1030 <drawLeg@plt>
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xda1(%rip),%xmm0
movsd  0xd51(%rip),%xmm2
call   10a0 <glRotatef@plt>
mov    $0x78,%edi
movsd  0xd3f(%rip),%xmm0
call   1030 <drawLeg@plt>
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xd74(%rip),%xmm0
movsd  0xd24(%rip),%xmm2
call   10a0 <glRotatef@plt>
mov    $0xf0,%edi
movsd  0xd12(%rip),%xmm0
call   1030 <drawLeg@plt>
xor    %eax,%eax
call   1040 <glPopMatrix@plt>
movsd  0xd4e(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xcf0(%rip),%xmm2
call   10a0 <glRotatef@plt>
xor    %eax,%eax
call   1070 <glPushMatrix@plt>
movsd  0xd34(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xcce(%rip),%xmm2
call   10a0 <glRotatef@plt>
movsd  0xd21(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xcb3(%rip),%xmm2
call   10a0 <glRotatef@plt>
movsd  0xd0e(%rip),%xmm0
mov    $0xb4,%edi
call   1030 <drawLeg@plt>
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xcee(%rip),%xmm0
movsd  0xc86(%rip),%xmm2
call   10a0 <glRotatef@plt>
mov    $0x12c,%edi
movsd  0xcdc(%rip),%xmm0
call   1030 <drawLeg@plt>
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xcc1(%rip),%xmm0
movsd  0xc59(%rip),%xmm2
call   10a0 <glRotatef@plt>
mov    $0x3c,%edi
movsd  0xcaf(%rip),%xmm0
call   1030 <drawLeg@plt>
xor    %eax,%eax
call   1040 <glPopMatrix@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glPopMatrix@plt>

LLVM IR (-O0):
define void @drawSpider() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @glPushMatrix()
%4 = call i32 (...) @glPushMatrix()
%5 = call i32 @glScalef(double 1.000000e+00, double 0x3FE6666666666666, double 1.300000e+00)
%6 = call i32 @glColor3f(double 1.000000e+00, double 2.000000e-01, double 2.000000e-01)
%7 = call i32 @glutWireSphere(double 2.000000e-01, i32 12, i32 12)
%8 = call i32 (...) @glPopMatrix()
%9 = call i32 (...) @glPushMatrix()
%10 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 3.200000e-01)
%11 = call i32 @glColor3f(double 5.000000e-01, double 5.000000e-01, double 1.000000e+00)
%12 = call i32 @glutWireSphere(double 6.000000e-02, i32 6, i32 6)
%13 = call i32 (...) @glPopMatrix()
%14 = call i32 @glRotatef(double 9.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%15 = call i32 (...) @glPushMatrix()
%16 = call i32 @glRotatef(double 8.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
store i32 0, i32* %1
br label %17
17: ; preds = %27, %0
%18 = load i32, i32* %1
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = call i32 @glRotatef(double -4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%22 = load i32, i32* %1
%23 = sitofp i32 %22 to double
%24 = fmul double %23, 1.200000e+02
%25 = fptosi double %24 to i32
%26 = call i32 @drawLeg(i32 %25, double 1.000000e+00)
br label %27
27: ; preds = %20
%28 = load i32, i32* %1
%29 = add nsw i32 %28, 1
store i32 %29, i32* %1
br label %17
30: ; preds = %17
%31 = call i32 (...) @glPopMatrix()
%32 = call i32 @glRotatef(double 1.800000e+02, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%33 = call i32 (...) @glPushMatrix()
%34 = call i32 @glRotatef(double -8.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
store i32 0, i32* %2
br label %35
35: ; preds = %46, %30
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 3
br i1 %37, label %38, label %49
38: ; preds = %35
%39 = call i32 @glRotatef(double 4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
%42 = mul nsw i32 %41, 120
%43 = srem i32 %42, 360
%44 = add nsw i32 %43, 60
%45 = call i32 @drawLeg(i32 %44, double -1.000000e+00)
br label %46
46: ; preds = %38
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %35
49: ; preds = %35
%50 = call i32 (...) @glPopMatrix()
%51 = call i32 (...) @glPopMatrix()
ret void
}

LLVM IR (-O2):
define void @drawSpider() {
%1 = tail call i32 (...) @glPushMatrix()
%2 = tail call i32 (...) @glPushMatrix()
%3 = tail call i32 @glScalef(double 1.000000e+00, double 0x3FE6666666666666, double 1.300000e+00)
%4 = tail call i32 @glColor3f(double 1.000000e+00, double 2.000000e-01, double 2.000000e-01)
%5 = tail call i32 @glutWireSphere(double 2.000000e-01, i32 12, i32 12)
%6 = tail call i32 (...) @glPopMatrix()
%7 = tail call i32 (...) @glPushMatrix()
%8 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double 3.200000e-01)
%9 = tail call i32 @glColor3f(double 5.000000e-01, double 5.000000e-01, double 1.000000e+00)
%10 = tail call i32 @glutWireSphere(double 6.000000e-02, i32 6, i32 6)
%11 = tail call i32 (...) @glPopMatrix()
%12 = tail call i32 @glRotatef(double 9.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%13 = tail call i32 (...) @glPushMatrix()
%14 = tail call i32 @glRotatef(double 8.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%15 = tail call i32 @glRotatef(double -4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%16 = tail call i32 @drawLeg(i32 0, double 1.000000e+00)
%17 = tail call i32 @glRotatef(double -4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%18 = tail call i32 @drawLeg(i32 120, double 1.000000e+00)
%19 = tail call i32 @glRotatef(double -4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%20 = tail call i32 @drawLeg(i32 240, double 1.000000e+00)
%21 = tail call i32 (...) @glPopMatrix()
%22 = tail call i32 @glRotatef(double 1.800000e+02, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%23 = tail call i32 (...) @glPushMatrix()
%24 = tail call i32 @glRotatef(double -8.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%25 = tail call i32 @glRotatef(double 4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%26 = tail call i32 @drawLeg(i32 180, double -1.000000e+00)
%27 = tail call i32 @glRotatef(double 4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%28 = tail call i32 @drawLeg(i32 300, double -1.000000e+00)
%29 = tail call i32 @glRotatef(double 4.000000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%30 = tail call i32 @drawLeg(i32 60, double -1.000000e+00)
%31 = tail call i32 (...) @glPopMatrix()
%32 = tail call i32 (...) @glPopMatrix()
ret void
}