#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*/ printf(char *, ...);
int roots2rf(int, int, int, float *);
int roots3rf(int, int, int, int, float *);
void test_roots(void) {
  float r[16];
  int s = roots2rf(10, 145, 13, r);
  printf("Testing roots\n");
  printf("%d %f %f\n", s, r[0], r[1]);
  s = roots2rf(1, 13, 13, r);
  printf("%d %f %f\n", s, r[0], r[1]);
  s = roots2rf(100, 134, 13, r);
  printf("%d %f %f\n", s, r[0], r[1]);
  s = roots3rf(1, 45, 24, 42, r);
  printf("%d %f\n", s, r[0]);
  s = roots3rf(52, 145, 524, 342, r);
  printf("%d %f\n", s, r[0]);
  s = roots3rf(140, 15, 5, 4, r);
  printf("%d %f\n", s, r[0]);
  s = roots3rf(4, 0, 0, 57, r);
  printf("%d %f\n", s, r[0]);
  s = roots3rf(1, -6, 11, -6, r);
  printf("%d %f %f %f\n", s, r[0], r[1], r[2]);
}


x86 assembly (clang, -O0):
<test_roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rcx
mov    $0xa,%edi
mov    $0x91,%esi
mov    $0xd,%edx
call   1050 <roots2rf@plt>
mov    %eax,-0x44(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe92(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rcx
mov    $0x1,%edi
mov    $0xd,%edx
mov    %edx,%esi
call   1050 <roots2rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe57(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rcx
mov    $0x64,%edi
mov    $0x86,%esi
mov    $0xd,%edx
call   1050 <roots2rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe19(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%r8
mov    $0x1,%edi
mov    $0x2d,%esi
mov    $0x18,%edx
mov    $0x2a,%ecx
call   1040 <roots3rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%r8
mov    $0x34,%edi
mov    $0x91,%esi
mov    $0x20c,%edx
mov    $0x156,%ecx
call   1040 <roots3rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdaf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%r8
mov    $0x8c,%edi
mov    $0xf,%esi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <roots3rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%r8
mov    $0x4,%edi
xor    %edx,%edx
mov    $0x39,%ecx
mov    %edx,%esi
call   1040 <roots3rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd41(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%r8
mov    $0x1,%edi
mov    $0xfffffffa,%ecx
mov    $0xb,%edx
mov    %ecx,%esi
call   1040 <roots3rf@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x3c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x38(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xcff(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_roots>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%r14
mov    $0xa,%edi
mov    $0x91,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1060 <roots2rf@plt>
mov    %eax,%ebp
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe76(%rip),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xd,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1060 <roots2rf@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x64,%edi
mov    $0x86,%esi
mov    $0xd,%edx
mov    %r14,%rcx
call   1060 <roots2rf@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2d,%esi
mov    $0x18,%edx
mov    $0x2a,%ecx
mov    %r14,%r8
call   1050 <roots3rf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xddc(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x34,%edi
mov    $0x91,%esi
mov    $0x20c,%edx
mov    $0x156,%ecx
mov    %r14,%r8
call   1050 <roots3rf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x8c,%edi
mov    $0xf,%esi
mov    $0x5,%edx
mov    $0x4,%ecx
mov    %r14,%r8
call   1050 <roots3rf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x4,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x39,%ecx
mov    %r14,%r8
call   1050 <roots3rf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0xfffffffa,%esi
mov    $0xb,%edx
mov    $0xfffffffa,%ecx
mov    %r14,%r8
call   1050 <roots3rf@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
movss  0x8(%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xd0a(%rip),%rdi
mov    %eax,%esi
mov    $0x3,%al
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Testing roots\0A\00"
@.str.1 = [10 x i8] c"%d %f %f\0A\00"
@.str.2 = [7 x i8] c"%d %f\0A\00"
@.str.3 = [13 x i8] c"%d %f %f %f\0A\00"
define void @test_roots() {
%1 = alloca [16 x float]
%2 = alloca i32
%3 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%4 = call i32 @roots2rf(i32 10, i32 145, i32 13, float* %3)
store i32 %4, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%8 = load float, float* %7
%9 = fpext float %8 to double
%10 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 1
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6, double %9, double %12)
%14 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%15 = call i32 @roots2rf(i32 1, i32 13, i32 13, float* %14)
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%18 = load float, float* %17
%19 = fpext float %18 to double
%20 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 1
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, double %19, double %22)
%24 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%25 = call i32 @roots2rf(i32 100, i32 134, i32 13, float* %24)
store i32 %25, i32* %2
%26 = load i32, i32* %2
%27 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 1
%31 = load float, float* %30
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %26, double %29, double %32)
%34 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%35 = call i32 @roots3rf(i32 1, i32 45, i32 24, i32 42, float* %34)
store i32 %35, i32* %2
%36 = load i32, i32* %2
%37 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%38 = load float, float* %37
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %36, double %39)
%41 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%42 = call i32 @roots3rf(i32 52, i32 145, i32 524, i32 342, float* %41)
store i32 %42, i32* %2
%43 = load i32, i32* %2
%44 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %43, double %46)
%48 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%49 = call i32 @roots3rf(i32 140, i32 15, i32 5, i32 4, float* %48)
store i32 %49, i32* %2
%50 = load i32, i32* %2
%51 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %50, double %53)
%55 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%56 = call i32 @roots3rf(i32 4, i32 0, i32 0, i32 57, float* %55)
store i32 %56, i32* %2
%57 = load i32, i32* %2
%58 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%59 = load float, float* %58
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %57, double %60)
%62 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%63 = call i32 @roots3rf(i32 1, i32 -6, i32 11, i32 -6, float* %62)
store i32 %63, i32* %2
%64 = load i32, i32* %2
%65 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%66 = load float, float* %65
%67 = fpext float %66 to double
%68 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 1
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 2
%72 = load float, float* %71
%73 = fpext float %72 to double
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %64, double %67, double %70, double %73)
ret void
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%d %f %f\0A\00"
@.str.2 = [7 x i8] c"%d %f\0A\00"
@.str.3 = [13 x i8] c"%d %f %f %f\0A\00"
@str = [14 x i8] c"Testing roots\00"
define void @test_roots() {
%1 = alloca [16 x float]
%2 = bitcast [16 x float]* %1 to i8*
%3 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%4 = call i32 @roots2rf(i32 10, i32 145, i32 13, float* %3)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 1
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %4, double %7, double %10)
%12 = call i32 @roots2rf(i32 1, i32 13, i32 13, float* %3)
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = load float, float* %8
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, double %14, double %16)
%18 = call i32 @roots2rf(i32 100, i32 134, i32 13, float* %3)
%19 = load float, float* %3
%20 = fpext float %19 to double
%21 = load float, float* %8
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18, double %20, double %22)
%24 = call i32 @roots3rf(i32 1, i32 45, i32 24, i32 42, float* %3)
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %24, double %26)
%28 = call i32 @roots3rf(i32 52, i32 145, i32 524, i32 342, float* %3)
%29 = load float, float* %3
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %28, double %30)
%32 = call i32 @roots3rf(i32 140, i32 15, i32 5, i32 4, float* %3)
%33 = load float, float* %3
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %32, double %34)
%36 = call i32 @roots3rf(i32 4, i32 0, i32 0, i32 57, float* %3)
%37 = load float, float* %3
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %36, double %38)
%40 = call i32 @roots3rf(i32 1, i32 -6, i32 11, i32 -6, float* %3)
%41 = load float, float* %3
%42 = fpext float %41 to double
%43 = load float, float* %8
%44 = fpext float %43 to double
%45 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 2
%46 = load float, float* %45
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %40, double %42, double %44, double %47)
ret void
}