#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*/ cylinder_protrusions(float, float, float, int);
int /*<<< orphan*/ end();
double randf(float);
int randn(int);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, float);
void random_cylinder_protrusions(float length, float r1, float r2,
                                 int nelaborations) {
  int nprots = randn(5) + 5;
  float pheight = randf(0.1);
  float l, offset;
  l = (1.0 - randf(0.7)) * length / nelaborations;
  offset = randf((length / 2.0) - (l / 2.0));
  if (randn(100) < 50)
    offset = -offset;
  xlate(0, 0, offset);
  cylinder_protrusions(l, ((r1 + r2) / 2.0) * (1 + pheight),
                       ((r1 + r2) / 2.0) * (1 + pheight), nprots);
  end();
}


x86 assembly (clang, -O0):
<random_cylinder_protrusions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    $0x5,%edi
call   1070 <randn@plt>
add    $0x5,%eax
mov    %eax,-0x14(%rbp)
movss  0xe92(%rip),%xmm0
call   1060 <randf@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe78(%rip),%xmm0
call   1060 <randf@plt>
movaps %xmm0,%xmm1
movsd  0xe60(%rip),%xmm0
subsd  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe24(%rip),%xmm1
divsd  %xmm1,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe0f(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <randf@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    $0x64,%edi
call   1070 <randn@plt>
cmp    $0x32,%eax
jge    1235 <random_cylinder_protrusions+0xe5>
movss  -0x20(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
xor    %esi,%esi
mov    %esi,%edi
call   1030 <xlate@plt>
movss  -0x1c(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xda2(%rip),%xmm2
divsd  %xmm2,%xmm1
movss  0xdae(%rip),%xmm2
addss  -0x18(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  -0x8(%rbp),%xmm2
addss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xd6f(%rip),%xmm3
divsd  %xmm3,%xmm2
movss  0xd7b(%rip),%xmm3
addss  -0x18(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
mulsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
mov    -0x14(%rbp),%edi
call   1050 <cylinder_protrusions@plt>
mov    $0x0,%al
call   1040 <end@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_cylinder_protrusions>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %edi,%ebp
movss  %xmm2,0x1c(%rsp)
movss  %xmm1,0x18(%rsp)
movss  %xmm0,0xc(%rsp)
mov    $0x5,%edi
call   1070 <randn@plt>
mov    %eax,%ebx
movss  0xe82(%rip),%xmm0
call   1060 <randf@plt>
movsd  %xmm0,0x10(%rsp)
movss  0xe73(%rip),%xmm0
call   1060 <randf@plt>
movsd  0xe72(%rip),%xmm1
subsd  %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
cvtsi2sd %ebp,%xmm2
mulsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
movsd  0xe51(%rip),%xmm2
mulsd  %xmm2,%xmm0
movss  %xmm1,0xc(%rsp)
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <randf@plt>
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
mov    $0x64,%edi
call   1070 <randn@plt>
cmp    $0x32,%eax
jl     1205 <random_cylinder_protrusions+0xb5>
movaps 0x20(%rsp),%xmm1
jmp    1211 <random_cylinder_protrusions+0xc1>
movaps 0x20(%rsp),%xmm1
xorps  0xe0f(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
add    $0x5,%ebx
xor    %edi,%edi
xor    %esi,%esi
movaps %xmm1,%xmm0
call   1030 <xlate@plt>
movss  0x18(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xdd0(%rip),%xmm0
movss  0x10(%rsp),%xmm1
addss  0xdb2(%rip),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
movaps %xmm1,%xmm2
mov    %ebx,%edi
call   1050 <cylinder_protrusions@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <end@plt>

LLVM IR (-O0):
define void @random_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
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store i32 %3, i32* %8
%13 = call i32 @randn(i32 5)
%14 = add nsw i32 %13, 5
store i32 %14, i32* %9
%15 = call double @randf(float 0x3FB99999A0000000)
%16 = fptrunc double %15 to float
store float %16, float* %10
%17 = call double @randf(float 0x3FE6666660000000)
%18 = fsub double 1.000000e+00, %17
%19 = load float, float* %5
%20 = fpext float %19 to double
%21 = fmul double %18, %20
%22 = load i32, i32* %8
%23 = sitofp i32 %22 to double
%24 = fdiv double %21, %23
%25 = fptrunc double %24 to float
store float %25, float* %11
%26 = load float, float* %5
%27 = fpext float %26 to double
%28 = fdiv double %27, 2.000000e+00
%29 = load float, float* %11
%30 = fpext float %29 to double
%31 = fdiv double %30, 2.000000e+00
%32 = fsub double %28, %31
%33 = fptrunc double %32 to float
%34 = call double @randf(float %33)
%35 = fptrunc double %34 to float
store float %35, float* %12
%36 = call i32 @randn(i32 100)
%37 = icmp slt i32 %36, 50
br i1 %37, label %38, label %41
38: ; preds = %4
%39 = load float, float* %12
%40 = fneg float %39
store float %40, float* %12
br label %41
41: ; preds = %38, %4
%42 = load float, float* %12
%43 = call i32 @xlate(i32 0, i32 0, float %42)
%44 = load float, float* %11
%45 = load float, float* %6
%46 = load float, float* %7
%47 = fadd float %45, %46
%48 = fpext float %47 to double
%49 = fdiv double %48, 2.000000e+00
%50 = load float, float* %10
%51 = fadd float 1.000000e+00, %50
%52 = fpext float %51 to double
%53 = fmul double %49, %52
%54 = fptrunc double %53 to float
%55 = load float, float* %6
%56 = load float, float* %7
%57 = fadd float %55, %56
%58 = fpext float %57 to double
%59 = fdiv double %58, 2.000000e+00
%60 = load float, float* %10
%61 = fadd float 1.000000e+00, %60
%62 = fpext float %61 to double
%63 = fmul double %59, %62
%64 = fptrunc double %63 to float
%65 = load i32, i32* %9
%66 = call i32 @cylinder_protrusions(float %44, float %54, float %64, i32 %65)
%67 = call i32 (...) @end()
ret void
}

LLVM IR (-O2):
define void @random_cylinder_protrusions(float %0, float %1, float %2, i32 %3) {
%5 = tail call i32 @randn(i32 5)
%6 = tail call double @randf(float 0x3FB99999A0000000)
%7 = tail call double @randf(float 0x3FE6666660000000)
%8 = fsub double 1.000000e+00, %7
%9 = fpext float %0 to double
%10 = fmul double %8, %9
%11 = sitofp i32 %3 to double
%12 = fdiv double %10, %11
%13 = fptrunc double %12 to float
%14 = fmul double %9, 5.000000e-01
%15 = fpext float %13 to double
%16 = fmul double %15, 5.000000e-01
%17 = fsub double %14, %16
%18 = fptrunc double %17 to float
%19 = tail call double @randf(float %18)
%20 = fptrunc double %19 to float
%21 = tail call i32 @randn(i32 100)
%22 = icmp slt i32 %21, 50
%23 = fneg float %20
%24 = select i1 %22, float %23, float %20
%25 = fptrunc double %6 to float
%26 = add nsw i32 %5, 5
%27 = tail call i32 @xlate(i32 0, i32 0, float %24)
%28 = fadd float %1, %2
%29 = fpext float %28 to double
%30 = fmul double %29, 5.000000e-01
%31 = fadd float %25, 1.000000e+00
%32 = fpext float %31 to double
%33 = fmul double %30, %32
%34 = fptrunc double %33 to float
%35 = tail call i32 @cylinder_protrusions(float %13, float %34, float %34, i32 %26)
%36 = tail call i32 (...) @end()
ret void
}