#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 fabs(double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *, double *);
int sqrt(double);
int main() {
  double a, b, c, disc, x1, x2, realpart, imagpart;
  scanf("%lf,%lf,%lf", &a, &b, &c);
  printf("The equation");
  if (fabs(a) <= 1e-6)
    printf("is not a quadratic\n");
  else {
    disc = b * b - 4 * a * c;
    if (fabs(disc) <= 1e-6)
      printf("has two equal roots:%8.4f\n", -b / (2 * a));
    else if (disc >= 1e-6) {
      x1 = (-b + sqrt(disc)) / (2 * a);
      x2 = (-b - sqrt(disc)) / (2 * a);
      printf("has distinct real roots:\nx1=%8.4f and x2=%8.4f\n", x1, x2);
    } else {
      realpart = -b / (2 * a);
      imagpart = sqrt(-disc) / (2 * a);
      printf("has complex roots:\n");
      printf("%8.4f+%8.4fi\n", realpart, imagpart);
      printf("%8.4f+%8.4fi\n", realpart, imagpart);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1050 <scanf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe75(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11a8 <main+0x68>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13cd <main+0x28d>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe4e(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe02(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1248 <main+0x108>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xde4(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe09(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    13c8 <main+0x288>
movsd  -0x28(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1318 <main+0x1d8>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0x58(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
movsd  0xd71(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xd23(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xd54(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13c3 <main+0x283>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xcd4(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1060 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  0xc99(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xd00(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
lea    0xce8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13c8 <main+0x288>
jmp    13cd <main+0x28d>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xec4(%rip),%rdi
mov    %rsp,%rsi
lea    0x8(%rsp),%rdx
lea    0x38(%rsp),%rcx
call   1060 <scanf@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
call   1050 <fabs@plt>
test   %eax,%eax
jle    125e <main+0x10e>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe5f(%rip),%xmm1
mulsd  0x38(%rsp),%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
call   1050 <fabs@plt>
test   %eax,%eax
jle    126f <main+0x11f>
movapd 0x20(%rsp),%xmm0
ucomisd 0xe38(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
jae    129a <main+0x14a>
movapd 0xe2c(%rip),%xmm2
xorpd  %xmm2,%xmm1
movapd %xmm1,%xmm3
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
xorpd  %xmm2,%xmm0
call   1070 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4f(%rip),%rbx
mov    %rbx,%rdi
movaps 0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
movapd 0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
jmp    130c <main+0x1bc>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
jmp    1313 <main+0x1c3>
movsd  0x8(%rsp),%xmm0
xorpd  0xd93(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
lea    0xda8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1313 <main+0x1c3>
movapd %xmm1,0x10(%rsp)
call   1070 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
subsd  0x10(%rsp),%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
xorps  0xd3e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x20(%rsp),%xmm0
call   1070 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
lea    0xd4e(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%lf,%lf,%lf\00"
@.str.1 = [13 x i8] c"The equation\00"
@.str.2 = [20 x i8] c"is not a quadratic\0A\00"
@.str.3 = [27 x i8] c"has two equal roots:%8.4f\0A\00"
@.str.4 = [48 x i8] c"has distinct real roots:\0Ax1=%8.4f and x2=%8.4f\0A\00"
@.str.5 = [20 x i8] c"has complex roots:\0A\00"
@.str.6 = [14 x i8] c"%8.4f+%8.4fi\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %2, double* %3, double* %4)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%12 = load double, double* %2
%13 = call i32 @fabs(double %12)
%14 = sitofp i32 %13 to double
%15 = fcmp ole double %14, 0x3EB0C6F7A0B5ED8D
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %85
18: ; preds = %0
%19 = load double, double* %3
%20 = load double, double* %3
%21 = load double, double* %2
%22 = fmul double 4.000000e+00, %21
%23 = load double, double* %4
%24 = fmul double %22, %23
%25 = fneg double %24
%26 = call double @llvm.fmuladd.f64(double %19, double %20, double %25)
store double %26, double* %5
%27 = load double, double* %5
%28 = call i32 @fabs(double %27)
%29 = sitofp i32 %28 to double
%30 = fcmp ole double %29, 0x3EB0C6F7A0B5ED8D
br i1 %30, label %31, label %38
31: ; preds = %18
%32 = load double, double* %3
%33 = fneg double %32
%34 = load double, double* %2
%35 = fmul double 2.000000e+00, %34
%36 = fdiv double %33, %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %36)
br label %84
38: ; preds = %18
%39 = load double, double* %5
%40 = fcmp oge double %39, 0x3EB0C6F7A0B5ED8D
br i1 %40, label %41, label %63
41: ; preds = %38
%42 = load double, double* %3
%43 = fneg double %42
%44 = load double, double* %5
%45 = call i32 @sqrt(double %44)
%46 = sitofp i32 %45 to double
%47 = fadd double %43, %46
%48 = load double, double* %2
%49 = fmul double 2.000000e+00, %48
%50 = fdiv double %47, %49
store double %50, double* %6
%51 = load double, double* %3
%52 = fneg double %51
%53 = load double, double* %5
%54 = call i32 @sqrt(double %53)
%55 = sitofp i32 %54 to double
%56 = fsub double %52, %55
%57 = load double, double* %2
%58 = fmul double 2.000000e+00, %57
%59 = fdiv double %56, %58
store double %59, double* %7
%60 = load double, double* %6
%61 = load double, double* %7
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), double %60, double %61)
br label %83
63: ; preds = %38
%64 = load double, double* %3
%65 = fneg double %64
%66 = load double, double* %2
%67 = fmul double 2.000000e+00, %66
%68 = fdiv double %65, %67
store double %68, double* %8
%69 = load double, double* %5
%70 = fneg double %69
%71 = call i32 @sqrt(double %70)
%72 = sitofp i32 %71 to double
%73 = load double, double* %2
%74 = fmul double 2.000000e+00, %73
%75 = fdiv double %72, %74
store double %75, double* %9
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%77 = load double, double* %8
%78 = load double, double* %9
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %77, double %78)
%80 = load double, double* %8
%81 = load double, double* %9
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %80, double %81)
br label %83
83: ; preds = %63, %41
br label %84
84: ; preds = %83, %31
br label %85
85: ; preds = %84, %16
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%lf,%lf,%lf\00"
@.str.1 = [13 x i8] c"The equation\00"
@.str.3 = [27 x i8] c"has two equal roots:%8.4f\0A\00"
@.str.4 = [48 x i8] c"has distinct real roots:\0Ax1=%8.4f and x2=%8.4f\0A\00"
@.str.6 = [14 x i8] c"%8.4f+%8.4fi\0A\00"
@str = [19 x i8] c"has complex roots:\00"
@str.7 = [19 x i8] c"is not a quadratic\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), double* %1, double* %2, double* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = load double, double* %1
%10 = call i32 @fabs(double %9)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
br label %63
14: ; preds = %0
%15 = load double, double* %2
%16 = load double, double* %1
%17 = load double, double* %3
%18 = fmul double %16, -4.000000e+00
%19 = fmul double %18, %17
%20 = call double @llvm.fmuladd.f64(double %15, double %15, double %19)
%21 = call i32 @fabs(double %20)
%22 = icmp slt i32 %21, 1
br i1 %22, label %23, label %30
23: ; preds = %14
%24 = load double, double* %2
%25 = fneg double %24
%26 = load double, double* %1
%27 = fmul double %26, 2.000000e+00
%28 = fdiv double %25, %27
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %28)
br label %63
30: ; preds = %14
%31 = fcmp ult double %20, 0x3EB0C6F7A0B5ED8D
%32 = load double, double* %2
br i1 %31, label %49, label %33
33: ; preds = %30
%34 = call i32 @sqrt(double %20)
%35 = sitofp i32 %34 to double
%36 = fsub double %35, %32
%37 = load double, double* %1
%38 = fmul double %37, 2.000000e+00
%39 = fdiv double %36, %38
%40 = load double, double* %2
%41 = fneg double %40
%42 = call i32 @sqrt(double %20)
%43 = sitofp i32 %42 to double
%44 = fsub double %41, %43
%45 = load double, double* %1
%46 = fmul double %45, 2.000000e+00
%47 = fdiv double %44, %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), double %39, double %47)
br label %63
49: ; preds = %30
%50 = fneg double %32
%51 = load double, double* %1
%52 = fmul double %51, 2.000000e+00
%53 = fdiv double %50, %52
%54 = fneg double %20
%55 = call i32 @sqrt(double %54)
%56 = sitofp i32 %55 to double
%57 = load double, double* %1
%58 = fmul double %57, 2.000000e+00
%59 = fdiv double %56, %58
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %53, double %59)
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), double %53, double %59)
br label %63
63: ; preds = %23, %49, %33, %12
ret i32 0
}