#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 pow(int, int);
int /*<<< orphan*/ printf(char *);
double discrim_quad(int CoeffA, int CoeffB, int CoeffC) {
  double root_check;
  root_check = (pow(CoeffB, 2)) - (4 * CoeffA * CoeffC);
  if (root_check > 0)
    printf("The parabola has two real roots.\n");
  else if (root_check == 0)
    printf("The parabola has one root.\n");
  else
    printf("The parabola has two complex roots.\n");
  return root_check;
}


x86 assembly (clang, -O0):
<discrim_quad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1176 <discrim_quad+0x56>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <discrim_quad+0x90>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    119f <discrim_quad+0x7f>
jp     119f <discrim_quad+0x7f>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ab <discrim_quad+0x8b>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
jmp    11b0 <discrim_quad+0x90>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<discrim_quad>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %edi,%ebp
mov    %esi,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,%ebx
imul   %r14d,%ebp
shl    $0x2,%ebp
sub    %ebp,%ebx
test   %ebx,%ebx
lea    0xedb(%rip),%rax
lea    0xeb0(%rip),%rcx
cmove  %rax,%rcx
lea    0xee4(%rip),%rdi
cmovle %rcx,%rdi
call   1030 <puts@plt>
cvtsi2sd %ebx,%xmm0
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"The parabola has two real roots.\0A\00"
@.str.1 = [28 x i8] c"The parabola has one root.\0A\00"
@.str.2 = [37 x i8] c"The parabola has two complex roots.\0A\00"
define double @discrim_quad(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = call i32 @pow(i32 %8, i32 2)
%10 = load i32, i32* %4
%11 = mul nsw i32 4, %10
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
%14 = sub nsw i32 %9, %13
%15 = sitofp i32 %14 to double
store double %15, double* %7
%16 = load double, double* %7
%17 = fcmp ogt double %16, 0.000000e+00
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %28
20: ; preds = %3
%21 = load double, double* %7
%22 = fcmp oeq double %21, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
br label %28
28: ; preds = %27, %18
%29 = load double, double* %7
ret double %29
}

LLVM IR (-O2):
@str = [36 x i8] c"The parabola has two complex roots.\00"
@str.3 = [27 x i8] c"The parabola has one root.\00"
@str.4 = [33 x i8] c"The parabola has two real roots.\00"
define double @discrim_quad(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @pow(i32 %1, i32 2)
%5 = mul i32 %0, -4
%6 = mul i32 %5, %2
%7 = add i32 %4, %6
%8 = icmp sgt i32 %7, 0
%9 = icmp eq i32 %7, 0
%10 = select i1 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0)
%11 = select i1 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0), i8* %10
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
%13 = sitofp i32 %7 to double
ret double %13
}