#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int sqrt(int);
void main() {
  int a, b, c, d = 0;
  double x1 = 0, x2 = 0;
  printf("Por favor, dame ::a b c:: de ::: ax2 bx c :: \n");
  scanf("%d %d %d", &a, &b, &c);
  d = (b * b) - (4 * a * c);
  if (d >= 0) {
    if (d == 0) {
      x1 = (sqrt(d) - b) / (2 * a);
      printf("La unica raiz posible es :\nX1=%.2lf\n", x1);
    } else {
      x1 = (-b + sqrt(d)) / (2 * a);
      x2 = (-b - sqrt(d)) / (2 * a);
      printf("Las raizes son :\nX1=%.2lf\nX2=%.2lf\n", x1, x2);
    }
  } else {
    x1 = (-b + d) / (2 * a);
    x2 = (-b - d) / (2 * a);
    printf("La ecuacion tiene una solucion compleja. Pruebe con otra\n");
  }
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1243 <main+0x113>
cmpl   $0x0,-0x10(%rbp)
jne    11d4 <main+0xa4>
mov    -0x10(%rbp),%edi
call   1050 <sqrt@plt>
sub    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    123e <main+0x10e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <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    -0x10(%rbp),%edi
call   1050 <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
movsd  -0x20(%rbp),%xmm1
lea    0xe26(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1285 <main+0x155>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
add    -0x10(%rbp),%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
sub    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
mov    0x8(%rsp),%ebp
mov    %ebp,%ebx
imul   %ebp,%ebx
mov    0x4(%rsp),%eax
imul   0xc(%rsp),%eax
shl    $0x2,%eax
sub    %eax,%ebx
js     11d6 <main+0x96>
je     11e4 <main+0xa4>
mov    %ebx,%edi
call   1060 <sqrt@plt>
sub    %ebp,%eax
mov    0x4(%rsp),%ecx
add    %ecx,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x8(%rsp),%ebp
mov    %ebx,%edi
call   1060 <sqrt@plt>
add    %ebp,%eax
neg    %eax
mov    0x4(%rsp),%ecx
add    %ecx,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
lea    0xe67(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
jmp    120a <main+0xca>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
jmp    120a <main+0xca>
xor    %edi,%edi
call   1060 <sqrt@plt>
sub    0x8(%rsp),%eax
mov    0x4(%rsp),%ecx
add    %ecx,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
lea    0xe06(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Por favor, dame ::a b c:: de ::: ax2 bx c :: \0A\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [37 x i8] c"La unica raiz posible es :\0AX1=%.2lf\0A\00"
@.str.3 = [36 x i8] c"Las raizes son :\0AX1=%.2lf\0AX2=%.2lf\0A\00"
@.str.4 = [58 x i8] c"La ecuacion tiene una solucion compleja. Pruebe con otra\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %1
%13 = mul nsw i32 4, %12
%14 = load i32, i32* %3
%15 = mul nsw i32 %13, %14
%16 = sub nsw i32 %11, %15
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %56
19: ; preds = %0
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %4
%24 = call i32 @sqrt(i32 %23)
%25 = load i32, i32* %2
%26 = sub nsw i32 %24, %25
%27 = load i32, i32* %1
%28 = mul nsw i32 2, %27
%29 = sdiv i32 %26, %28
%30 = sitofp i32 %29 to double
store double %30, double* %5
%31 = load double, double* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %31)
br label %55
33: ; preds = %19
%34 = load i32, i32* %2
%35 = sub nsw i32 0, %34
%36 = load i32, i32* %4
%37 = call i32 @sqrt(i32 %36)
%38 = add nsw i32 %35, %37
%39 = load i32, i32* %1
%40 = mul nsw i32 2, %39
%41 = sdiv i32 %38, %40
%42 = sitofp i32 %41 to double
store double %42, double* %5
%43 = load i32, i32* %2
%44 = sub nsw i32 0, %43
%45 = load i32, i32* %4
%46 = call i32 @sqrt(i32 %45)
%47 = sub nsw i32 %44, %46
%48 = load i32, i32* %1
%49 = mul nsw i32 2, %48
%50 = sdiv i32 %47, %49
%51 = sitofp i32 %50 to double
store double %51, double* %6
%52 = load double, double* %5
%53 = load double, double* %6
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %52, double %53)
br label %55
55: ; preds = %33, %22
br label %74
56: ; preds = %0
%57 = load i32, i32* %2
%58 = sub nsw i32 0, %57
%59 = load i32, i32* %4
%60 = add nsw i32 %58, %59
%61 = load i32, i32* %1
%62 = mul nsw i32 2, %61
%63 = sdiv i32 %60, %62
%64 = sitofp i32 %63 to double
store double %64, double* %5
%65 = load i32, i32* %2
%66 = sub nsw i32 0, %65
%67 = load i32, i32* %4
%68 = sub nsw i32 %66, %67
%69 = load i32, i32* %1
%70 = mul nsw i32 2, %69
%71 = sdiv i32 %68, %70
%72 = sitofp i32 %71 to double
store double %72, double* %6
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %74
74: ; preds = %56, %55
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [37 x i8] c"La unica raiz posible es :\0AX1=%.2lf\0A\00"
@.str.3 = [36 x i8] c"Las raizes son :\0AX1=%.2lf\0AX2=%.2lf\0A\00"
@str = [46 x i8] c"Por favor, dame ::a b c:: de ::: ax2 bx c :: \00"
@str.5 = [57 x i8] c"La ecuacion tiene una solucion compleja. Pruebe con otra\00"
define void @main() {
%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 ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = mul nsw i32 %9, %9
%11 = load i32, i32* %1
%12 = mul i32 %11, -4
%13 = load i32, i32* %3
%14 = mul i32 %12, %13
%15 = add i32 %14, %10
%16 = icmp sgt i32 %15, -1
br i1 %16, label %17, label %44
17: ; preds = %0
%18 = icmp eq i32 %15, 0
br i1 %18, label %19, label %28
19: ; preds = %17
%20 = call i32 @sqrt(i32 0)
%21 = load i32, i32* %2
%22 = sub nsw i32 %20, %21
%23 = load i32, i32* %1
%24 = shl nsw i32 %23, 1
%25 = sdiv i32 %22, %24
%26 = sitofp i32 %25 to double
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), double %26)
br label %46
28: ; preds = %17
%29 = call i32 @sqrt(i32 %15)
%30 = sub i32 %29, %9
%31 = load i32, i32* %1
%32 = shl nsw i32 %31, 1
%33 = sdiv i32 %30, %32
%34 = sitofp i32 %33 to double
%35 = load i32, i32* %2
%36 = call i32 @sqrt(i32 %15)
%37 = add i32 %35, %36
%38 = sub i32 0, %37
%39 = load i32, i32* %1
%40 = shl nsw i32 %39, 1
%41 = sdiv i32 %38, %40
%42 = sitofp i32 %41 to double
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), double %34, double %42)
br label %46
44: ; preds = %0
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.5, i64 0, i64 0))
br label %46
46: ; preds = %19, %28, %44
ret void
}