#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 sqrt(float);
int quadratic(float a, float b, float c, float *x1, float *x2) {
  float d;
  d = b * b - 4 * a * c;
  if (d < 0) {
    printf("\033[1;31mRoots are complex number.\n\033[37m");
    printf("Root of quadratic are: ");
    printf("%.3f%+.3fi", -b / (2 * a), sqrt(-d) / (2 * a));
    printf(", %.3f%+.3fi", -b / (2 * a), -sqrt(-d) / (2 * a));
    return -1;
  } else if (d == 0) {
    printf("\033[1;31mBoth roots are equal.\n\033[37m\n");
    *x1 = -b / (2 * a);
    *x2 = *x1;
    printf("Roots of quadratic equation is: %.3f", *x1);
    return 0;
  } else {
    printf("\033[1;31mRoots are real numbers.\n\033[37m\n");
    *x1 = (-b + sqrt(d)) / (2 * a);
    *x2 = (-b - sqrt(d)) / (2 * a);
    printf("Roots of quadratic equation are: %.3f, %.3f", *x1, *x2);
    return 1;
  }
}


x86 assembly (clang, -O0):
<quadratic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xeaf(%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,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    1293 <quadratic+0x173>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe4c(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
movss  0xe13(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe44(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xdde(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xd98(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdc7(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e0 <quadratic+0x2c0>
movss  -0x24(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1319 <quadratic+0x1f9>
jp     1319 <quadratic+0x1f9>
lea    0xda3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd32(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd72(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e0 <quadratic+0x2c0>
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x24(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x40(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xca8(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x24(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xc62(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xcf1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadratic>:
push   %r14
push   %rbx
sub    $0x58,%rsp
movss  0xec1(%rip),%xmm3
mulss  %xmm0,%xmm3
mulss  %xmm2,%xmm3
movaps %xmm1,%xmm4
mulss  %xmm1,%xmm4
addss  %xmm3,%xmm4
xorps  %xmm2,%xmm2
ucomiss %xmm4,%xmm2
movss  %xmm0,0xc(%rsp)
movaps %xmm1,0x10(%rsp)
jbe    11d2 <quadratic+0xa2>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
movaps %xmm4,0x30(%rsp)
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm1
movss  0xe70(%rip),%xmm3
movaps 0x10(%rsp),%xmm0
xorps  %xmm3,%xmm0
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  %xmm2,0x10(%rsp)
movaps 0x30(%rsp),%xmm2
movaps %xmm2,%xmm0
xorps  %xmm3,%xmm0
ucomiss %xmm2,%xmm3
movss  %xmm1,0xc(%rsp)
movaps %xmm0,0x40(%rsp)
jb     1233 <quadratic+0x103>
sqrtss %xmm0,%xmm0
jmp    123e <quadratic+0x10e>
mov    %rsi,%r14
mov    %rdi,%rbx
ucomiss %xmm2,%xmm4
jne    12a7 <quadratic+0x177>
jp     12a7 <quadratic+0x177>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
movaps 0x10(%rsp),%xmm1
xorps  0xe11(%rip),%xmm1
movss  0xc(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movss  %xmm1,(%r14)
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe47(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
jmp    136a <quadratic+0x23a>
call   1050 <sqrt@plt>
movss  0xc(%rsp),%xmm1
divss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe11(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
xorps  %xmm1,%xmm1
movaps 0x40(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jb     1270 <quadratic+0x140>
sqrtss %xmm0,%xmm0
jmp    1275 <quadratic+0x145>
call   1050 <sqrt@plt>
xorps  0xd94(%rip),%xmm0
divss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xdcf(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xffffffff,%eax
jmp    136a <quadratic+0x23a>
lea    0xe0f(%rip),%rdi
movaps %xmm4,0x30(%rsp)
call   1030 <puts@plt>
movaps 0x30(%rsp),%xmm2
movaps 0xd4c(%rip),%xmm0
movaps 0x10(%rsp),%xmm1
xorps  %xmm1,%xmm0
movaps %xmm0,0x40(%rsp)
xorps  %xmm3,%xmm3
sqrtss %xmm2,%xmm3
xorps  %xmm4,%xmm4
ucomiss %xmm4,%xmm2
movaps %xmm3,%xmm0
jae    1304 <quadratic+0x1d4>
movaps %xmm2,%xmm0
movss  %xmm3,0x2c(%rsp)
call   1050 <sqrt@plt>
xorps  %xmm4,%xmm4
movss  0x2c(%rsp),%xmm3
movaps 0x30(%rsp),%xmm2
movaps 0x10(%rsp),%xmm1
subss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,(%rbx)
ucomiss %xmm4,%xmm2
jae    1336 <quadratic+0x206>
movaps %xmm2,%xmm0
movss  %xmm1,0xc(%rsp)
call   1050 <sqrt@plt>
movss  0xc(%rsp),%xmm1
movaps %xmm0,%xmm3
movaps 0x40(%rsp),%xmm2
subss  %xmm3,%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,(%r14)
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xd33(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\1B[1;31mRoots are complex number.\0A\1B[37m\00"
@.str.1 = [24 x i8] c"Root of quadratic are: \00"
@.str.2 = [11 x i8] c"%.3f%+.3fi\00"
@.str.3 = [13 x i8] c", %.3f%+.3fi\00"
@.str.4 = [36 x i8] c"\1B[1;31mBoth roots are equal.\0A\1B[37m\0A\00"
@.str.5 = [37 x i8] c"Roots of quadratic equation is: %.3f\00"
@.str.6 = [38 x i8] c"\1B[1;31mRoots are real numbers.\0A\1B[37m\0A\00"
@.str.7 = [44 x i8] c"Roots of quadratic equation are: %.3f, %.3f\00"
define i32 @quadratic(float %0, float %1, float %2, float* %3, float* %4) {
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
%11 = alloca float*
%12 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float* %3, float** %10
store float* %4, float** %11
%13 = load float, float* %8
%14 = load float, float* %8
%15 = load float, float* %7
%16 = fmul float 4.000000e+00, %15
%17 = load float, float* %9
%18 = fmul float %16, %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %13, float %14, float %19)
store float %20, float* %12
%21 = load float, float* %12
%22 = fcmp olt float %21, 0.000000e+00
br i1 %22, label %23, label %55
23: ; preds = %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%26 = load float, float* %8
%27 = fneg float %26
%28 = load float, float* %7
%29 = fmul float 2.000000e+00, %28
%30 = fdiv float %27, %29
%31 = fpext float %30 to double
%32 = load float, float* %12
%33 = fneg float %32
%34 = call float @sqrt(float %33)
%35 = load float, float* %7
%36 = fmul float 2.000000e+00, %35
%37 = fdiv float %34, %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %31, double %38)
%40 = load float, float* %8
%41 = fneg float %40
%42 = load float, float* %7
%43 = fmul float 2.000000e+00, %42
%44 = fdiv float %41, %43
%45 = fpext float %44 to double
%46 = load float, float* %12
%47 = fneg float %46
%48 = call float @sqrt(float %47)
%49 = fneg float %48
%50 = load float, float* %7
%51 = fmul float 2.000000e+00, %50
%52 = fdiv float %49, %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %45, double %53)
store i32 -1, i32* %6
br label %100
55: ; preds = %5
%56 = load float, float* %12
%57 = fcmp oeq float %56, 0.000000e+00
br i1 %57, label %58, label %73
58: ; preds = %55
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%60 = load float, float* %8
%61 = fneg float %60
%62 = load float, float* %7
%63 = fmul float 2.000000e+00, %62
%64 = fdiv float %61, %63
%65 = load float*, float** %10
store float %64, float* %65
%66 = load float*, float** %10
%67 = load float, float* %66
%68 = load float*, float** %11
store float %67, float* %68
%69 = load float*, float** %10
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %71)
store i32 0, i32* %6
br label %100
73: ; preds = %55
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%75 = load float, float* %8
%76 = fneg float %75
%77 = load float, float* %12
%78 = call float @sqrt(float %77)
%79 = fadd float %76, %78
%80 = load float, float* %7
%81 = fmul float 2.000000e+00, %80
%82 = fdiv float %79, %81
%83 = load float*, float** %10
store float %82, float* %83
%84 = load float, float* %8
%85 = fneg float %84
%86 = load float, float* %12
%87 = call float @sqrt(float %86)
%88 = fsub float %85, %87
%89 = load float, float* %7
%90 = fmul float 2.000000e+00, %89
%91 = fdiv float %88, %90
%92 = load float*, float** %11
store float %91, float* %92
%93 = load float*, float** %10
%94 = load float, float* %93
%95 = fpext float %94 to double
%96 = load float*, float** %11
%97 = load float, float* %96
%98 = fpext float %97 to double
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), double %95, double %98)
store i32 1, i32* %6
br label %100
100: ; preds = %73, %58, %23
%101 = load i32, i32* %6
ret i32 %101
}

LLVM IR (-O2):
@.str = [39 x i8] c"\1B[1;31mRoots are complex number.\0A\1B[37m\00"
@.str.1 = [24 x i8] c"Root of quadratic are: \00"
@.str.2 = [11 x i8] c"%.3f%+.3fi\00"
@.str.3 = [13 x i8] c", %.3f%+.3fi\00"
@.str.5 = [37 x i8] c"Roots of quadratic equation is: %.3f\00"
@.str.7 = [44 x i8] c"Roots of quadratic equation are: %.3f, %.3f\00"
@str = [37 x i8] c"\1B[1;31mRoots are real numbers.\0A\1B[37m\00"
@str.8 = [35 x i8] c"\1B[1;31mBoth roots are equal.\0A\1B[37m\00"
define i32 @quadratic(float %0, float %1, float %2, float* nocapture %3, float* nocapture writeonly %4) {
%6 = fmul float %0, -4.000000e+00
%7 = fmul float %6, %2
%8 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %7)
%9 = fcmp olt float %8, 0.000000e+00
br i1 %9, label %10, label %27
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%13 = fneg float %1
%14 = fmul float %0, 2.000000e+00
%15 = fdiv float %13, %14
%16 = fpext float %15 to double
%17 = fneg float %8
%18 = tail call float @sqrt(float %17)
%19 = fdiv float %18, %14
%20 = fpext float %19 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %16, double %20)
%22 = tail call float @sqrt(float %17)
%23 = fneg float %22
%24 = fdiv float %23, %14
%25 = fpext float %24 to double
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), double %16, double %25)
br label %51
27: ; preds = %5
%28 = fcmp oeq float %8, 0.000000e+00
br i1 %28, label %29, label %37
29: ; preds = %27
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
%31 = fneg float %1
%32 = fmul float %0, 2.000000e+00
%33 = fdiv float %31, %32
store float %33, float* %3
store float %33, float* %4
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), double %35)
br label %51
37: ; preds = %27
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%39 = fneg float %1
%40 = tail call float @sqrt(float %8)
%41 = fsub float %40, %1
%42 = fmul float %0, 2.000000e+00
%43 = fdiv float %41, %42
store float %43, float* %3
%44 = tail call float @sqrt(float %8)
%45 = fsub float %39, %44
%46 = fdiv float %45, %42
store float %46, float* %4
%47 = load float, float* %3
%48 = fpext float %47 to double
%49 = fpext float %46 to double
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), double %48, double %49)
br label %51
51: ; preds = %37, %29, %10
%52 = phi i32 [ -1, %10 ], [ 0, %29 ], [ 1, %37 ]
ret i32 %52
}