#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 /*<<< orphan*/ scanf(char *, float *, float *, float *);
float sqrt(float);
void solveEquation() {
  float delta, a, b, c;
  printf("Insert the coefficient a b c separated by spaces\n");
  scanf("%f %f %f", &a, &b, &c);
  delta = (b * b) - (4 * a * c);
  if (a == 0) {
    printf("The equation degree is less than two\n");
  } else {
    printf("The equation (%f x^2 + %f x + %f = 0) has ", a, b, c);
    if (delta == 0) {
      printf("only one zero: %f\n", (-b / 2 * a));
    } else if (delta > 0) {
      printf("two zeros: %f, %f\n", (-b + sqrt(delta)) / (2 * a),
             (-b - sqrt(delta)) / (2 * a));
    } else if (delta < 0) {
      printf("no real zeros.\n");
    }
  }
}


x86 assembly (clang, -O0):
<solveEquation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe90(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11be <solveEquation+0x8e>
jp     11be <solveEquation+0x8e>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1314 <solveEquation+0x1e4>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe89(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1238 <solveEquation+0x108>
jp     1238 <solveEquation+0x108>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xdec(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    130f <solveEquation+0x1df>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12ea <solveEquation+0x1ba>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xd86(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  -0x1c(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
subss  %xmm2,%xmm1
movss  0xd3a(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdc9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    130a <solveEquation+0x1da>
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1305 <solveEquation+0x1d5>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130a <solveEquation+0x1da>
jmp    130f <solveEquation+0x1df>
jmp    1314 <solveEquation+0x1e4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveEquation>:
sub    $0x38,%rsp
lea    0xf2f(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x1c(%rsp),%rcx
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jne    118c <solveEquation+0x4c>
jp     118c <solveEquation+0x4c>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
add    $0x38,%rsp
ret
movss  0x8(%rsp),%xmm4
movss  0x1c(%rsp),%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulss  0xe59(%rip),%xmm2
mulss  %xmm3,%xmm2
cvtss2sd %xmm4,%xmm1
mulss  %xmm4,%xmm4
addss  %xmm2,%xmm4
movss  %xmm4,0x10(%rsp)
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
lea    0xe5e(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm2
ucomiss 0xe29(%rip),%xmm2
jne    120e <solveEquation+0xce>
jp     120e <solveEquation+0xce>
movss  0x8(%rsp),%xmm0
mulss  0xe13(%rip),%xmm0
mulss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe52(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x38,%rsp
ret
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jbe    12cd <solveEquation+0x18d>
movss  0x8(%rsp),%xmm1
xorps  %xmm3,%xmm3
sqrtss %xmm2,%xmm3
movaps %xmm3,%xmm0
jae    1252 <solveEquation+0x112>
movaps %xmm2,%xmm0
movss  %xmm3,0x20(%rsp)
movss  %xmm1,0x18(%rsp)
call   1060 <sqrt@plt>
movss  0x18(%rsp),%xmm1
movss  0x20(%rsp),%xmm3
movss  0x10(%rsp),%xmm2
subss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
movss  0x8(%rsp),%xmm1
xorps  0xd9f(%rip),%xmm1
xorps  %xmm4,%xmm4
cvtss2sd %xmm0,%xmm4
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jae    12a1 <solveEquation+0x161>
movaps %xmm2,%xmm0
movsd  %xmm4,0x10(%rsp)
movaps %xmm1,0x20(%rsp)
call   1060 <sqrt@plt>
movaps 0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm4
movaps %xmm0,%xmm3
subss  %xmm3,%xmm1
movss  0xc(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xda9(%rip),%rdi
movaps %xmm4,%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x38,%rsp
ret
ucomiss %xmm2,%xmm0
jbe    1187 <solveEquation+0x47>
lea    0xdce(%rip),%rdi
jmp    1182 <solveEquation+0x42>

LLVM IR (-O0):
@.str = [50 x i8] c"Insert the coefficient a b c separated by spaces\0A\00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [38 x i8] c"The equation degree is less than two\0A\00"
@.str.3 = [43 x i8] c"The equation (%f x^2 + %f x + %f = 0) has \00"
@.str.4 = [19 x i8] c"only one zero: %f\0A\00"
@.str.5 = [19 x i8] c"two zeros: %f, %f\0A\00"
@.str.6 = [16 x i8] c"no real zeros.\0A\00"
define void @solveEquation() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4)
%7 = load float, float* %3
%8 = load float, float* %3
%9 = load float, float* %2
%10 = fmul float 4.000000e+00, %9
%11 = load float, float* %4
%12 = fmul float %10, %11
%13 = fneg float %12
%14 = call float @llvm.fmuladd.f32(float %7, float %8, float %13)
store float %14, float* %1
%15 = load float, float* %2
%16 = fcmp oeq float %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %68
19: ; preds = %0
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), double %21, double %23, double %25)
%27 = load float, float* %1
%28 = fcmp oeq float %27, 0.000000e+00
br i1 %28, label %29, label %37
29: ; preds = %19
%30 = load float, float* %3
%31 = fneg float %30
%32 = fdiv float %31, 2.000000e+00
%33 = load float, float* %2
%34 = fmul float %32, %33
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %35)
br label %67
37: ; preds = %19
%38 = load float, float* %1
%39 = fcmp ogt float %38, 0.000000e+00
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = load float, float* %3
%42 = fneg float %41
%43 = load float, float* %1
%44 = call float @sqrt(float %43)
%45 = fadd float %42, %44
%46 = load float, float* %2
%47 = fmul float 2.000000e+00, %46
%48 = fdiv float %45, %47
%49 = fpext float %48 to double
%50 = load float, float* %3
%51 = fneg float %50
%52 = load float, float* %1
%53 = call float @sqrt(float %52)
%54 = fsub float %51, %53
%55 = load float, float* %2
%56 = fmul float 2.000000e+00, %55
%57 = fdiv float %54, %56
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %49, double %58)
br label %66
60: ; preds = %37
%61 = load float, float* %1
%62 = fcmp olt float %61, 0.000000e+00
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
br label %66
66: ; preds = %65, %40
br label %67
67: ; preds = %66, %29
br label %68
68: ; preds = %67, %17
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.3 = [43 x i8] c"The equation (%f x^2 + %f x + %f = 0) has \00"
@.str.4 = [19 x i8] c"only one zero: %f\0A\00"
@.str.5 = [19 x i8] c"two zeros: %f, %f\0A\00"
@str = [49 x i8] c"Insert the coefficient a b c separated by spaces\00"
@str.7 = [15 x i8] c"no real zeros.\00"
@str.8 = [37 x i8] c"The equation degree is less than two\00"
define void @solveEquation() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3)
%9 = load float, float* %2
%10 = load float, float* %1
%11 = load float, float* %3
%12 = fmul float %10, -4.000000e+00
%13 = fmul float %12, %11
%14 = call float @llvm.fmuladd.f32(float %9, float %9, float %13)
%15 = fcmp oeq float %10, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.8, i64 0, i64 0))
br label %54
18: ; preds = %0
%19 = fpext float %10 to double
%20 = fpext float %9 to double
%21 = fpext float %11 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), double %19, double %20, double %21)
%23 = fcmp oeq float %14, 0.000000e+00
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = load float, float* %2
%26 = fmul float %25, -5.000000e-01
%27 = load float, float* %1
%28 = fmul float %26, %27
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %29)
br label %54
31: ; preds = %18
%32 = fcmp ogt float %14, 0.000000e+00
br i1 %32, label %33, label %50
33: ; preds = %31
%34 = load float, float* %2
%35 = call float @sqrt(float %14)
%36 = fsub float %35, %34
%37 = load float, float* %1
%38 = fmul float %37, 2.000000e+00
%39 = fdiv float %36, %38
%40 = fpext float %39 to double
%41 = load float, float* %2
%42 = fneg float %41
%43 = call float @sqrt(float %14)
%44 = fsub float %42, %43
%45 = load float, float* %1
%46 = fmul float %45, 2.000000e+00
%47 = fdiv float %44, %46
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), double %40, double %48)
br label %54
50: ; preds = %31
%51 = fcmp olt float %14, 0.000000e+00
br i1 %51, label %52, label %54
52: ; preds = %50
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
br label %54
54: ; preds = %24, %50, %52, %33, %16
ret void
}