#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 */
double sqrt(double);
double calculateFirstRoot(double a, double b, double disc) {
  return disc == 0 ? (-b / (2 * a)) : (-b + sqrt(disc)) / (2 * a);
}


x86 assembly (clang, -O0):
<calculateFirstRoot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1176 <calculateFirstRoot+0x66>
jp     1176 <calculateFirstRoot+0x66>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe9d(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11c3 <calculateFirstRoot+0xb3>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xe4b(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateFirstRoot>:
sub    $0x28,%rsp
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1132 <calculateFirstRoot+0x22>
jp     1132 <calculateFirstRoot+0x22>
xorpd  0xed4(%rip),%xmm1
movapd %xmm1,%xmm0
jmp    1161 <calculateFirstRoot+0x51>
jb     113d <calculateFirstRoot+0x2d>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    115d <calculateFirstRoot+0x4d>
movapd %xmm2,%xmm0
movsd  %xmm3,0x8(%rsp)
movaps %xmm1,0x10(%rsp)
call   1030 <sqrt@plt>
movapd 0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm3
subsd  %xmm1,%xmm0
addsd  %xmm3,%xmm3
divsd  %xmm3,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @calculateFirstRoot(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load double, double* %5
%11 = fneg double %10
%12 = load double, double* %4
%13 = fmul double 2.000000e+00, %12
%14 = fdiv double %11, %13
br label %24
15: ; preds = %3
%16 = load double, double* %5
%17 = fneg double %16
%18 = load double, double* %6
%19 = call double @sqrt(double %18)
%20 = fadd double %17, %19
%21 = load double, double* %4
%22 = fmul double 2.000000e+00, %21
%23 = fdiv double %20, %22
br label %24
24: ; preds = %15, %9
%25 = phi double [ %14, %9 ], [ %23, %15 ]
ret double %25
}

LLVM IR (-O2):
define double @calculateFirstRoot(double %0, double %1, double %2) {
%4 = fcmp oeq double %2, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = fneg double %1
br label %10
7: ; preds = %3
%8 = tail call double @sqrt(double %2)
%9 = fsub double %8, %1
br label %10
10: ; preds = %7, %5
%11 = phi double [ %9, %7 ], [ %6, %5 ]
%12 = fmul double %0, 2.000000e+00
%13 = fdiv double %11, %12
ret double %13
}