#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 *);
int sqrt(float);
int main() {
  float a, b, c, x;
  printf("Enter a b c:\n");
  scanf("%f %f %f", &a, &b, &c);
  if ((b * b - 4 * a * c) >= 0) {
    x = (-1 * b + sqrt(b * b - 4 * a * c)) / (2 * a);
    printf("First root is %f!\n", x);
    x = (-1 * b - sqrt(b * b - 4 * a * c)) / (2 * a);
    printf("Second root is %f!\n", x);
  } else {
    printf("The discriminant is less 0, the roots are immaterial\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%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  0xe89(%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
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     12a8 <main+0x178>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe42(%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
call   1050 <sqrt@plt>
movss  -0x1c(%rbp),%xmm1
cvtsi2ss %eax,%xmm0
subss  %xmm1,%xmm0
movss  0xe0d(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xdc8(%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
call   1050 <sqrt@plt>
movss  -0x18(%rbp),%xmm1
cvtsi2ss %eax,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  %xmm1,%xmm0
movss  0xd86(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12b6 <main+0x186>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm1
mulss  0xe87(%rip),%xmm1
movss  0xc(%rsp),%xmm2
mulss  0x8(%rsp),%xmm1
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jae    11a9 <main+0x69>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
jmp    1247 <main+0x107>
movss  %xmm2,0x10(%rsp)
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
subss  0x10(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm1
mulss  0xe06(%rip),%xmm1
mulss  0x8(%rsp),%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
call   1060 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movaps 0x10(%rsp),%xmm1
xorps  0xdf0(%rip),%xmm1
subss  %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xdfc(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter a b c:\0A\00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [19 x i8] c"First root is %f!\0A\00"
@.str.3 = [20 x i8] c"Second root is %f!\0A\00"
@.str.4 = [54 x i8] c"The discriminant is less 0, the roots are immaterial\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4)
%8 = load float, float* %3
%9 = load float, float* %3
%10 = load float, float* %2
%11 = fmul float 4.000000e+00, %10
%12 = load float, float* %4
%13 = fmul float %11, %12
%14 = fneg float %13
%15 = call float @llvm.fmuladd.f32(float %8, float %9, float %14)
%16 = fcmp oge float %15, 0.000000e+00
br i1 %16, label %17, label %55
17: ; preds = %0
%18 = load float, float* %3
%19 = load float, float* %3
%20 = load float, float* %3
%21 = load float, float* %2
%22 = fmul float 4.000000e+00, %21
%23 = load float, float* %4
%24 = fmul float %22, %23
%25 = fneg float %24
%26 = call float @llvm.fmuladd.f32(float %19, float %20, float %25)
%27 = call i32 @sqrt(float %26)
%28 = sitofp i32 %27 to float
%29 = call float @llvm.fmuladd.f32(float -1.000000e+00, float %18, float %28)
%30 = load float, float* %2
%31 = fmul float 2.000000e+00, %30
%32 = fdiv float %29, %31
store float %32, float* %5
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %34)
%36 = load float, float* %3
%37 = load float, float* %3
%38 = load float, float* %3
%39 = load float, float* %2
%40 = fmul float 4.000000e+00, %39
%41 = load float, float* %4
%42 = fmul float %40, %41
%43 = fneg float %42
%44 = call float @llvm.fmuladd.f32(float %37, float %38, float %43)
%45 = call i32 @sqrt(float %44)
%46 = sitofp i32 %45 to float
%47 = fneg float %46
%48 = call float @llvm.fmuladd.f32(float -1.000000e+00, float %36, float %47)
%49 = load float, float* %2
%50 = fmul float 2.000000e+00, %49
%51 = fdiv float %48, %50
store float %51, float* %5
%52 = load float, float* %5
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %53)
br label %57
55: ; preds = %0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %57
57: ; preds = %55, %17
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [19 x i8] c"First root is %f!\0A\00"
@.str.3 = [20 x i8] c"Second root is %f!\0A\00"
@str = [13 x i8] c"Enter a b c:\00"
@str.5 = [53 x i8] c"The discriminant is less 0, the roots are immaterial\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*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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 ult float %14, 0.000000e+00
br i1 %15, label %40, label %16
16: ; preds = %0
%17 = call i32 @sqrt(float %14)
%18 = sitofp i32 %17 to float
%19 = call float @llvm.fmuladd.f32(float %9, float -1.000000e+00, float %18)
%20 = load float, float* %1
%21 = fmul float %20, 2.000000e+00
%22 = fdiv float %19, %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %23)
%25 = load float, float* %2
%26 = load float, float* %1
%27 = load float, float* %3
%28 = fmul float %26, -4.000000e+00
%29 = fmul float %28, %27
%30 = call float @llvm.fmuladd.f32(float %25, float %25, float %29)
%31 = call i32 @sqrt(float %30)
%32 = sitofp i32 %31 to float
%33 = fneg float %32
%34 = call float @llvm.fmuladd.f32(float %25, float -1.000000e+00, float %33)
%35 = load float, float* %1
%36 = fmul float %35, 2.000000e+00
%37 = fdiv float %34, %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), double %38)
br label %42
40: ; preds = %0
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %16
ret i32 0
}