#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 *);
double randf(double);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ thruster_module(char *, float, float, float);
void thruster(float length, float r1, float r2) {
  static int modulenum = 0;
  char modname[100];
  float v = randf(0.3) - 0.15 + 1.0;
  float v2 = randf(0.3) - 0.15 + 1.0;
  sprintf(modname, "thruster_%d", modulenum++);
  thruster_module(modname, length, r1 * v, r2 * v2);
  call_module(modname);
}


x86 assembly (clang, -O0):
<thruster>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movsd  0xeae(%rip),%xmm0
call   1050 <randf@plt>
movsd  0xe99(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe85(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
movsd  0xe80(%rip),%xmm0
call   1050 <randf@plt>
movsd  0xe6b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe57(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
mov    0x2e84(%rip),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2e79(%rip)
lea    0xe46(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x74(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
mulss  -0x78(%rbp),%xmm2
call   1040 <thruster_module@plt>
lea    -0x70(%rbp),%rdi
call   1030 <call_module@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thruster>:
push   %rbx
sub    $0x90,%rsp
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x1c(%rsp)
movsd  0xe9e(%rip),%xmm0
call   1050 <randf@plt>
addsd  0xe99(%rip),%xmm0
addsd  0xe99(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
movsd  0xe77(%rip),%xmm0
call   1050 <randf@plt>
addsd  0xe72(%rip),%xmm0
addsd  0xe72(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x2e96(%rip),%edx
lea    0x1(%rdx),%eax
mov    %eax,0x2e8d(%rip)
lea    0xe5a(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
movss  0x14(%rsp),%xmm1
mulss  0x10(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
mulss  0xc(%rsp),%xmm2
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
call   1040 <thruster_module@plt>
mov    %rbx,%rdi
call   1030 <call_module@plt>
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@thruster.modulenum = internal global i32 0
@.str = [12 x i8] c"thruster_%d\00"
define void @thruster(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca [100 x i8]
%8 = alloca float
%9 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%10 = call double @randf(double 3.000000e-01)
%11 = fsub double %10, 1.500000e-01
%12 = fadd double %11, 1.000000e+00
%13 = fptrunc double %12 to float
store float %13, float* %8
%14 = call double @randf(double 3.000000e-01)
%15 = fsub double %14, 1.500000e-01
%16 = fadd double %15, 1.000000e+00
%17 = fptrunc double %16 to float
store float %17, float* %9
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%19 = load i32, i32* @thruster.modulenum
%20 = add nsw i32 %19, 1
store i32 %20, i32* @thruster.modulenum
%21 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %19)
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%23 = load float, float* %4
%24 = load float, float* %5
%25 = load float, float* %8
%26 = fmul float %24, %25
%27 = load float, float* %6
%28 = load float, float* %9
%29 = fmul float %27, %28
%30 = call i32 @thruster_module(i8* %22, float %23, float %26, float %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%32 = call i32 @call_module(i8* %31)
ret void
}

LLVM IR (-O2):
@thruster.modulenum = internal unnamed_addr global i32 0
@.str = [12 x i8] c"thruster_%d\00"
define void @thruster(float %0, float %1, float %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = tail call double @randf(double 3.000000e-01)
%7 = fadd double %6, -1.500000e-01
%8 = fadd double %7, 1.000000e+00
%9 = fptrunc double %8 to float
%10 = tail call double @randf(double 3.000000e-01)
%11 = fadd double %10, -1.500000e-01
%12 = fadd double %11, 1.000000e+00
%13 = fptrunc double %12 to float
%14 = load i32, i32* @thruster.modulenum
%15 = add nsw i32 %14, 1
store i32 %15, i32* @thruster.modulenum
%16 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
%17 = fmul float %9, %1
%18 = fmul float %13, %2
%19 = call i32 @thruster_module(i8* %5, float %0, float %17, float %18)
%20 = call i32 @call_module(i8* %5)
ret void
}