#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int sqrt(int);
int main() {
  int a, b, c;
  float x1, x2;
  printf("Enter the value of a b c: ");
  scanf("%d %d %d", &a, &b, &c);
  if (a == b && a == 0) {
    printf("No Solution \n");
    exit(0);
  }
  if (a == 0) {
    x1 = -(c / b);
    printf("Only on Solution: X =%.2f \n", x1);
    exit(0);
  }
  int temp = b * b - 4 * a * c;
  if (temp < 0) {
    printf("No Real Roots \n");
    exit(0);
  }
  printf("temp =%d \n", temp);
  x1 = (-b + sqrt(temp)) / 2 * a;
  x2 = (-b - sqrt(temp)) / 2 * a;
  printf("Roots are X1=%.2f X2=%.2f \n", x1, x2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11a0 <main+0x60>
cmpl   $0x0,-0x8(%rbp)
jne    11a0 <main+0x60>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11de <main+0x9e>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1213 <main+0xd3>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x1c(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdd4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%ebx
mov    %ebx,%ecx
or     %eax,%ecx
je     1227 <main+0xd7>
test   %eax,%eax
je     1230 <main+0xe0>
imul   %ebx,%ebx
imul   0x10(%rsp),%eax
shl    $0x2,%eax
sub    %eax,%ebx
js     1256 <main+0x106>
lea    0xe8d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%ebp
mov    %ebx,%edi
call   1060 <sqrt@plt>
sub    %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
imul   0xc(%rsp),%ecx
cvtsi2ss %ecx,%xmm0
movss  %xmm0,0x14(%rsp)
mov    0x8(%rsp),%ebp
mov    %ebx,%edi
call   1060 <sqrt@plt>
add    %ebp,%eax
mov    %eax,%ecx
neg    %ecx
shr    $0x1f,%ecx
sub    %eax,%ecx
sar    %ecx
imul   0xc(%rsp),%ecx
cvtsi2ss %ecx,%xmm1
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe34(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe48(%rip),%rdi
jmp    125d <main+0x10d>
mov    0x10(%rsp),%eax
cltd
idiv   %ebx
neg    %eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xddc(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Enter the value of a b c: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [14 x i8] c"No Solution \0A\00"
@.str.3 = [28 x i8] c"Only on Solution: X =%.2f \0A\00"
@.str.4 = [16 x i8] c"No Real Roots \0A\00"
@.str.5 = [11 x i8] c"temp =%d \0A\00"
@.str.6 = [28 x i8] c"Roots are X1=%.2f X2=%.2f \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %19
13: ; preds = %0
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @exit(i32 0)
unreachable
19: ; preds = %13, %0
%20 = load i32, i32* %2
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = sdiv i32 %23, %24
%26 = sub nsw i32 0, %25
%27 = sitofp i32 %26 to float
store float %27, float* %5
%28 = load float, float* %5
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %29)
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %19
%33 = load i32, i32* %3
%34 = load i32, i32* %3
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %2
%37 = mul nsw i32 4, %36
%38 = load i32, i32* %4
%39 = mul nsw i32 %37, %38
%40 = sub nsw i32 %35, %39
store i32 %40, i32* %7
%41 = load i32, i32* %7
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @exit(i32 0)
unreachable
46: ; preds = %32
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %3
%50 = sub nsw i32 0, %49
%51 = load i32, i32* %7
%52 = call i32 @sqrt(i32 %51)
%53 = add nsw i32 %50, %52
%54 = sdiv i32 %53, 2
%55 = load i32, i32* %2
%56 = mul nsw i32 %54, %55
%57 = sitofp i32 %56 to float
store float %57, float* %5
%58 = load i32, i32* %3
%59 = sub nsw i32 0, %58
%60 = load i32, i32* %7
%61 = call i32 @sqrt(i32 %60)
%62 = sub nsw i32 %59, %61
%63 = sdiv i32 %62, 2
%64 = load i32, i32* %2
%65 = mul nsw i32 %63, %64
%66 = sitofp i32 %65 to float
store float %66, float* %6
%67 = load float, float* %5
%68 = fpext float %67 to double
%69 = load float, float* %6
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %68, double %70)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter the value of a b c: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.3 = [28 x i8] c"Only on Solution: X =%.2f \0A\00"
@.str.5 = [11 x i8] c"temp =%d \0A\00"
@.str.6 = [28 x i8] c"Roots are X1=%.2f X2=%.2f \0A\00"
@str = [15 x i8] c"No Real Roots \00"
@str.7 = [13 x i8] c"No Solution \00"
define i32 @main() {
%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 ([27 x i8], [27 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), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = or i32 %10, %9
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.7, i64 0, i64 0))
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %0
%17 = icmp eq i32 %9, 0
br i1 %17, label %18, label %26
18: ; preds = %16
%19 = load i32, i32* %3
%20 = sdiv i32 %19, %10
%21 = sub nsw i32 0, %20
%22 = sitofp i32 %21 to float
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %23)
%25 = call i32 @exit(i32 0)
unreachable
26: ; preds = %16
%27 = mul nsw i32 %10, %10
%28 = mul i32 %9, -4
%29 = load i32, i32* %3
%30 = mul i32 %28, %29
%31 = add i32 %30, %27
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%35 = call i32 @exit(i32 0)
unreachable
36: ; preds = %26
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %31)
%38 = load i32, i32* %2
%39 = call i32 @sqrt(i32 %31)
%40 = sub i32 %39, %38
%41 = sdiv i32 %40, 2
%42 = load i32, i32* %1
%43 = mul nsw i32 %41, %42
%44 = sitofp i32 %43 to float
%45 = load i32, i32* %2
%46 = call i32 @sqrt(i32 %31)
%47 = add i32 %45, %46
%48 = sub i32 0, %47
%49 = sdiv i32 %48, 2
%50 = load i32, i32* %1
%51 = mul nsw i32 %49, %50
%52 = sitofp i32 %51 to float
%53 = fpext float %44 to double
%54 = fpext float %52 to double
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %53, double %54)
ret i32 0
}