#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*/ calc_discrim(int, int, int);
int calc_sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double);
void calc_roots(int a, int b, int c) {
  double root1, root2;
  root1 = (-b + calc_sqrt(calc_discrim(a, b, c))) / (2 * a);
  root2 = (-b - calc_sqrt(calc_discrim(a, b, c))) / (2 * a);
  printf("First root: %f\n", root1);
  printf("Second root: %f\n", root2);
}


x86 assembly (clang, -O0):
<calc_roots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <calc_discrim@plt>
mov    %eax,%edi
call   1030 <calc_sqrt@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <calc_discrim@plt>
mov    %eax,%edi
call   1030 <calc_sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_roots>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
call   1050 <calc_discrim@plt>
mov    %eax,%edi
call   1030 <calc_sqrt@plt>
sub    %ebx,%eax
lea    0x0(%rbp,%rbp,1),%r15d
cltd
idiv   %r15d
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14d,%edx
call   1050 <calc_discrim@plt>
mov    %eax,%edi
call   1030 <calc_sqrt@plt>
add    %ebx,%eax
neg    %eax
cltd
idiv   %r15d
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe6f(%rip),%rdi
movsd  0x10(%rsp),%xmm0
call   1040 <printf@plt>
lea    0xe6d(%rip),%rdi
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"First root: %f\0A\00"
@.str.1 = [17 x i8] c"Second root: %f\0A\00"
define void @calc_roots(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = sub nsw i32 0, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @calc_discrim(i32 %11, i32 %12, i32 %13)
%15 = call i32 @calc_sqrt(i32 %14)
%16 = add nsw i32 %10, %15
%17 = load i32, i32* %4
%18 = mul nsw i32 2, %17
%19 = sdiv i32 %16, %18
%20 = sitofp i32 %19 to double
store double %20, double* %7
%21 = load i32, i32* %5
%22 = sub nsw i32 0, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = call i32 @calc_discrim(i32 %23, i32 %24, i32 %25)
%27 = call i32 @calc_sqrt(i32 %26)
%28 = sub nsw i32 %22, %27
%29 = load i32, i32* %4
%30 = mul nsw i32 2, %29
%31 = sdiv i32 %28, %30
%32 = sitofp i32 %31 to double
store double %32, double* %8
%33 = load double, double* %7
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %33)
%35 = load double, double* %8
%36 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %35)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"First root: %f\0A\00"
@.str.1 = [17 x i8] c"Second root: %f\0A\00"
define void @calc_roots(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @calc_discrim(i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @calc_sqrt(i32 %4)
%6 = sub i32 %5, %1
%7 = shl nsw i32 %0, 1
%8 = sdiv i32 %6, %7
%9 = sitofp i32 %8 to double
%10 = tail call i32 @calc_discrim(i32 %0, i32 %1, i32 %2)
%11 = tail call i32 @calc_sqrt(i32 %10)
%12 = add i32 %11, %1
%13 = sub i32 0, %12
%14 = sdiv i32 %13, %7
%15 = sitofp i32 %14 to double
%16 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %9)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %15)
ret void
}