#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*/ end();
int /*<<< orphan*/ end_module();
int /*<<< orphan*/ end_radial_dist();
int /*<<< orphan*/ module(char *);
int /*<<< orphan*/ outrigger_module(char *, float);
int /*<<< orphan*/ radial_dist(int, int /*<<< orphan*/);
float randf(float);
int randn(int);
int /*<<< orphan*/ rotate(float, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/);
void outrigger_set_module(char *modname, float maxlength, float minlength) {
  static int m = 0;
  char mn[30];
  int n;
  float length = randf(maxlength - minlength) + minlength;
  float angle;
  sprintf(mn, "outrig_n_%d", m++);
  outrigger_module(mn, length);
  if (randn(100) < 20) {
    n = randn(8) + 1;
    module(modname);
    radial_dist(n, 0);
    call_module(mn);
    end_radial_dist();
    end_module();
  } else {
    if (randn(100) < 30)
      angle = randn(4) * 90;
    else
      angle = randn(360);
    module(modname);
    rotate(angle, 0, 0, 1);
    call_module(mn);
    end();
    end_module();
  }
}


x86 assembly (clang, -O0):
<outrigger_set_module>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
call   1090 <randf@plt>
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
lea    -0x30(%rbp),%rdi
mov    0x2e93(%rip),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,0x2e88(%rip)
lea    0xe05(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
movss  -0x38(%rbp),%xmm0
call   10c0 <outrigger_module@plt>
mov    $0x64,%edi
call   10a0 <randn@plt>
cmp    $0x14,%eax
jge    1260 <outrigger_set_module+0xb0>
mov    $0x8,%edi
call   10a0 <randn@plt>
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <module@plt>
mov    -0x34(%rbp),%edi
xor    %esi,%esi
call   10d0 <radial_dist@plt>
lea    -0x30(%rbp),%rdi
call   1030 <call_module@plt>
mov    $0x0,%al
call   1050 <end_radial_dist@plt>
mov    $0x0,%al
call   1070 <end_module@plt>
jmp    12d4 <outrigger_set_module+0x124>
mov    $0x64,%edi
call   10a0 <randn@plt>
cmp    $0x1e,%eax
jge    128e <outrigger_set_module+0xde>
mov    $0x4,%edi
call   10a0 <randn@plt>
imul   $0x5a,%eax,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    12a1 <outrigger_set_module+0xf1>
mov    $0x168,%edi
call   10a0 <randn@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <module@plt>
movss  -0x3c(%rbp),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1060 <rotate@plt>
lea    -0x30(%rbp),%rdi
call   1030 <call_module@plt>
mov    $0x0,%al
call   1040 <end@plt>
mov    $0x0,%al
call   1070 <end_module@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outrigger_set_module>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movss  %xmm1,0xc(%rsp)
mov    %rdi,%r14
subss  %xmm1,%xmm0
call   1090 <randf@plt>
addss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x2ea1(%rip),%edx
lea    0x1(%rdx),%eax
mov    %eax,0x2e98(%rip)
lea    0xe15(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   10b0 <sprintf@plt>
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   10c0 <outrigger_module@plt>
mov    $0x64,%edi
call   10a0 <randn@plt>
cmp    $0x13,%eax
jg     1246 <outrigger_set_module+0x96>
mov    $0x8,%edi
call   10a0 <randn@plt>
lea    0x1(%rax),%ebx
mov    %r14,%rdi
call   1080 <module@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   10d0 <radial_dist@plt>
lea    0x10(%rsp),%rdi
call   1030 <call_module@plt>
xor    %eax,%eax
call   1050 <end_radial_dist@plt>
jmp    12a8 <outrigger_set_module+0xf8>
mov    $0x64,%edi
call   10a0 <randn@plt>
cmp    $0x1d,%eax
jg     1264 <outrigger_set_module+0xb4>
mov    $0x4,%edi
call   10a0 <randn@plt>
imul   $0x5a,%eax,%eax
jmp    126e <outrigger_set_module+0xbe>
mov    $0x168,%edi
call   10a0 <randn@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
call   1080 <module@plt>
movss  0xc(%rsp),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <rotate@plt>
lea    0x10(%rsp),%rdi
call   1030 <call_module@plt>
xor    %eax,%eax
call   1040 <end@plt>
xor    %eax,%eax
call   1070 <end_module@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@outrigger_set_module.m = internal global i32 0
@.str = [12 x i8] c"outrig_n_%d\00"
define void @outrigger_set_module(i8* %0, float %1, float %2) {
%4 = alloca i8*
%5 = alloca float
%6 = alloca float
%7 = alloca [30 x i8]
%8 = alloca i32
%9 = alloca float
%10 = alloca float
store i8* %0, i8** %4
store float %1, float* %5
store float %2, float* %6
%11 = load float, float* %5
%12 = load float, float* %6
%13 = fsub float %11, %12
%14 = call float @randf(float %13)
%15 = load float, float* %6
%16 = fadd float %14, %15
store float %16, float* %9
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%18 = load i32, i32* @outrigger_set_module.m
%19 = add nsw i32 %18, 1
store i32 %19, i32* @outrigger_set_module.m
%20 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18)
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%22 = load float, float* %9
%23 = call i32 @outrigger_module(i8* %21, float %22)
%24 = call i32 @randn(i32 100)
%25 = icmp slt i32 %24, 20
br i1 %25, label %26, label %37
26: ; preds = %3
%27 = call i32 @randn(i32 8)
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = load i8*, i8** %4
%30 = call i32 @module(i8* %29)
%31 = load i32, i32* %8
%32 = call i32 @radial_dist(i32 %31, i32 0)
%33 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%34 = call i32 @call_module(i8* %33)
%35 = call i32 (...) @end_radial_dist()
%36 = call i32 (...) @end_module()
br label %56
37: ; preds = %3
%38 = call i32 @randn(i32 100)
%39 = icmp slt i32 %38, 30
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = call i32 @randn(i32 4)
%42 = mul nsw i32 %41, 90
%43 = sitofp i32 %42 to float
store float %43, float* %10
br label %47
44: ; preds = %37
%45 = call i32 @randn(i32 360)
%46 = sitofp i32 %45 to float
store float %46, float* %10
br label %47
47: ; preds = %44, %40
%48 = load i8*, i8** %4
%49 = call i32 @module(i8* %48)
%50 = load float, float* %10
%51 = call i32 @rotate(float %50, i32 0, i32 0, i32 1)
%52 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%53 = call i32 @call_module(i8* %52)
%54 = call i32 (...) @end()
%55 = call i32 (...) @end_module()
br label %56
56: ; preds = %47, %26
ret void
}

LLVM IR (-O2):
@outrigger_set_module.m = internal unnamed_addr global i32 0
@.str = [12 x i8] c"outrig_n_%d\00"
define void @outrigger_set_module(i8* %0, float %1, float %2) {
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%6 = fsub float %1, %2
%7 = tail call float @randf(float %6)
%8 = fadd float %7, %2
%9 = load i32, i32* @outrigger_set_module.m
%10 = add nsw i32 %9, 1
store i32 %10, i32* @outrigger_set_module.m
%11 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%12 = call i32 @outrigger_module(i8* %5, float %8)
%13 = call i32 @randn(i32 100)
%14 = icmp slt i32 %13, 20
br i1 %14, label %15, label %22
15: ; preds = %3
%16 = call i32 @randn(i32 8)
%17 = add nsw i32 %16, 1
%18 = call i32 @module(i8* %0)
%19 = call i32 @radial_dist(i32 %17, i32 0)
%20 = call i32 @call_module(i8* %5)
%21 = call i32 (...) @end_radial_dist()
br label %37
22: ; preds = %3
%23 = call i32 @randn(i32 100)
%24 = icmp slt i32 %23, 30
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call i32 @randn(i32 4)
%27 = mul nsw i32 %26, 90
br label %30
28: ; preds = %22
%29 = call i32 @randn(i32 360)
br label %30
30: ; preds = %28, %25
%31 = phi i32 [ %27, %25 ], [ %29, %28 ]
%32 = sitofp i32 %31 to float
%33 = call i32 @module(i8* %0)
%34 = call i32 @rotate(float %32, i32 0, i32 0, i32 1)
%35 = call i32 @call_module(i8* %5)
%36 = call i32 (...) @end()
br label %37
37: ; preds = %30, %15
%38 = call i32 (...) @end_module()
ret void
}