#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*/ coord_from_poly_roots(int *, double *, double *, double *,
                                         double *, double *, double ***,
                                         double ***, double ***);
int /*<<< orphan*/ get_input_angles(int *, double *, double *, double *,
                                    double *);
int /*<<< orphan*/ get_poly_coeff(double *);
int /*<<< orphan*/ solve_sturm(int *, int *, double *, double *);
void solve_3pep_poly(double r_n1[3], double r_a1[3], double r_a3[3],
                     double r_c3[3], double r_soln_n[16][3][3],
                     double r_soln_a[16][3][3], double r_soln_c[16][3][3],
                     int *n_soln) {
  double poly_coeff[16 + 1], roots[16];
  int var_deg_pol;
  get_input_angles(n_soln, r_n1, r_a1, r_a3, r_c3);
  if (*n_soln == 0)
    return;
  get_poly_coeff(poly_coeff);
  var_deg_pol = 16;
  solve_sturm(&var_deg_pol, n_soln, poly_coeff, roots);
  if (*n_soln == 0)
    return;
  coord_from_poly_roots(n_soln, roots, r_n1, r_a1, r_a3, r_c3, r_soln_n,
                        r_soln_a, r_soln_c);
  return;
}


x86 assembly (clang, -O0):
<solve_3pep_poly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1050 <get_input_angles@plt>
mov    0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1196 <solve_3pep_poly+0x56>
jmp    1216 <solve_3pep_poly+0xd6>
lea    -0xc0(%rbp),%rdi
call   1030 <get_poly_coeff@plt>
movl   $0x10,-0x144(%rbp)
mov    0x18(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x140(%rbp),%rcx
lea    -0x144(%rbp),%rdi
call   1060 <solve_sturm@plt>
mov    0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11dc <solve_3pep_poly+0x9c>
jmp    1216 <solve_3pep_poly+0xd6>
mov    0x18(%rbp),%rdi
lea    -0x140(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x28(%rbp),%r11
mov    -0x30(%rbp),%r10
mov    0x10(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <coord_from_poly_roots@plt>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_3pep_poly>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %r9,0x8(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    0x158(%rsp),%r14
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
mov    %r12,%r8
call   1050 <get_input_angles@plt>
cmpl   $0x0,(%r14)
je     11ea <solve_3pep_poly+0xaa>
lea    0x90(%rsp),%rdi
call   1030 <get_poly_coeff@plt>
movl   $0x10,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x10(%rsp),%rcx
mov    %r14,%rsi
lea    0x90(%rsp),%rdx
call   1060 <solve_sturm@plt>
cmpl   $0x0,(%r14)
je     11ea <solve_3pep_poly+0xaa>
sub    $0x8,%rsp
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
mov    %rbp,%rdx
mov    %rbx,%rcx
mov    %r13,%r8
mov    %r12,%r9
push   0x158(%rsp)
push   0x18(%rsp)
push   %r15
call   1040 <coord_from_poly_roots@plt>
add    $0x20,%rsp
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @solve_3pep_poly(double* %0, double* %1, double* %2, double* %3, [3 x [3 x double]]* %4, [3 x [3 x double]]* %5, [3 x [3 x double]]* %6, i32* %7) {
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca [3 x [3 x double]]*
%14 = alloca [3 x [3 x double]]*
%15 = alloca [3 x [3 x double]]*
%16 = alloca i32*
%17 = alloca [17 x double]
%18 = alloca [16 x double]
%19 = alloca i32
store double* %0, double** %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store [3 x [3 x double]]* %4, [3 x [3 x double]]** %13
store [3 x [3 x double]]* %5, [3 x [3 x double]]** %14
store [3 x [3 x double]]* %6, [3 x [3 x double]]** %15
store i32* %7, i32** %16
%20 = load i32*, i32** %16
%21 = load double*, double** %9
%22 = load double*, double** %10
%23 = load double*, double** %11
%24 = load double*, double** %12
%25 = call i32 @get_input_angles(i32* %20, double* %21, double* %22, double* %23, double* %24)
%26 = load i32*, i32** %16
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %8
br label %55
30: ; preds = %8
%31 = getelementptr inbounds [17 x double], [17 x double]* %17, i64 0, i64 0
%32 = call i32 @get_poly_coeff(double* %31)
store i32 16, i32* %19
%33 = load i32*, i32** %16
%34 = getelementptr inbounds [17 x double], [17 x double]* %17, i64 0, i64 0
%35 = getelementptr inbounds [16 x double], [16 x double]* %18, i64 0, i64 0
%36 = call i32 @solve_sturm(i32* %19, i32* %33, double* %34, double* %35)
%37 = load i32*, i32** %16
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %30
br label %55
41: ; preds = %30
%42 = load i32*, i32** %16
%43 = getelementptr inbounds [16 x double], [16 x double]* %18, i64 0, i64 0
%44 = load double*, double** %9
%45 = load double*, double** %10
%46 = load double*, double** %11
%47 = load double*, double** %12
%48 = load [3 x [3 x double]]*, [3 x [3 x double]]** %13
%49 = bitcast [3 x [3 x double]]* %48 to double***
%50 = load [3 x [3 x double]]*, [3 x [3 x double]]** %14
%51 = bitcast [3 x [3 x double]]* %50 to double***
%52 = load [3 x [3 x double]]*, [3 x [3 x double]]** %15
%53 = bitcast [3 x [3 x double]]* %52 to double***
%54 = call i32 @coord_from_poly_roots(i32* %42, double* %43, double* %44, double* %45, double* %46, double* %47, double*** %49, double*** %51, double*** %53)
br label %55
55: ; preds = %41, %40, %29
ret void
}

LLVM IR (-O2):
define void @solve_3pep_poly(double* %0, double* %1, double* %2, double* %3, [3 x [3 x double]]* %4, [3 x [3 x double]]* %5, [3 x [3 x double]]* %6, i32* %7) {
%9 = alloca [17 x double]
%10 = alloca [16 x double]
%11 = alloca i32
%12 = bitcast [17 x double]* %9 to i8*
%13 = bitcast [16 x double]* %10 to i8*
%14 = bitcast i32* %11 to i8*
%15 = tail call i32 @get_input_angles(i32* %7, double* %0, double* %1, double* %2, double* %3)
%16 = load i32, i32* %7
%17 = icmp eq i32 %16, 0
br i1 %17, label %30, label %18
18: ; preds = %8
%19 = getelementptr inbounds [17 x double], [17 x double]* %9, i64 0, i64 0
%20 = call i32 @get_poly_coeff(double* %19)
store i32 16, i32* %11
%21 = getelementptr inbounds [16 x double], [16 x double]* %10, i64 0, i64 0
%22 = call i32 @solve_sturm(i32* %11, i32* %7, double* %19, double* %21)
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %18
%26 = bitcast [3 x [3 x double]]* %4 to double***
%27 = bitcast [3 x [3 x double]]* %5 to double***
%28 = bitcast [3 x [3 x double]]* %6 to double***
%29 = call i32 @coord_from_poly_roots(i32* %7, double* %21, double* %0, double* %1, double* %2, double* %3, double*** %26, double*** %27, double*** %28)
br label %30
30: ; preds = %18, %8, %25
ret void
}