#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *, double *, double *);
double solveDiscriminant(double, double, double);
int /*<<< orphan*/ solveQuadratic(double, double, double, double);
int main(void) {
  double a, b, c, discriminant;
  int halt = 0;
  do {
    printf("Please input coefficients a, b and c in ax^2+bx+c: ");
    scanf(" %lf %lf %lf", &a, &b, &c);
    if (a != 0) {
      discriminant = solveDiscriminant(a, b, c);
      solveQuadratic(a, b, c, discriminant);
    } else {
      halt = 1;
    }
  } while (!halt);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1060 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1197 <main+0x57>
jp     1197 <main+0x57>
jmp    11ce <main+0x8e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
call   1050 <solveDiscriminant@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
call   1030 <solveQuadratic@plt>
jmp    11d5 <main+0x95>
movl   $0x1,-0x2c(%rbp)
jmp    11da <main+0x9a>
cmpl   $0x0,-0x2c(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1156 <main+0x16>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118a <main+0x4a>
jnp    1207 <main+0xc7>
lea    0xe6f(%rip),%r14
lea    0xe9c(%rip),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
lea    0x10(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1050 <solveDiscriminant@plt>
movapd %xmm0,%xmm3
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1030 <solveQuadratic@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1060 <scanf@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jne    11b0 <main+0x70>
jp     11b0 <main+0x70>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Please input coefficients a, b and c in ax^2+bx+c: \00"
@.str.1 = [13 x i8] c" %lf %lf %lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
br label %7
7: ; preds = %24, %0
%8 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%10 = load double, double* %2
%11 = fcmp une double %10, 0.000000e+00
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load double, double* %2
%14 = load double, double* %3
%15 = load double, double* %4
%16 = call double @solveDiscriminant(double %13, double %14, double %15)
store double %16, double* %5
%17 = load double, double* %2
%18 = load double, double* %3
%19 = load double, double* %4
%20 = load double, double* %5
%21 = call i32 @solveQuadratic(double %17, double %18, double %19, double %20)
br label %23
22: ; preds = %7
store i32 1, i32* %6
br label %23
23: ; preds = %22, %12
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
br i1 %27, label %7, label %28
28: ; preds = %24
%29 = load i32, i32* @EXIT_SUCCESS
ret i32 %29
}

LLVM IR (-O2):
@.str = [52 x i8] c"Please input coefficients a, b and c in ax^2+bx+c: \00"
@.str.1 = [13 x i8] c" %lf %lf %lf\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %1 to i8*
%5 = bitcast double* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%9 = load double, double* %1
%10 = fcmp une double %9, 0.000000e+00
br i1 %10, label %11, label %24
11: ; preds = %0, %11
%12 = phi double [ %22, %11 ], [ %9, %0 ]
%13 = load double, double* %2
%14 = load double, double* %3
%15 = call double @solveDiscriminant(double %12, double %13, double %14)
%16 = load double, double* %1
%17 = load double, double* %2
%18 = load double, double* %3
%19 = call i32 @solveQuadratic(double %16, double %17, double %18, double %15)
%20 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%22 = load double, double* %1
%23 = fcmp une double %22, 0.000000e+00
br i1 %23, label %11, label %24
24: ; preds = %11, %0
%25 = load i32, i32* @EXIT_SUCCESS
ret i32 %25
}