#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*/ printf(char *);
float sqrt(int);
int equation(float a, float b, float c, int *n, int *x1, int *x2) {
  int delta = 0;
  delta = b * b - 4 * a * c;
  printf("\n");
  if (delta > 0) {
    *n = 2;
    *x1 = (-b + sqrt(delta)) / 2 * a;
    *x2 = (-b - sqrt(delta)) / 2 * a;
  } else if (delta == 0) {
    *n = 1;
    *x1 = -b / 2 * a;
    *x2 = *x1;
  } else {
    *n = 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<equation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xea4(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1233 <equation+0x113>
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x2c(%rbp),%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x34(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xe2f(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x2c(%rbp),%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xde9(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    1294 <equation+0x174>
cmpl   $0x0,-0x2c(%rbp)
jne    1285 <equation+0x165>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xda3(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    128f <equation+0x16f>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    1294 <equation+0x174>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equation>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  0xec5(%rip),%xmm3
movss  %xmm0,0xc(%rsp)
mulss  %xmm0,%xmm3
mulss  %xmm2,%xmm3
movaps %xmm1,0x10(%rsp)
mulss  %xmm1,%xmm1
addss  %xmm3,%xmm1
cvttss2si %xmm1,%ebp
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %ebp,%ebp
jle    11c8 <equation+0xa8>
movl   $0x2,(%rbx)
movaps 0xe9b(%rip),%xmm0
xorps  0x10(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %ebp,%edi
call   1040 <sqrt@plt>
subss  0x10(%rsp),%xmm0
mulss  0xe74(%rip),%xmm0
mulss  0xc(%rsp),%xmm0
cvttss2si %xmm0,%eax
mov    %eax,(%r15)
mov    %ebp,%edi
call   1040 <sqrt@plt>
movaps 0x20(%rsp),%xmm1
subss  %xmm0,%xmm1
mulss  0xe4f(%rip),%xmm1
mulss  0xc(%rsp),%xmm1
cvttss2si %xmm1,%eax
mov    %eax,(%r14)
jmp    11db <equation+0xbb>
movaps 0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm0
je     11eb <equation+0xcb>
movl   $0x0,(%rbx)
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x1,(%rbx)
mulss  0xe0b(%rip),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%eax
mov    %eax,(%r15)
jmp    11c3 <equation+0xa3>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @equation(float %0, float %1, float %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
store i32 0, i32* %13
%14 = load float, float* %8
%15 = load float, float* %8
%16 = load float, float* %7
%17 = fmul float 4.000000e+00, %16
%18 = load float, float* %9
%19 = fmul float %17, %18
%20 = fneg float %19
%21 = call float @llvm.fmuladd.f32(float %14, float %15, float %20)
%22 = fptosi float %21 to i32
store i32 %22, i32* %13
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* %13
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %48
26: ; preds = %6
%27 = load i32*, i32** %10
store i32 2, i32* %27
%28 = load float, float* %8
%29 = fneg float %28
%30 = load i32, i32* %13
%31 = call float @sqrt(i32 %30)
%32 = fadd float %29, %31
%33 = fdiv float %32, 2.000000e+00
%34 = load float, float* %7
%35 = fmul float %33, %34
%36 = fptosi float %35 to i32
%37 = load i32*, i32** %11
store i32 %36, i32* %37
%38 = load float, float* %8
%39 = fneg float %38
%40 = load i32, i32* %13
%41 = call float @sqrt(i32 %40)
%42 = fsub float %39, %41
%43 = fdiv float %42, 2.000000e+00
%44 = load float, float* %7
%45 = fmul float %43, %44
%46 = fptosi float %45 to i32
%47 = load i32*, i32** %12
store i32 %46, i32* %47
br label %66
48: ; preds = %6
%49 = load i32, i32* %13
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %63
51: ; preds = %48
%52 = load i32*, i32** %10
store i32 1, i32* %52
%53 = load float, float* %8
%54 = fneg float %53
%55 = fdiv float %54, 2.000000e+00
%56 = load float, float* %7
%57 = fmul float %55, %56
%58 = fptosi float %57 to i32
%59 = load i32*, i32** %11
store i32 %58, i32* %59
%60 = load i32*, i32** %11
%61 = load i32, i32* %60
%62 = load i32*, i32** %12
store i32 %61, i32* %62
br label %65
63: ; preds = %48
%64 = load i32*, i32** %10
store i32 0, i32* %64
br label %65
65: ; preds = %63, %51
br label %66
66: ; preds = %65, %26
ret i32 1
}

LLVM IR (-O2):
define i32 @equation(float %0, float %1, float %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5) {
%7 = fmul float %0, -4.000000e+00
%8 = fmul float %7, %2
%9 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %8)
%10 = fptosi float %9 to i32
%11 = tail call i32 @putchar(i32 10)
%12 = icmp sgt i32 %10, 0
br i1 %12, label %13, label %25
13: ; preds = %6
store i32 2, i32* %3
%14 = fneg float %1
%15 = tail call float @sqrt(i32 %10)
%16 = fsub float %15, %1
%17 = fmul float %16, 5.000000e-01
%18 = fmul float %17, %0
%19 = fptosi float %18 to i32
store i32 %19, i32* %4
%20 = tail call float @sqrt(i32 %10)
%21 = fsub float %14, %20
%22 = fmul float %21, 5.000000e-01
%23 = fmul float %22, %0
%24 = fptosi float %23 to i32
store i32 %24, i32* %5
br label %32
25: ; preds = %6
%26 = icmp eq i32 %10, 0
br i1 %26, label %27, label %31
27: ; preds = %25
store i32 1, i32* %3
%28 = fmul float %1, -5.000000e-01
%29 = fmul float %28, %0
%30 = fptosi float %29 to i32
store i32 %30, i32* %4
store i32 %30, i32* %5
br label %32
31: ; preds = %25
store i32 0, i32* %3
br label %32
32: ; preds = %27, %31, %13
ret i32 1
}