#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_rings(float, float, float, int);
int /*<<< orphan*/ end();
double randf(float);
int randn(int);
int /*<<< orphan*/ xlate(int /*<<< orphan*/, int /*<<< orphan*/, float);
void random_cylinder_rings(float length, float r1, float r2,
                           int nelaborations) {
  int nrings = randn(4) + 1;
  float ringheight = randf(0.05);
  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_rings(l, r1 * (1 + ringheight), r2 * (1 + ringheight), nrings);
  end();
}


x86 assembly (clang, -O0):
<random_cylinder_rings>:
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    $0x4,%edi
call   1070 <randn@plt>
add    $0x1,%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_rings+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
movss  0xdc3(%rip),%xmm2
addss  -0x18(%rbp),%xmm2
mulss  %xmm2,%xmm1
movss  -0xc(%rbp),%xmm2
movss  0xdad(%rip),%xmm3
addss  -0x18(%rbp),%xmm3
mulss  %xmm3,%xmm2
mov    -0x14(%rbp),%edi
call   1050 <cylinder_rings@plt>
mov    $0x0,%al
call   1040 <end@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_cylinder_rings>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %edi,%ebp
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0x1c(%rsp)
movss  %xmm0,0xc(%rsp)
mov    $0x4,%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
xorps  %xmm2,%xmm2
cvtsd2ss %xmm1,%xmm2
movsd  0xe4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  %xmm2,0xc(%rsp)
cvtss2sd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%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     1208 <random_cylinder_rings+0xb8>
movaps 0x20(%rsp),%xmm1
jmp    1214 <random_cylinder_rings+0xc4>
movaps 0x20(%rsp),%xmm1
xorps  0xe0c(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
add    $0x1,%ebx
xor    %edi,%edi
xor    %esi,%esi
movaps %xmm1,%xmm0
call   1030 <xlate@plt>
movss  0x10(%rsp),%xmm2
addss  0xdc7(%rip),%xmm2
movss  0x1c(%rsp),%xmm1
mulss  %xmm2,%xmm1
mulss  0x18(%rsp),%xmm2
movss  0xc(%rsp),%xmm0
mov    %ebx,%edi
call   1050 <cylinder_rings@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <end@plt>

LLVM IR (-O0):
define void @random_cylinder_rings(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 4)
%14 = add nsw i32 %13, 1
store i32 %14, i32* %9
%15 = call double @randf(float 0x3FA99999A0000000)
%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* %10
%47 = fadd float 1.000000e+00, %46
%48 = fmul float %45, %47
%49 = load float, float* %7
%50 = load float, float* %10
%51 = fadd float 1.000000e+00, %50
%52 = fmul float %49, %51
%53 = load i32, i32* %9
%54 = call i32 @cylinder_rings(float %44, float %48, float %52, i32 %53)
%55 = call i32 (...) @end()
ret void
}

LLVM IR (-O2):
define void @random_cylinder_rings(float %0, float %1, float %2, i32 %3) {
%5 = tail call i32 @randn(i32 4)
%6 = tail call double @randf(float 0x3FA99999A0000000)
%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, 1
%27 = tail call i32 @xlate(i32 0, i32 0, float %24)
%28 = fadd float %25, 1.000000e+00
%29 = fmul float %28, %1
%30 = fmul float %28, %2
%31 = tail call i32 @cylinder_rings(float %13, float %29, float %30, i32 %26)
%32 = tail call i32 (...) @end()
ret void
}