#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, ...);
int solve_quartic_2(int, int, int, int, float *);
void quartic_test(void) {
  float t[4];
  int count = solve_quartic_2(-10, 35, -50, 24, t);
  printf("%d solutions\n", count);
  for (int i = 0; i != count; ++i) {
    printf("solution %d: %f\n", i, t[i]);
  }
}


x86 assembly (clang, -O0):
<quartic_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%r8
mov    $0xfffffff6,%edi
mov    $0x23,%esi
mov    $0xffffffce,%edx
mov    $0x18,%ecx
call   1030 <solve_quartic_2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1199 <quartic_test+0x79>
mov    -0x18(%rbp),%esi
movslq -0x18(%rbp),%rax
movss  -0x10(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <quartic_test+0x40>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quartic_test>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%r8
mov    $0xfffffff6,%edi
mov    $0x23,%esi
mov    $0xffffffce,%edx
mov    $0x18,%ecx
call   1030 <solve_quartic_2@plt>
mov    %eax,%ebx
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
je     118e <quartic_test+0x6e>
mov    %ebx,%r15d
xor    %ebx,%ebx
lea    0xea7(%rip),%r14
nopw   0x0(%rax,%rax,1)
movss  (%rsp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1170 <quartic_test+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d solutions\0A\00"
@.str.1 = [17 x i8] c"solution %d: %f\0A\00"
define void @quartic_test() {
%1 = alloca [4 x float]
%2 = alloca i32
%3 = alloca i32
%4 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%5 = call i32 @solve_quartic_2(i32 -10, i32 35, i32 -50, i32 24, float* %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %20, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 %15
%17 = load float, float* %16
%18 = fpext float %17 to double
%19 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %13, double %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %8
23: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d solutions\0A\00"
@.str.1 = [17 x i8] c"solution %d: %f\0A\00"
define void @quartic_test() {
%1 = alloca [4 x float]
%2 = bitcast [4 x float]* %1 to i8*
%3 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 0
%4 = call i32 @solve_quartic_2(i32 -10, i32 35, i32 -50, i32 24, float* %3)
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp eq i32 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = zext i32 %4 to i64
br label %10
9: ; preds = %10, %0
ret void
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %17, %10 ]
%12 = getelementptr inbounds [4 x float], [4 x float]* %1, i64 0, i64 %11
%13 = load float, float* %12
%14 = fpext float %13 to double
%15 = trunc i64 %11 to i32
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %15, double %14)
%17 = add nuw nsw i64 %11, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %9, label %10
}