#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*/ call_module(char *);
int /*<<< orphan*/ cube(double, double, float, int);
int /*<<< orphan*/ cyl(float, float, float, int);
int /*<<< orphan*/ diff();
int /*<<< orphan*/ end();
int /*<<< orphan*/ end_module();
double maxf(float, float);
int /*<<< orphan*/ module(char *);
int /*<<< orphan*/ onion();
int /*<<< orphan*/ rotate(float, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ xlate(double, double, int /*<<< orphan*/);
void cylinder_ribs(float length, float r1, float r2, int nribs) {
  static int rib_fn_number = 0;
  int i;
  char ribfn[30], ribsetfn[30];
  float dangle = 360.0 / nribs;
  float angle = 0.0;
  sprintf(ribfn, "ribfn_%d", rib_fn_number++);
  sprintf(ribsetfn, "ribsetfn_%d", rib_fn_number++);
  module(ribfn);
  diff();
  cyl(length, r1, r2, 1);
  xlate(maxf(r1, r2) * 1.05, 0, 0);
  cube(maxf(r1, r2) * 2, maxf(r1, r2) * 2, length + 2, 1);
  end();
  xlate(maxf(r1, r2) * -1.05, 0, 0);
  cube(maxf(r1, r2) * 2, maxf(r1, r2) * 2, length + 2, 1);
  end();
  xlate(0, maxf(r1, r2), 0);
  cube(maxf(r1, r2) * 2.1, maxf(r1, r2) * 2.1, length + 2, 1);
  end();
  end();
  end_module();
  module(ribsetfn);
  onion();
  for (i = 0; i < nribs; i++) {
    rotate(angle, 0, 0, 1);
    call_module(ribfn);
    end();
    angle += dangle;
  }
  end();
  end_module();
  call_module(ribsetfn);
}


x86 assembly (clang, -O0):
<cylinder_ribs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe3e(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
lea    -0x40(%rbp),%rdi
mov    0x2e7b(%rip),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2e70(%rip)
lea    0xe15(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2e5a(%rip),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2e4f(%rip)
lea    0xdfd(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x40(%rbp),%rdi
call   10a0 <module@plt>
mov    $0x0,%al
call   10e0 <diff@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
mov    $0x1,%edi
call   10c0 <cyl@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movsd  0xd9f(%rip),%xmm1
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
xor    %edi,%edi
call   1030 <xlate@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movsd  0xd6a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
movsd  0xd42(%rip),%xmm2
mulsd  %xmm2,%xmm1
movss  0xd26(%rip),%xmm2
addss  -0x4(%rbp),%xmm2
mov    $0x1,%edi
call   10d0 <cube@plt>
mov    $0x0,%al
call   1070 <end@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movsd  0xd11(%rip),%xmm1
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
xor    %edi,%edi
call   1030 <xlate@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movsd  0xce4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  0xcbc(%rip),%xmm2
mulsd  %xmm2,%xmm1
movss  0xca0(%rip),%xmm2
addss  -0x4(%rbp),%xmm2
mov    $0x1,%edi
call   10d0 <cube@plt>
mov    $0x0,%al
call   1070 <end@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
xor    %edi,%edi
call   1030 <xlate@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movsd  0xc5f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <maxf@plt>
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
movsd  0xc37(%rip),%xmm2
mulsd  %xmm2,%xmm1
movss  0xc23(%rip),%xmm2
addss  -0x4(%rbp),%xmm2
mov    $0x1,%edi
call   10d0 <cube@plt>
mov    $0x0,%al
call   1070 <end@plt>
mov    $0x0,%al
call   1070 <end@plt>
mov    $0x0,%al
call   1090 <end_module@plt>
lea    -0x60(%rbp),%rdi
call   10a0 <module@plt>
mov    $0x0,%al
call   1050 <onion@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1464 <cylinder_ribs+0x2a4>
movss  -0x68(%rbp),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1080 <rotate@plt>
lea    -0x40(%rbp),%rdi
call   1040 <call_module@plt>
mov    $0x0,%al
call   1070 <end@plt>
movss  -0x64(%rbp),%xmm0
addss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1418 <cylinder_ribs+0x258>
mov    $0x0,%al
call   1070 <end@plt>
mov    $0x0,%al
call   1090 <end_module@plt>
lea    -0x60(%rbp),%rdi
call   1040 <call_module@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cylinder_ribs>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %edi,%ebx
movss  %xmm2,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
mov    0x2ea1(%rip),%edx
lea    0x1(%rdx),%eax
mov    %eax,0x2e98(%rip)
lea    0xe31(%rip),%rsi
lea    0x40(%rsp),%r15
mov    %r15,%rdi
call   10b0 <sprintf@plt>
mov    0x2e7e(%rip),%edx
lea    0x1(%rdx),%eax
mov    %eax,0x2e75(%rip)
lea    0xe17(%rip),%rsi
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   10b0 <sprintf@plt>
mov    %r15,%rdi
call   10a0 <module@plt>
xor    %eax,%eax
call   10e0 <diff@plt>
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
mov    $0x1,%edi
call   10c0 <cyl@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
mulsd  0xda1(%rip),%xmm0
xorps  %xmm1,%xmm1
xor    %edi,%edi
call   1030 <xlate@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
addsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movss  0x14(%rsp),%xmm2
addss  0xd6d(%rip),%xmm2
movss  %xmm2,0x14(%rsp)
movsd  0x18(%rsp),%xmm0
mov    $0x1,%edi
call   10d0 <cube@plt>
xor    %eax,%eax
call   1070 <end@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
mulsd  0xd27(%rip),%xmm0
xorps  %xmm1,%xmm1
xor    %edi,%edi
call   1030 <xlate@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
addsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
movss  0x14(%rsp),%xmm2
mov    $0x1,%edi
call   10d0 <cube@plt>
xor    %eax,%eax
call   1070 <end@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
xor    %edi,%edi
call   1030 <xlate@plt>
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
mulsd  0xc9d(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movss  0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1060 <maxf@plt>
movsd  0xc7e(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0x18(%rsp),%xmm0
movss  0x14(%rsp),%xmm2
mov    $0x1,%edi
call   10d0 <cube@plt>
xor    %eax,%eax
call   1070 <end@plt>
xor    %eax,%eax
call   1070 <end@plt>
xor    %eax,%eax
call   1090 <end_module@plt>
mov    %r14,%rdi
call   10a0 <module@plt>
xor    %eax,%eax
call   1050 <onion@plt>
test   %ebx,%ebx
jle    144a <cylinder_ribs+0x28a>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xc15(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
lea    0x40(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movss  %xmm0,0xc(%rsp)
movss  0xc(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1080 <rotate@plt>
mov    %r14,%rdi
call   1040 <call_module@plt>
xor    %eax,%eax
call   1070 <end@plt>
movss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
add    $0xffffffff,%ebx
jne    1410 <cylinder_ribs+0x250>
xor    %eax,%eax
call   1070 <end@plt>
xor    %eax,%eax
call   1090 <end_module@plt>
lea    0x20(%rsp),%rdi
call   1040 <call_module@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@cylinder_ribs.rib_fn_number = internal global i32 0
@.str = [9 x i8] c"ribfn_%d\00"
@.str.1 = [12 x i8] c"ribsetfn_%d\00"
define void @cylinder_ribs(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 [30 x i8]
%11 = alloca [30 x i8]
%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 = load i32, i32* %8
%15 = sitofp i32 %14 to double
%16 = fdiv double 3.600000e+02, %15
%17 = fptrunc double %16 to float
store float %17, float* %12
store float 0.000000e+00, float* %13
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %10, i64 0, i64 0
%19 = load i32, i32* @cylinder_ribs.rib_fn_number
%20 = add nsw i32 %19, 1
store i32 %20, i32* @cylinder_ribs.rib_fn_number
%21 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %19)
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%23 = load i32, i32* @cylinder_ribs.rib_fn_number
%24 = add nsw i32 %23, 1
store i32 %24, i32* @cylinder_ribs.rib_fn_number
%25 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%26 = getelementptr inbounds [30 x i8], [30 x i8]* %10, i64 0, i64 0
%27 = call i32 @module(i8* %26)
%28 = call i32 (...) @diff()
%29 = load float, float* %5
%30 = load float, float* %6
%31 = load float, float* %7
%32 = call i32 @cyl(float %29, float %30, float %31, i32 1)
%33 = load float, float* %6
%34 = load float, float* %7
%35 = call double @maxf(float %33, float %34)
%36 = fmul double %35, 1.050000e+00
%37 = call i32 @xlate(double %36, double 0.000000e+00, i32 0)
%38 = load float, float* %6
%39 = load float, float* %7
%40 = call double @maxf(float %38, float %39)
%41 = fmul double %40, 2.000000e+00
%42 = load float, float* %6
%43 = load float, float* %7
%44 = call double @maxf(float %42, float %43)
%45 = fmul double %44, 2.000000e+00
%46 = load float, float* %5
%47 = fadd float %46, 2.000000e+00
%48 = call i32 @cube(double %41, double %45, float %47, i32 1)
%49 = call i32 (...) @end()
%50 = load float, float* %6
%51 = load float, float* %7
%52 = call double @maxf(float %50, float %51)
%53 = fmul double %52, -1.050000e+00
%54 = call i32 @xlate(double %53, double 0.000000e+00, i32 0)
%55 = load float, float* %6
%56 = load float, float* %7
%57 = call double @maxf(float %55, float %56)
%58 = fmul double %57, 2.000000e+00
%59 = load float, float* %6
%60 = load float, float* %7
%61 = call double @maxf(float %59, float %60)
%62 = fmul double %61, 2.000000e+00
%63 = load float, float* %5
%64 = fadd float %63, 2.000000e+00
%65 = call i32 @cube(double %58, double %62, float %64, i32 1)
%66 = call i32 (...) @end()
%67 = load float, float* %6
%68 = load float, float* %7
%69 = call double @maxf(float %67, float %68)
%70 = call i32 @xlate(double 0.000000e+00, double %69, i32 0)
%71 = load float, float* %6
%72 = load float, float* %7
%73 = call double @maxf(float %71, float %72)
%74 = fmul double %73, 2.100000e+00
%75 = load float, float* %6
%76 = load float, float* %7
%77 = call double @maxf(float %75, float %76)
%78 = fmul double %77, 2.100000e+00
%79 = load float, float* %5
%80 = fadd float %79, 2.000000e+00
%81 = call i32 @cube(double %74, double %78, float %80, i32 1)
%82 = call i32 (...) @end()
%83 = call i32 (...) @end()
%84 = call i32 (...) @end_module()
%85 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%86 = call i32 @module(i8* %85)
%87 = call i32 (...) @onion()
store i32 0, i32* %9
br label %88
88: ; preds = %101, %4
%89 = load i32, i32* %9
%90 = load i32, i32* %8
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %104
92: ; preds = %88
%93 = load float, float* %13
%94 = call i32 @rotate(float %93, i32 0, i32 0, i32 1)
%95 = getelementptr inbounds [30 x i8], [30 x i8]* %10, i64 0, i64 0
%96 = call i32 @call_module(i8* %95)
%97 = call i32 (...) @end()
%98 = load float, float* %12
%99 = load float, float* %13
%100 = fadd float %99, %98
store float %100, float* %13
br label %101
101: ; preds = %92
%102 = load i32, i32* %9
%103 = add nsw i32 %102, 1
store i32 %103, i32* %9
br label %88
104: ; preds = %88
%105 = call i32 (...) @end()
%106 = call i32 (...) @end_module()
%107 = getelementptr inbounds [30 x i8], [30 x i8]* %11, i64 0, i64 0
%108 = call i32 @call_module(i8* %107)
ret void
}

LLVM IR (-O2):
@cylinder_ribs.rib_fn_number = internal unnamed_addr global i32 0
@.str = [9 x i8] c"ribfn_%d\00"
@.str.1 = [12 x i8] c"ribsetfn_%d\00"
define void @cylinder_ribs(float %0, float %1, float %2, i32 %3) {
%5 = alloca [30 x i8]
%6 = alloca [30 x i8]
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%9 = sitofp i32 %3 to double
%10 = fdiv double 3.600000e+02, %9
%11 = fptrunc double %10 to float
%12 = load i32, i32* @cylinder_ribs.rib_fn_number
%13 = add nsw i32 %12, 1
store i32 %13, i32* @cylinder_ribs.rib_fn_number
%14 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %12)
%15 = load i32, i32* @cylinder_ribs.rib_fn_number
%16 = add nsw i32 %15, 1
store i32 %16, i32* @cylinder_ribs.rib_fn_number
%17 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%18 = call i32 @module(i8* %7)
%19 = call i32 (...) @diff()
%20 = call i32 @cyl(float %0, float %1, float %2, i32 1)
%21 = call double @maxf(float %1, float %2)
%22 = fmul double %21, 1.050000e+00
%23 = call i32 @xlate(double %22, double 0.000000e+00, i32 0)
%24 = call double @maxf(float %1, float %2)
%25 = fmul double %24, 2.000000e+00
%26 = call double @maxf(float %1, float %2)
%27 = fmul double %26, 2.000000e+00
%28 = fadd float %0, 2.000000e+00
%29 = call i32 @cube(double %25, double %27, float %28, i32 1)
%30 = call i32 (...) @end()
%31 = call double @maxf(float %1, float %2)
%32 = fmul double %31, -1.050000e+00
%33 = call i32 @xlate(double %32, double 0.000000e+00, i32 0)
%34 = call double @maxf(float %1, float %2)
%35 = fmul double %34, 2.000000e+00
%36 = call double @maxf(float %1, float %2)
%37 = fmul double %36, 2.000000e+00
%38 = call i32 @cube(double %35, double %37, float %28, i32 1)
%39 = call i32 (...) @end()
%40 = call double @maxf(float %1, float %2)
%41 = call i32 @xlate(double 0.000000e+00, double %40, i32 0)
%42 = call double @maxf(float %1, float %2)
%43 = fmul double %42, 2.100000e+00
%44 = call double @maxf(float %1, float %2)
%45 = fmul double %44, 2.100000e+00
%46 = call i32 @cube(double %43, double %45, float %28, i32 1)
%47 = call i32 (...) @end()
%48 = call i32 (...) @end()
%49 = call i32 (...) @end_module()
%50 = call i32 @module(i8* %8)
%51 = call i32 (...) @onion()
%52 = icmp sgt i32 %3, 0
br i1 %52, label %53, label %62
53: ; preds = %4, %53
%54 = phi float [ %59, %53 ], [ 0.000000e+00, %4 ]
%55 = phi i32 [ %60, %53 ], [ 0, %4 ]
%56 = call i32 @rotate(float %54, i32 0, i32 0, i32 1)
%57 = call i32 @call_module(i8* %7)
%58 = call i32 (...) @end()
%59 = fadd float %54, %11
%60 = add nuw nsw i32 %55, 1
%61 = icmp eq i32 %60, %3
br i1 %61, label %62, label %53
62: ; preds = %53, %4
%63 = call i32 (...) @end()
%64 = call i32 (...) @end_module()
%65 = call i32 @call_module(i8* %8)
ret void
}