#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 *, float, ...);
int sqrt(float);
void solve(float a, float b, float c) {
  float discriminant = b * b - 4 * a * c;
  if (discriminant > 0) {
    float discSqrt = sqrt(discriminant);
    printf("As raizes são: %f %f\n", (-b + discSqrt) / (2 * a),
           (-b - discSqrt) / (2 * a));
  } else if (discriminant == 0) {
    printf("Tem raiz dupla: %f\n", (-b) / (2 * a));
  } else {
    float realPart = -b / (2 * a);
    float complexPart = sqrt(-discriminant) / (2 * a);
    printf("Tem raizes complexas: %f+%fi %f-%fi\n", realPart, complexPart,
           realPart, complexPart);
  }
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xeb7(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11f8 <solve+0xd8>
movss  -0x10(%rbp),%xmm0
call   1040 <sqrt@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe54(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
subss  -0x14(%rbp),%xmm1
movss  0xe2c(%rip),%xmm2
mulss  -0x4(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe1c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    12d1 <solve+0x1b1>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1245 <solve+0x125>
jp     1245 <solve+0x125>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xddb(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12cc <solve+0x1ac>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xda5(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <sqrt@plt>
cvtsi2ss %eax,%xmm0
movss  0xd74(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x18(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x1c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
lea    0xd6e(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
jmp    12d1 <solve+0x1b1>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
sub    $0x28,%rsp
movaps %xmm0,%xmm4
movss  0xed1(%rip),%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm2,%xmm3
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  %xmm3,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm0
jbe    11a3 <solve+0x83>
movaps %xmm1,0x10(%rsp)
movss  %xmm4,0xc(%rsp)
call   1040 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movaps %xmm1,%xmm0
movaps 0x10(%rsp),%xmm2
subss  %xmm2,%xmm0
xorps  0xe9c(%rip),%xmm2
movss  0xc(%rsp),%xmm3
addss  %xmm3,%xmm3
divss  %xmm3,%xmm0
subss  %xmm1,%xmm2
divss  %xmm3,%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xe88(%rip),%rdi
mov    $0x2,%al
add    $0x28,%rsp
jmp    1030 <printf@plt>
xorps  0xe66(%rip),%xmm1
addss  %xmm4,%xmm4
divss  %xmm4,%xmm1
jne    11cb <solve+0xab>
jp     11cb <solve+0xab>
lea    0xe7a(%rip),%rdi
movaps %xmm1,%xmm0
mov    $0x1,%al
add    $0x28,%rsp
jmp    1030 <printf@plt>
xorps  0xe3e(%rip),%xmm0
movaps %xmm1,0x10(%rsp)
movss  %xmm4,0xc(%rsp)
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movaps 0x10(%rsp),%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
lea    0xe42(%rip),%rdi
movaps %xmm1,%xmm3
mov    $0x4,%al
add    $0x28,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"As raizes s\C3\A3o: %f %f\0A\00"
@.str.1 = [20 x i8] c"Tem raiz dupla: %f\0A\00"
@.str.2 = [37 x i8] c"Tem raizes complexas: %f+%fi %f-%fi\0A\00"
define void @solve(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%11 = load float, float* %5
%12 = load float, float* %5
%13 = load float, float* %4
%14 = fmul float 4.000000e+00, %13
%15 = load float, float* %6
%16 = fmul float %14, %15
%17 = fneg float %16
%18 = call float @llvm.fmuladd.f32(float %11, float %12, float %17)
store float %18, float* %7
%19 = load float, float* %7
%20 = fcmp ogt float %19, 0.000000e+00
br i1 %20, label %21, label %41
21: ; preds = %3
%22 = load float, float* %7
%23 = call i32 @sqrt(float %22)
%24 = sitofp i32 %23 to float
store float %24, float* %8
%25 = load float, float* %5
%26 = fneg float %25
%27 = load float, float* %8
%28 = fadd float %26, %27
%29 = load float, float* %4
%30 = fmul float 2.000000e+00, %29
%31 = fdiv float %28, %30
%32 = load float, float* %5
%33 = fneg float %32
%34 = load float, float* %8
%35 = fsub float %33, %34
%36 = load float, float* %4
%37 = fmul float 2.000000e+00, %36
%38 = fdiv float %35, %37
%39 = fpext float %38 to double
%40 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %31, double %39)
br label %73
41: ; preds = %3
%42 = load float, float* %7
%43 = fcmp oeq float %42, 0.000000e+00
br i1 %43, label %44, label %51
44: ; preds = %41
%45 = load float, float* %5
%46 = fneg float %45
%47 = load float, float* %4
%48 = fmul float 2.000000e+00, %47
%49 = fdiv float %46, %48
%50 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %49)
br label %72
51: ; preds = %41
%52 = load float, float* %5
%53 = fneg float %52
%54 = load float, float* %4
%55 = fmul float 2.000000e+00, %54
%56 = fdiv float %53, %55
store float %56, float* %9
%57 = load float, float* %7
%58 = fneg float %57
%59 = call i32 @sqrt(float %58)
%60 = sitofp i32 %59 to float
%61 = load float, float* %4
%62 = fmul float 2.000000e+00, %61
%63 = fdiv float %60, %62
store float %63, float* %10
%64 = load float, float* %9
%65 = load float, float* %10
%66 = fpext float %65 to double
%67 = load float, float* %9
%68 = fpext float %67 to double
%69 = load float, float* %10
%70 = fpext float %69 to double
%71 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), float %64, double %66, double %68, double %70)
br label %72
72: ; preds = %51, %44
br label %73
73: ; preds = %72, %21
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"As raizes s\C3\A3o: %f %f\0A\00"
@.str.1 = [20 x i8] c"Tem raiz dupla: %f\0A\00"
@.str.2 = [37 x i8] c"Tem raizes complexas: %f+%fi %f-%fi\0A\00"
define void @solve(float %0, float %1, float %2) {
%4 = fmul float %0, -4.000000e+00
%5 = fmul float %4, %2
%6 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %5)
%7 = fcmp ogt float %6, 0.000000e+00
br i1 %7, label %8, label %19
8: ; preds = %3
%9 = tail call i32 @sqrt(float %6)
%10 = sitofp i32 %9 to float
%11 = fneg float %1
%12 = fsub float %10, %1
%13 = fmul float %0, 2.000000e+00
%14 = fdiv float %12, %13
%15 = fsub float %11, %10
%16 = fdiv float %15, %13
%17 = fpext float %16 to double
%18 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), float %14, double %17)
br label %34
19: ; preds = %3
%20 = fcmp oeq float %6, 0.000000e+00
%21 = fneg float %1
%22 = fmul float %0, 2.000000e+00
%23 = fdiv float %21, %22
br i1 %20, label %24, label %26
24: ; preds = %19
%25 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), float %23)
br label %34
26: ; preds = %19
%27 = fneg float %6
%28 = tail call i32 @sqrt(float %27)
%29 = sitofp i32 %28 to float
%30 = fdiv float %29, %22
%31 = fpext float %30 to double
%32 = fpext float %23 to double
%33 = tail call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), float %23, double %31, double %32, double %31)
br label %34
34: ; preds = %24, %26, %8
ret void
}