#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);
int main() {
  float a, b, c;
  a = b = c = 0;
  printf("Enter coefficients of quadratic equation: ");
  scanf("%f %f %f", &a, &b, &c);
  if (a == 0) {
    printf("This is a linear equation!\n");
    return 0;
  }
  float delta = b * b - 4 * a * c;
  if (delta > 0) {
    float x1 = (-b - sqrt(delta)) / (2 * a);
    float x2 = (-b + sqrt(delta)) / (2 * a);
    printf("Solutions: x1 = %.2f, x2 = %.2f.\n", x1, x2);
  } else if (delta == 0) {
    float x = (-b) / (2 * a);
    printf("Solution: x = %.2f.\n", x);
  } else
    printf("There is no solution.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11ae <main+0x7e>
jp     11ae <main+0x7e>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1315 <main+0x1e5>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe40(%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,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12a0 <main+0x170>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xdda(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xd97(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdc4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    130e <main+0x1de>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12fb <main+0x1cb>
jp     12fb <main+0x1cb>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd33(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd8b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1309 <main+0x1d9>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    130e <main+0x1de>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a2 <main+0x62>
jp     11a2 <main+0x62>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
jmp    12a9 <main+0x169>
movss  0x4(%rsp),%xmm3
movss  0xe50(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  0x8(%rsp),%xmm2
movaps %xmm3,%xmm4
mulss  %xmm3,%xmm4
addss  %xmm2,%xmm4
ucomiss %xmm1,%xmm4
jbe    127b <main+0x13b>
xorps  0xe3b(%rip),%xmm3
xorps  %xmm1,%xmm1
sqrtss %xmm4,%xmm1
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm4
movaps %xmm1,%xmm0
jae    1212 <main+0xd2>
movaps %xmm4,%xmm0
movaps %xmm3,0x20(%rsp)
movaps %xmm4,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
call   1060 <sqrt@plt>
xorps  %xmm2,%xmm2
movss  0xc(%rsp),%xmm1
movaps 0x10(%rsp),%xmm4
movaps 0x20(%rsp),%xmm3
subss  %xmm0,%xmm3
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm3
movss  0x4(%rsp),%xmm0
ucomiss %xmm2,%xmm4
jae    124f <main+0x10f>
movss  %xmm0,0x10(%rsp)
movaps %xmm4,%xmm0
movaps %xmm3,0x20(%rsp)
call   1060 <sqrt@plt>
movaps 0x20(%rsp),%xmm3
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
subss  %xmm0,%xmm1
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xde2(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    12a9 <main+0x169>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm4
jne    12b0 <main+0x170>
jp     12b0 <main+0x170>
xorps  0xd84(%rip),%xmm3
addss  %xmm0,%xmm0
divss  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
lea    0xdd4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret
lea    0xdd4(%rip),%rdi
jmp    1198 <main+0x58>

LLVM IR (-O0):
@.str = [43 x i8] c"Enter coefficients of quadratic equation: \00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [28 x i8] c"This is a linear equation!\0A\00"
@.str.3 = [34 x i8] c"Solutions: x1 = %.2f, x2 = %.2f.\0A\00"
@.str.4 = [21 x i8] c"Solution: x = %.2f.\0A\00"
@.str.5 = [23 x i8] c"There is no solution.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4)
%11 = load float, float* %2
%12 = fcmp oeq float %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %64
15: ; preds = %0
%16 = load float, float* %3
%17 = load float, float* %3
%18 = load float, float* %2
%19 = fmul float 4.000000e+00, %18
%20 = load float, float* %4
%21 = fmul float %19, %20
%22 = fneg float %21
%23 = call float @llvm.fmuladd.f32(float %16, float %17, float %22)
store float %23, float* %5
%24 = load float, float* %5
%25 = fcmp ogt float %24, 0.000000e+00
br i1 %25, label %26, label %48
26: ; preds = %15
%27 = load float, float* %3
%28 = fneg float %27
%29 = load float, float* %5
%30 = call float @sqrt(float %29)
%31 = fsub float %28, %30
%32 = load float, float* %2
%33 = fmul float 2.000000e+00, %32
%34 = fdiv float %31, %33
store float %34, float* %6
%35 = load float, float* %3
%36 = fneg float %35
%37 = load float, float* %5
%38 = call float @sqrt(float %37)
%39 = fadd float %36, %38
%40 = load float, float* %2
%41 = fmul float 2.000000e+00, %40
%42 = fdiv float %39, %41
store float %42, float* %7
%43 = load float, float* %6
%44 = fpext float %43 to double
%45 = load float, float* %7
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %44, double %46)
br label %63
48: ; preds = %15
%49 = load float, float* %5
%50 = fcmp oeq float %49, 0.000000e+00
br i1 %50, label %51, label %60
51: ; preds = %48
%52 = load float, float* %3
%53 = fneg float %52
%54 = load float, float* %2
%55 = fmul float 2.000000e+00, %54
%56 = fdiv float %53, %55
store float %56, float* %8
%57 = load float, float* %8
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %58)
br label %62
60: ; preds = %48
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %62
62: ; preds = %60, %51
br label %63
63: ; preds = %62, %26
store i32 0, i32* %1
br label %64
64: ; preds = %63, %13
%65 = load i32, i32* %1
ret i32 %65
}

LLVM IR (-O2):
@.str = [43 x i8] c"Enter coefficients of quadratic equation: \00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.3 = [34 x i8] c"Solutions: x1 = %.2f, x2 = %.2f.\0A\00"
@.str.4 = [21 x i8] c"Solution: x = %.2f.\0A\00"
@str = [22 x i8] c"There is no solution.\00"
@str.6 = [27 x i8] c"This is a linear equation!\00"
define i32 @main() {
%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*
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 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* %1
%10 = fcmp oeq float %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.6, i64 0, i64 0))
br label %46
13: ; preds = %0
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fmul float %9, -4.000000e+00
%17 = fmul float %16, %15
%18 = call float @llvm.fmuladd.f32(float %14, float %14, float %17)
%19 = fcmp ogt float %18, 0.000000e+00
br i1 %19, label %20, label %36
20: ; preds = %13
%21 = fneg float %14
%22 = call float @sqrt(float %18)
%23 = fsub float %21, %22
%24 = load float, float* %1
%25 = fmul float %24, 2.000000e+00
%26 = fdiv float %23, %25
%27 = load float, float* %2
%28 = call float @sqrt(float %18)
%29 = fsub float %28, %27
%30 = load float, float* %1
%31 = fmul float %30, 2.000000e+00
%32 = fdiv float %29, %31
%33 = fpext float %26 to double
%34 = fpext float %32 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), double %33, double %34)
br label %46
36: ; preds = %13
%37 = fcmp oeq float %18, 0.000000e+00
br i1 %37, label %38, label %44
38: ; preds = %36
%39 = fneg float %14
%40 = fmul float %9, 2.000000e+00
%41 = fdiv float %39, %40
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), double %42)
br label %46
44: ; preds = %36
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %46
46: ; preds = %20, %44, %38, %11
ret i32 0
}