#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, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void GetCoefficients(void) {
  int a, b, c;
  double r1, r2;
  printf("Enter coefficients for the quadratic equation: \n");
  printf("a: ");
  scanf("%d", &a);
  printf("b: ");
  scanf("%d", &b);
  printf("c: ");
  scanf("%d", &c);
  r1 = (-b + pow(b * b - 4 * a * c, 0.5)) / (2.0 * a);
  r2 = (-b - pow(b * b - 4 * a * c, 0.5)) / (2.0 * a);
  printf("The first solution is %g\n", r1);
  printf("The second solution is %g\n", r2);
}


x86 assembly (clang, -O0):
<GetCoefficients>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
sub    %eax,%edi
movsd  0xe45(%rip),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe20(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edi
imul   -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
imul   -0xc(%rbp),%eax
sub    %eax,%edi
movsd  0xdf8(%rip),%xmm0
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xdd3(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe0a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe11(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetCoefficients>:
push   %rbx
sub    $0x20,%rsp
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
imul   %ebx,%edi
mov    0x4(%rsp),%eax
imul   0x8(%rsp),%eax
shl    $0x2,%eax
sub    %eax,%edi
movsd  0xe38(%rip),%xmm0
call   1060 <pow@plt>
sub    %ebx,%eax
cvtsi2sd %eax,%xmm1
mov    0x4(%rsp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
imul   %ebx,%edi
imul   0x8(%rsp),%eax
shl    $0x2,%eax
sub    %eax,%edi
movsd  0xdf9(%rip),%xmm0
call   1060 <pow@plt>
add    %ebx,%eax
neg    %eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xde2(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xde8(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Enter coefficients for the quadratic equation: \0A\00"
@.str.1 = [4 x i8] c"a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"b: \00"
@.str.4 = [4 x i8] c"c: \00"
@.str.5 = [26 x i8] c"The first solution is %g\0A\00"
@.str.6 = [27 x i8] c"The second solution is %g\0A\00"
define void @GetCoefficients() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 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 ([4 x i8], [4 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 ([4 x i8], [4 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 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %1
%19 = mul nsw i32 4, %18
%20 = load i32, i32* %3
%21 = mul nsw i32 %19, %20
%22 = sub nsw i32 %17, %21
%23 = call i32 @pow(i32 %22, double 5.000000e-01)
%24 = add nsw i32 %14, %23
%25 = sitofp i32 %24 to double
%26 = load i32, i32* %1
%27 = sitofp i32 %26 to double
%28 = fmul double 2.000000e+00, %27
%29 = fdiv double %25, %28
store double %29, double* %4
%30 = load i32, i32* %2
%31 = sub nsw i32 0, %30
%32 = load i32, i32* %2
%33 = load i32, i32* %2
%34 = mul nsw i32 %32, %33
%35 = load i32, i32* %1
%36 = mul nsw i32 4, %35
%37 = load i32, i32* %3
%38 = mul nsw i32 %36, %37
%39 = sub nsw i32 %34, %38
%40 = call i32 @pow(i32 %39, double 5.000000e-01)
%41 = sub nsw i32 %31, %40
%42 = sitofp i32 %41 to double
%43 = load i32, i32* %1
%44 = sitofp i32 %43 to double
%45 = fmul double 2.000000e+00, %44
%46 = fdiv double %42, %45
store double %46, double* %5
%47 = load double, double* %4
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %47)
%49 = load double, double* %5
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %49)
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"b: \00"
@.str.4 = [4 x i8] c"c: \00"
@.str.5 = [26 x i8] c"The first solution is %g\0A\00"
@.str.6 = [27 x i8] c"The second solution is %g\0A\00"
@str = [48 x i8] c"Enter coefficients for the quadratic equation: \00"
define void @GetCoefficients() {
%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 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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 ([4 x i8], [4 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 ([4 x i8], [4 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 = mul nsw i32 %14, %14
%16 = load i32, i32* %1
%17 = mul i32 %16, -4
%18 = load i32, i32* %3
%19 = mul i32 %17, %18
%20 = add i32 %19, %15
%21 = call i32 @pow(i32 %20, double 5.000000e-01)
%22 = sub i32 %21, %14
%23 = sitofp i32 %22 to double
%24 = load i32, i32* %1
%25 = sitofp i32 %24 to double
%26 = fmul double %25, 2.000000e+00
%27 = fdiv double %23, %26
%28 = load i32, i32* %2
%29 = mul nsw i32 %28, %28
%30 = mul i32 %24, -4
%31 = load i32, i32* %3
%32 = mul i32 %30, %31
%33 = add i32 %32, %29
%34 = call i32 @pow(i32 %33, double 5.000000e-01)
%35 = add i32 %28, %34
%36 = sub i32 0, %35
%37 = sitofp i32 %36 to double
%38 = load i32, i32* %1
%39 = sitofp i32 %38 to double
%40 = fmul double %39, 2.000000e+00
%41 = fdiv double %37, %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), double %27)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %41)
ret void
}