#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 */
scalar_t__ pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int sqrt(scalar_t__);
void QuadraticEquation() {
  int a, b, c;
  double resultp, resultm;
  printf("Enter coffecients\n\n>>");
  printf("a = ");
  scanf("%d", &a);
  printf("\nb = ");
  scanf("%d", &b);
  printf("\nc = ");
  scanf("%d", &c);
  resultp =
      (double)(-b + sqrt(pow((double)b, (double)2) - (4 * a * c))) / (2 * a);
  resultm =
      (double)(-b - sqrt(pow((double)b, (double)2) - (4 * a * c))) / (2 * a);
  printf("Roots are %f and %f", resultp, resultm);
}


x86 assembly (clang, -O0):
<QuadraticEquation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe3b(%rip),%xmm1
call   1050 <pow@plt>
mov    %rax,%rdi
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
cltq
sub    %rax,%rdi
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdec(%rip),%xmm1
call   1050 <pow@plt>
mov    %rax,%rdi
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
cltq
sub    %rax,%rdi
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xdd3(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QuadraticEquation>:
push   %rbx
sub    $0x20,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x14(%rsp),%ebx
cvtsi2sd %ebx,%xmm0
movsd  0xe45(%rip),%xmm1
call   1050 <pow@plt>
movslq 0xc(%rsp),%rcx
movslq 0x10(%rsp),%rdx
imul   %rcx,%rdx
shl    $0x2,%rdx
sub    %rdx,%rax
mov    %rax,%rdi
call   1060 <sqrt@plt>
sub    %ebx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mov    0xc(%rsp),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    0x14(%rsp),%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xdf0(%rip),%xmm1
call   1050 <pow@plt>
movslq 0xc(%rsp),%rcx
movslq 0x10(%rsp),%rdx
imul   %rcx,%rdx
shl    $0x2,%rdx
sub    %rdx,%rax
mov    %rax,%rdi
call   1060 <sqrt@plt>
add    %ebx,%eax
neg    %eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mov    0xc(%rsp),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm1
lea    0xddd(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter coffecients\0A\0A>>\00"
@.str.1 = [5 x i8] c"a = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"\0Ab = \00"
@.str.4 = [6 x i8] c"\0Ac = \00"
@.str.5 = [20 x i8] c"Roots are %f and %f\00"
define void @QuadraticEquation() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %2
%14 = sub nsw i32 0, %13
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to double
%17 = call i64 @pow(double %16, double 2.000000e+00)
%18 = load i32, i32* %1
%19 = mul nsw i32 4, %18
%20 = load i32, i32* %3
%21 = mul nsw i32 %19, %20
%22 = sext i32 %21 to i64
%23 = sub nsw i64 %17, %22
%24 = call i32 @sqrt(i64 %23)
%25 = add nsw i32 %14, %24
%26 = sitofp i32 %25 to double
%27 = load i32, i32* %1
%28 = mul nsw i32 2, %27
%29 = sitofp i32 %28 to double
%30 = fdiv double %26, %29
store double %30, double* %4
%31 = load i32, i32* %2
%32 = sub nsw i32 0, %31
%33 = load i32, i32* %2
%34 = sitofp i32 %33 to double
%35 = call i64 @pow(double %34, double 2.000000e+00)
%36 = load i32, i32* %1
%37 = mul nsw i32 4, %36
%38 = load i32, i32* %3
%39 = mul nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = sub nsw i64 %35, %40
%42 = call i32 @sqrt(i64 %41)
%43 = sub nsw i32 %32, %42
%44 = sitofp i32 %43 to double
%45 = load i32, i32* %1
%46 = mul nsw i32 2, %45
%47 = sitofp i32 %46 to double
%48 = fdiv double %44, %47
store double %48, double* %5
%49 = load double, double* %4
%50 = load double, double* %5
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %49, double %50)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter coffecients\0A\0A>>\00"
@.str.1 = [5 x i8] c"a = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"\0Ab = \00"
@.str.4 = [6 x i8] c"\0Ac = \00"
@.str.5 = [20 x i8] c"Roots are %f and %f\00"
define void @QuadraticEquation() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %2
%15 = sitofp i32 %14 to double
%16 = call i64 @pow(double %15, double 2.000000e+00)
%17 = load i32, i32* %1
%18 = shl nsw i32 %17, 2
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = sext i32 %20 to i64
%22 = sub nsw i64 %16, %21
%23 = call i32 @sqrt(i64 %22)
%24 = sub i32 %23, %14
%25 = sitofp i32 %24 to double
%26 = load i32, i32* %1
%27 = shl nsw i32 %26, 1
%28 = sitofp i32 %27 to double
%29 = fdiv double %25, %28
%30 = load i32, i32* %2
%31 = sitofp i32 %30 to double
%32 = call i64 @pow(double %31, double 2.000000e+00)
%33 = load i32, i32* %1
%34 = shl nsw i32 %33, 2
%35 = load i32, i32* %3
%36 = mul nsw i32 %34, %35
%37 = sext i32 %36 to i64
%38 = sub nsw i64 %32, %37
%39 = call i32 @sqrt(i64 %38)
%40 = add i32 %30, %39
%41 = sub i32 0, %40
%42 = sitofp i32 %41 to double
%43 = load i32, i32* %1
%44 = shl nsw i32 %43, 1
%45 = sitofp i32 %44 to double
%46 = fdiv double %42, %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %29, double %46)
ret void
}