#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*/ Root123(int, double, double *, double *);
int /*<<< orphan*/ Root4(double, double *, double *);
int /*<<< orphan*/ Root5(double, double *, double *);
int /*<<< orphan*/ Root6(int, double, double *, double *);
void Roots(int n, double X, double roots[], double weights[]) {
  if (n <= 3)
    Root123(n, X, roots, weights);
  else if (n == 4)
    Root4(X, roots, weights);
  else if (n == 5)
    Root5(X, roots, weights);
  else
    Root6(n, X, roots, weights);
  return;
}


x86 assembly (clang, -O0):
<Roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x3,-0x4(%rbp)
jg     117c <Roots+0x3c>
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <Root123@plt>
jmp    11dd <Roots+0x9d>
cmpl   $0x4,-0x4(%rbp)
jne    119d <Roots+0x5d>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <Root4@plt>
jmp    11d8 <Roots+0x98>
cmpl   $0x5,-0x4(%rbp)
jne    11be <Roots+0x7e>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <Root5@plt>
jmp    11d3 <Roots+0x93>
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <Root6@plt>
jmp    11d8 <Roots+0x98>
jmp    11dd <Roots+0x9d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Roots>:
cmp    $0x3,%edi
jg     114a <Roots+0xa>
jmp    1060 <Root123@plt>
cmp    $0x5,%edi
je     115f <Roots+0x1f>
cmp    $0x4,%edi
jne    116a <Roots+0x2a>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1040 <Root4@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <Root5@plt>
jmp    1050 <Root6@plt>

LLVM IR (-O0):
define void @Roots(i32 %0, double %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 3
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i32, i32* %5
%13 = load double, double* %6
%14 = load double*, double** %7
%15 = load double*, double** %8
%16 = call i32 @Root123(i32 %12, double %13, double* %14, double* %15)
br label %41
17: ; preds = %4
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 4
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load double, double* %6
%22 = load double*, double** %7
%23 = load double*, double** %8
%24 = call i32 @Root4(double %21, double* %22, double* %23)
br label %40
25: ; preds = %17
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 5
br i1 %27, label %28, label %33
28: ; preds = %25
%29 = load double, double* %6
%30 = load double*, double** %7
%31 = load double*, double** %8
%32 = call i32 @Root5(double %29, double* %30, double* %31)
br label %39
33: ; preds = %25
%34 = load i32, i32* %5
%35 = load double, double* %6
%36 = load double*, double** %7
%37 = load double*, double** %8
%38 = call i32 @Root6(i32 %34, double %35, double* %36, double* %37)
br label %39
39: ; preds = %33, %28
br label %40
40: ; preds = %39, %20
br label %41
41: ; preds = %40, %11
ret void
}

LLVM IR (-O2):
define void @Roots(i32 %0, double %1, double* %2, double* %3) {
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 @Root123(i32 %0, double %1, double* %2, double* %3)
br label %15
8: ; preds = %4
switch i32 %0, label %13 [
i32 4, label %9
i32 5, label %11
]
9: ; preds = %8
%10 = tail call i32 @Root4(double %1, double* %2, double* %3)
br label %15
11: ; preds = %8
%12 = tail call i32 @Root5(double %1, double* %2, double* %3)
br label %15
13: ; preds = %8
%14 = tail call i32 @Root6(i32 %0, double %1, double* %2, double* %3)
br label %15
15: ; preds = %9, %13, %11, %6
ret void
}