#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 */
double calculateDiscriminant(double, double, double);
double calculateFirstRoot(double, double, double);
double calculateSecondRoot(double, double, double);
int /*<<< orphan*/ printf(char *, ...);
void solveQuadraticEquation(double a, double b, double c) {
  double discriminant, root1, root2;
  discriminant = calculateDiscriminant(a, b, c);
  if (discriminant < 0)
    printf("No roots. \n");
  else if (discriminant == 0)
    printf("One root: %f. \n", calculateFirstRoot(a, b, discriminant));
  else
    printf("Two roots: %f and %f. \n", calculateFirstRoot(a, b, discriminant),
           calculateSecondRoot(a, b, discriminant));
}


x86 assembly (clang, -O0):
<solveQuadraticEquation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1060 <calculateDiscriminant@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1191 <solveQuadraticEquation+0x51>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1218 <solveQuadraticEquation+0xd8>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d0 <solveQuadraticEquation+0x90>
jp     11d0 <solveQuadraticEquation+0x90>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1050 <calculateFirstRoot@plt>
lea    0xe48(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1213 <solveQuadraticEquation+0xd3>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1050 <calculateFirstRoot@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1030 <calculateSecondRoot@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
lea    0xe10(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    1218 <solveQuadraticEquation+0xd8>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveQuadraticEquation>:
sub    $0x28,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
call   1070 <calculateDiscriminant@plt>
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm2,%xmm0
jbe    1183 <solveQuadraticEquation+0x33>
lea    0xeb6(%rip),%rdi
add    $0x28,%rsp
jmp    1030 <puts@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  %xmm2,0x8(%rsp)
movsd  0x8(%rsp),%xmm2
call   1060 <calculateFirstRoot@plt>
movsd  0x8(%rsp),%xmm2
ucomisd 0xe52(%rip),%xmm2
jne    11c4 <solveQuadraticEquation+0x74>
jp     11c4 <solveQuadraticEquation+0x74>
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
add    $0x28,%rsp
jmp    1050 <printf@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
call   1040 <calculateSecondRoot@plt>
movaps %xmm0,%xmm1
lea    0xe33(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x2,%al
add    $0x28,%rsp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"No roots. \0A\00"
@.str.1 = [16 x i8] c"One root: %f. \0A\00"
@.str.2 = [24 x i8] c"Two roots: %f and %f. \0A\00"
define void @solveQuadraticEquation(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = load double, double* %4
%11 = load double, double* %5
%12 = load double, double* %6
%13 = call double @calculateDiscriminant(double %10, double %11, double %12)
store double %13, double* %7
%14 = load double, double* %7
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %38
18: ; preds = %3
%19 = load double, double* %7
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load double, double* %4
%23 = load double, double* %5
%24 = load double, double* %7
%25 = call double @calculateFirstRoot(double %22, double %23, double %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %25)
br label %37
27: ; preds = %18
%28 = load double, double* %4
%29 = load double, double* %5
%30 = load double, double* %7
%31 = call double @calculateFirstRoot(double %28, double %29, double %30)
%32 = load double, double* %4
%33 = load double, double* %5
%34 = load double, double* %7
%35 = call double @calculateSecondRoot(double %32, double %33, double %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %31, double %35)
br label %37
37: ; preds = %27, %21
br label %38
38: ; preds = %37, %16
ret void
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"One root: %f. \0A\00"
@.str.2 = [24 x i8] c"Two roots: %f and %f. \0A\00"
@str = [11 x i8] c"No roots. \00"
define void @solveQuadraticEquation(double %0, double %1, double %2) {
%4 = tail call double @calculateDiscriminant(double %0, double %1, double %2)
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %16
8: ; preds = %3
%9 = fcmp oeq double %4, 0.000000e+00
%10 = tail call double @calculateFirstRoot(double %0, double %1, double %4)
br i1 %9, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %10)
br label %16
13: ; preds = %8
%14 = tail call double @calculateSecondRoot(double %0, double %1, double %4)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %10, double %14)
br label %16
16: ; preds = %11, %13, %6
ret void
}