#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(double, double);
int /*<<< orphan*/ printf(char *, ...);
void real_root(int CoeffA, int CoeffB, double discrim) {
  double root1;
  double root2;
  root1 = (-CoeffB + pow(discrim, 0.5)) / (2 * CoeffA);
  root2 = (-CoeffB - pow(discrim, 0.5)) / (2 * CoeffA);
  if (!(discrim == 0))
    printf("Roots are %.3lf and %.3lf", root1, root2);
  else
    printf("Root at x = %.3lf", root1);
  printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n");
  return;
}


x86 assembly (clang, -O0):
<real_root>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe85(%rip),%xmm1
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <real_root+0x96>
jp     11b6 <real_root+0x96>
jmp    11d3 <real_root+0xb3>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe41(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11e6 <real_root+0xc6>
movsd  -0x18(%rbp),%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_root>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
mov    %esi,%ebp
mov    %edi,%ebx
movsd  0xeb8(%rip),%xmm1
call   1050 <pow@plt>
sub    %ebp,%eax
add    %ebx,%ebx
cltd
idiv   %ebx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0xe91(%rip),%xmm1
call   1050 <pow@plt>
xorpd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    119c <real_root+0x6c>
jp     119c <real_root+0x6c>
lea    0xe95(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11be <real_root+0x8e>
add    %ebp,%eax
neg    %eax
cltd
idiv   %ebx
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
lea    0xe57(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xe6f(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Roots are %.3lf and %.3lf\00"
@.str.1 = [18 x i8] c"Root at x = %.3lf\00"
@.str.2 = [49 x i8] c"\0A-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\0A\0A\00"
define void @real_root(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 0, %9
%11 = load double, double* %6
%12 = call i32 @pow(double %11, double 5.000000e-01)
%13 = add nsw i32 %10, %12
%14 = load i32, i32* %4
%15 = mul nsw i32 2, %14
%16 = sdiv i32 %13, %15
%17 = sitofp i32 %16 to double
store double %17, double* %7
%18 = load i32, i32* %5
%19 = sub nsw i32 0, %18
%20 = load double, double* %6
%21 = call i32 @pow(double %20, double 5.000000e-01)
%22 = sub nsw i32 %19, %21
%23 = load i32, i32* %4
%24 = mul nsw i32 2, %23
%25 = sdiv i32 %22, %24
%26 = sitofp i32 %25 to double
store double %26, double* %8
%27 = load double, double* %6
%28 = fcmp oeq double %27, 0.000000e+00
br i1 %28, label %33, label %29
29: ; preds = %3
%30 = load double, double* %7
%31 = load double, double* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %30, double %31)
br label %36
33: ; preds = %3
%34 = load double, double* %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %34)
br label %36
36: ; preds = %33, %29
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Roots are %.3lf and %.3lf\00"
@.str.1 = [18 x i8] c"Root at x = %.3lf\00"
@str = [48 x i8] c"\0A-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\0A\00"
define void @real_root(i32 %0, i32 %1, double %2) {
%4 = tail call i32 @pow(double %2, double 5.000000e-01)
%5 = sub i32 %4, %1
%6 = shl nsw i32 %0, 1
%7 = sdiv i32 %5, %6
%8 = sitofp i32 %7 to double
%9 = tail call i32 @pow(double %2, double 5.000000e-01)
%10 = fcmp oeq double %2, 0.000000e+00
br i1 %10, label %17, label %11
11: ; preds = %3
%12 = add i32 %9, %1
%13 = sub i32 0, %12
%14 = sdiv i32 %13, %6
%15 = sitofp i32 %14 to double
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %8, double %15)
br label %19
17: ; preds = %3
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %8)
br label %19
19: ; preds = %17, %11
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
ret void
}