#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*/ circ(double, double, float);
int /*<<< orphan*/ closeobj();
double cos(double);
int /*<<< orphan*/ makeobj(long);
int /*<<< orphan*/ popmatrix();
int /*<<< orphan*/ pushmatrix();
int /*<<< orphan*/ rotate(int, char);
double sin(double);
int /*<<< orphan*/ translate(double, double, float);
void makesphere() {
  float r, z;
  int i, a;
  makeobj(1L);
  for (i = 0; i < 1800; i += 200) {
    pushmatrix();
    rotate(i, 'y');
    circ(0.0, 0.0, 10.0);
    popmatrix();
  }
  pushmatrix();
  rotate(900, 'x');
  for (a = -900; a < 900; a += 200) {
    r = 10.0 * cos((double)a * 3.14159265358979 / 180.0);
    z = 10.0 * sin((double)a * 3.14159265358979 / 180.0);
    pushmatrix();
    translate(0.0, 0.0, -z);
    circ(0.0, 0.0, r);
    popmatrix();
  }
  popmatrix();
  closeobj();
}


x86 assembly (clang, -O0):
<makesphere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1080 <makeobj@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x708,-0xc(%rbp)
jge    11f4 <makesphere+0x64>
mov    $0x0,%al
call   10b0 <pushmatrix@plt>
mov    -0xc(%rbp),%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm1,%xmm1
movss  0xe43(%rip),%xmm2
movaps %xmm1,%xmm0
call   1050 <circ@plt>
mov    $0x0,%al
call   1030 <popmatrix@plt>
mov    -0xc(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0xc(%rbp)
jmp    11a9 <makesphere+0x19>
mov    $0x0,%al
call   10b0 <pushmatrix@plt>
mov    $0x384,%edi
mov    $0x78,%esi
call   1070 <rotate@plt>
movl   $0xfffffc7c,-0x10(%rbp)
cmpl   $0x384,-0x10(%rbp)
jge    12dd <makesphere+0x14d>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xde5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdd1(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xdb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd97(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1060 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xd7b(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   10b0 <pushmatrix@plt>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   10a0 <translate@plt>
movss  -0x4(%rbp),%xmm2
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1050 <circ@plt>
mov    $0x0,%al
call   1030 <popmatrix@plt>
mov    -0x10(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0x10(%rbp)
jmp    1211 <makesphere+0x81>
mov    $0x0,%al
call   1030 <popmatrix@plt>
mov    $0x0,%al
call   1040 <closeobj@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makesphere>:
push   %rbx
sub    $0x30,%rsp
mov    $0x1,%edi
call   1080 <makeobj@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
xor    %edi,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
movss  0xe46(%rip),%xmm2
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0xc8,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xe0e(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x190,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xddd(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x258,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xdac(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x320,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xd7b(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x3e8,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xd4a(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x4b0,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xd19(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x578,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xce8(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x640,%edi
mov    $0x79,%esi
call   1070 <rotate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xcb7(%rip),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
mov    $0x384,%edi
mov    $0x78,%esi
call   1070 <rotate@plt>
movsd  0xc95(%rip),%xmm0
mov    $0xfffffbb4,%ebx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x28(%rsp)
mulsd  0xc82(%rip),%xmm0
divsd  0xc82(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1090 <cos@plt>
movsd  0xc77(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <sin@plt>
mulsd  0xc56(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  0xc5b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %eax,%eax
call   10b0 <pushmatrix@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movaps 0x10(%rsp),%xmm2
call   10a0 <translate@plt>
xorps  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movss  0xc(%rsp),%xmm2
call   1050 <circ@plt>
xor    %eax,%eax
call   1030 <popmatrix@plt>
movsd  0x28(%rsp),%xmm0
addsd  0xc0f(%rip),%xmm0
add    $0xc8,%ebx
cmp    $0x2bc,%ebx
jl     1380 <makesphere+0x1f0>
xor    %eax,%eax
call   1030 <popmatrix@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
jmp    1040 <closeobj@plt>

LLVM IR (-O0):
define void @makesphere() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @makeobj(i64 1)
store i32 0, i32* %3
br label %6
6: ; preds = %15, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 1800
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = call i32 (...) @pushmatrix()
%11 = load i32, i32* %3
%12 = call i32 @rotate(i32 %11, i8 signext 121)
%13 = call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%14 = call i32 (...) @popmatrix()
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 200
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = call i32 (...) @pushmatrix()
%20 = call i32 @rotate(i32 900, i8 signext 120)
store i32 -900, i32* %4
br label %21
21: ; preds = %46, %18
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 900
br i1 %23, label %24, label %49
24: ; preds = %21
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = fmul double %26, 0x400921FB54442D11
%28 = fdiv double %27, 1.800000e+02
%29 = call double @cos(double %28)
%30 = fmul double 1.000000e+01, %29
%31 = fptrunc double %30 to float
store float %31, float* %1
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 0x400921FB54442D11
%35 = fdiv double %34, 1.800000e+02
%36 = call double @sin(double %35)
%37 = fmul double 1.000000e+01, %36
%38 = fptrunc double %37 to float
store float %38, float* %2
%39 = call i32 (...) @pushmatrix()
%40 = load float, float* %2
%41 = fneg float %40
%42 = call i32 @translate(double 0.000000e+00, double 0.000000e+00, float %41)
%43 = load float, float* %1
%44 = call i32 @circ(double 0.000000e+00, double 0.000000e+00, float %43)
%45 = call i32 (...) @popmatrix()
br label %46
46: ; preds = %24
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 200
store i32 %48, i32* %4
br label %21
49: ; preds = %21
%50 = call i32 (...) @popmatrix()
%51 = call i32 (...) @closeobj()
ret void
}

LLVM IR (-O2):
define void @makesphere() {
%1 = tail call i32 @makeobj(i64 1)
%2 = tail call i32 (...) @pushmatrix()
%3 = tail call i32 @rotate(i32 0, i8 signext 121)
%4 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%5 = tail call i32 (...) @popmatrix()
%6 = tail call i32 (...) @pushmatrix()
%7 = tail call i32 @rotate(i32 200, i8 signext 121)
%8 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%9 = tail call i32 (...) @popmatrix()
%10 = tail call i32 (...) @pushmatrix()
%11 = tail call i32 @rotate(i32 400, i8 signext 121)
%12 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%13 = tail call i32 (...) @popmatrix()
%14 = tail call i32 (...) @pushmatrix()
%15 = tail call i32 @rotate(i32 600, i8 signext 121)
%16 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%17 = tail call i32 (...) @popmatrix()
%18 = tail call i32 (...) @pushmatrix()
%19 = tail call i32 @rotate(i32 800, i8 signext 121)
%20 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%21 = tail call i32 (...) @popmatrix()
%22 = tail call i32 (...) @pushmatrix()
%23 = tail call i32 @rotate(i32 1000, i8 signext 121)
%24 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%25 = tail call i32 (...) @popmatrix()
%26 = tail call i32 (...) @pushmatrix()
%27 = tail call i32 @rotate(i32 1200, i8 signext 121)
%28 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%29 = tail call i32 (...) @popmatrix()
%30 = tail call i32 (...) @pushmatrix()
%31 = tail call i32 @rotate(i32 1400, i8 signext 121)
%32 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%33 = tail call i32 (...) @popmatrix()
%34 = tail call i32 (...) @pushmatrix()
%35 = tail call i32 @rotate(i32 1600, i8 signext 121)
%36 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float 1.000000e+01)
%37 = tail call i32 (...) @popmatrix()
%38 = tail call i32 (...) @pushmatrix()
%39 = tail call i32 @rotate(i32 900, i8 signext 120)
br label %40
40: ; preds = %0, %40
%41 = phi i32 [ -900, %0 ], [ %56, %40 ]
%42 = sitofp i32 %41 to double
%43 = fmul double %42, 0x400921FB54442D11
%44 = fdiv double %43, 1.800000e+02
%45 = tail call double @cos(double %44)
%46 = fmul double %45, 1.000000e+01
%47 = fptrunc double %46 to float
%48 = tail call double @sin(double %44)
%49 = fmul double %48, 1.000000e+01
%50 = fptrunc double %49 to float
%51 = tail call i32 (...) @pushmatrix()
%52 = fneg float %50
%53 = tail call i32 @translate(double 0.000000e+00, double 0.000000e+00, float %52)
%54 = tail call i32 @circ(double 0.000000e+00, double 0.000000e+00, float %47)
%55 = tail call i32 (...) @popmatrix()
%56 = add nsw i32 %41, 200
%57 = icmp slt i32 %41, 700
br i1 %57, label %40, label %58
58: ; preds = %40
%59 = tail call i32 (...) @popmatrix()
%60 = tail call i32 (...) @closeobj()
ret void
}