#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*/ cube(float, int, float, int);
int /*<<< orphan*/ cyl(float, float, float, int);
int /*<<< orphan*/ end();
int /*<<< orphan*/ intersection();
int maxf(float, float);
float minf(float, float);
int /*<<< orphan*/ onion();
float randf(double);
scalar_t__ randn(int);
int /*<<< orphan*/ rotate(float, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, float);
void cylinder_protrusions(float length, float r1, float r2, int nprotrusions) {
  int i;
  float h, z, x;
  float angle;
  intersection();
  cyl(length, r1 * 1.1, r2 * 1.1, 1);
  onion();
  for (i = 0; i < nprotrusions; i++) {
    h = ((float)(randn(80) + 20) / 100.0) * length;
    z = -((length - h) / 2.0) * ((float)randn(100) / 100.0);
    x = minf(r1, r2) * randf(0.2);
    angle = randf(360.0);
    xlate(0, 0, z);
    rotate(angle, 0, 0, 1);
    cube(x, maxf(r1, r2) * 3, h, 1);
    end();
    end();
  }
  end();
  end();
}


x86 assembly (clang, -O0):
<cylinder_protrusions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    $0x0,%al
call   1080 <intersection@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe19(%rip),%xmm2
mulsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xe00(%rip),%xmm3
mulsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
mov    $0x1,%edi
call   10c0 <cyl@plt>
mov    $0x0,%al
call   1040 <onion@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    137d <cylinder_protrusions+0x1cd>
mov    $0x50,%edi
call   10a0 <randn@plt>
add    $0x14,%rax
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdcd(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda5(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    $0x64,%edi
call   10a0 <randn@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd5d(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   10b0 <minf@plt>
movss  %xmm0,-0x2c(%rbp)
movsd  0xd28(%rip),%xmm0
call   1090 <randf@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movsd  0xd02(%rip),%xmm0
call   1090 <randf@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
movss  -0x24(%rbp),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1070 <rotate@plt>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1050 <maxf@plt>
movss  -0x28(%rbp),%xmm0
imul   $0x3,%eax,%edi
movss  -0x18(%rbp),%xmm1
mov    $0x1,%esi
call   10d0 <cube@plt>
mov    $0x0,%al
call   1060 <end@plt>
mov    $0x0,%al
call   1060 <end@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1220 <cylinder_protrusions+0x70>
mov    $0x0,%al
call   1060 <end@plt>
mov    $0x0,%al
call   1060 <end@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cylinder_protrusions>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1080 <intersection@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1e(%rip),%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
movss  0x4(%rsp),%xmm0
mov    $0x1,%edi
call   10c0 <cyl@plt>
xor    %eax,%eax
call   1040 <onion@plt>
test   %ebx,%ebx
jle    136a <cylinder_protrusions+0x1ba>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x50,%edi
call   10a0 <randn@plt>
add    $0x14,%rax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda6(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0x28(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0x24(%rsp)
movss  0x4(%rsp),%xmm0
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd81(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x64,%edi
call   10a0 <randn@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xd55(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x20(%rsp)
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   10b0 <minf@plt>
movss  %xmm0,0x10(%rsp)
movsd  0xd36(%rip),%xmm0
call   1090 <randf@plt>
mulss  0x10(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movsd  0xd25(%rip),%xmm0
call   1090 <randf@plt>
movss  %xmm0,0x1c(%rsp)
xor    %edi,%edi
xor    %esi,%esi
movss  0x20(%rsp),%xmm0
call   1030 <xlate@plt>
movss  0x1c(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <rotate@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1050 <maxf@plt>
lea    (%rax,%rax,2),%edi
movss  0x10(%rsp),%xmm0
movss  0x24(%rsp),%xmm1
mov    $0x1,%esi
call   10d0 <cube@plt>
xor    %eax,%eax
call   1060 <end@plt>
xor    %eax,%eax
call   1060 <end@plt>
add    $0xffffffff,%ebx
jne    1240 <cylinder_protrusions+0x90>
xor    %eax,%eax
call   1060 <end@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
jmp    1060 <end@plt>

LLVM IR (-O0):
define void @cylinder_protrusions(float %0, float %1, float %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store i32 %3, i32* %8
%14 = call i32 (...) @intersection()
%15 = load float, float* %5
%16 = load float, float* %6
%17 = fpext float %16 to double
%18 = fmul double %17, 1.100000e+00
%19 = fptrunc double %18 to float
%20 = load float, float* %7
%21 = fpext float %20 to double
%22 = fmul double %21, 1.100000e+00
%23 = fptrunc double %22 to float
%24 = call i32 @cyl(float %15, float %19, float %23, i32 1)
%25 = call i32 (...) @onion()
store i32 0, i32* %9
br label %26
26: ; preds = %71, %4
%27 = load i32, i32* %9
%28 = load i32, i32* %8
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %74
30: ; preds = %26
%31 = call i64 @randn(i32 80)
%32 = add nsw i64 %31, 20
%33 = sitofp i64 %32 to float
%34 = fpext float %33 to double
%35 = fdiv double %34, 1.000000e+02
%36 = load float, float* %5
%37 = fpext float %36 to double
%38 = fmul double %35, %37
%39 = fptrunc double %38 to float
store float %39, float* %10
%40 = load float, float* %5
%41 = load float, float* %10
%42 = fsub float %40, %41
%43 = fpext float %42 to double
%44 = fdiv double %43, 2.000000e+00
%45 = fneg double %44
%46 = call i64 @randn(i32 100)
%47 = sitofp i64 %46 to float
%48 = fpext float %47 to double
%49 = fdiv double %48, 1.000000e+02
%50 = fmul double %45, %49
%51 = fptrunc double %50 to float
store float %51, float* %11
%52 = load float, float* %6
%53 = load float, float* %7
%54 = call float @minf(float %52, float %53)
%55 = call float @randf(double 2.000000e-01)
%56 = fmul float %54, %55
store float %56, float* %12
%57 = call float @randf(double 3.600000e+02)
store float %57, float* %13
%58 = load float, float* %11
%59 = call i32 @xlate(i32 0, i32 0, float %58)
%60 = load float, float* %13
%61 = call i32 @rotate(float %60, i32 0, i32 0, i32 1)
%62 = load float, float* %12
%63 = load float, float* %6
%64 = load float, float* %7
%65 = call i32 @maxf(float %63, float %64)
%66 = mul nsw i32 %65, 3
%67 = load float, float* %10
%68 = call i32 @cube(float %62, i32 %66, float %67, i32 1)
%69 = call i32 (...) @end()
%70 = call i32 (...) @end()
br label %71
71: ; preds = %30
%72 = load i32, i32* %9
%73 = add nsw i32 %72, 1
store i32 %73, i32* %9
br label %26
74: ; preds = %26
%75 = call i32 (...) @end()
%76 = call i32 (...) @end()
ret void
}

LLVM IR (-O2):
define void @cylinder_protrusions(float %0, float %1, float %2, i32 %3) {
%5 = tail call i32 (...) @intersection()
%6 = fpext float %1 to double
%7 = fmul double %6, 1.100000e+00
%8 = fptrunc double %7 to float
%9 = fpext float %2 to double
%10 = fmul double %9, 1.100000e+00
%11 = fptrunc double %10 to float
%12 = tail call i32 @cyl(float %0, float %8, float %11, i32 1)
%13 = tail call i32 (...) @onion()
%14 = icmp sgt i32 %3, 0
br i1 %14, label %15, label %48
15: ; preds = %4
%16 = fpext float %0 to double
br label %17
17: ; preds = %15, %17
%18 = phi i32 [ 0, %15 ], [ %46, %17 ]
%19 = tail call i64 @randn(i32 80)
%20 = add nsw i64 %19, 20
%21 = sitofp i64 %20 to float
%22 = fpext float %21 to double
%23 = fdiv double %22, 1.000000e+02
%24 = fmul double %23, %16
%25 = fptrunc double %24 to float
%26 = fsub float %0, %25
%27 = fpext float %26 to double
%28 = fmul double %27, -5.000000e-01
%29 = tail call i64 @randn(i32 100)
%30 = sitofp i64 %29 to float
%31 = fpext float %30 to double
%32 = fdiv double %31, 1.000000e+02
%33 = fmul double %32, %28
%34 = fptrunc double %33 to float
%35 = tail call float @minf(float %1, float %2)
%36 = tail call float @randf(double 2.000000e-01)
%37 = fmul float %35, %36
%38 = tail call float @randf(double 3.600000e+02)
%39 = tail call i32 @xlate(i32 0, i32 0, float %34)
%40 = tail call i32 @rotate(float %38, i32 0, i32 0, i32 1)
%41 = tail call i32 @maxf(float %1, float %2)
%42 = mul nsw i32 %41, 3
%43 = tail call i32 @cube(float %37, i32 %42, float %25, i32 1)
%44 = tail call i32 (...) @end()
%45 = tail call i32 (...) @end()
%46 = add nuw nsw i32 %18, 1
%47 = icmp eq i32 %46, %3
br i1 %47, label %48, label %17
48: ; preds = %17, %4
%49 = tail call i32 (...) @end()
%50 = tail call i32 (...) @end()
ret void
}