#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 sqrt(int);
int main() {
  int a, b, c;
  printf("Ingrese los coeficientes de la cuadratica ax^2+bx+c\n");
  printf("a = ");
  scanf("%d", &a);
  printf("b = ");
  scanf("%d", &b);
  printf("c = ");
  scanf("%d", &c);
  int deter = b * b - 4 * a * c;
  if (deter < 0) {
    printf("sus dos raices son imaginarias!\n");
  } else {
    float r1 = (-b + sqrt(deter)) / 2 * a;
    float r2 = (-b - sqrt(deter)) / 2 * a;
    printf("Raices: x1=%f x2=%f\n", r1, r2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x2,%ecx
imul   -0x10(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11da <main+0xaa>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1252 <main+0x122>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
imul   -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe1d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    %ebp,%ebx
imul   %ebp,%ebx
mov    0x8(%rsp),%eax
imul   0x14(%rsp),%eax
shl    $0x2,%eax
sub    %eax,%ebx
js     1223 <main+0xe3>
mov    %ebx,%edi
call   1060 <sqrt@plt>
sub    %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
imul   0x8(%rsp),%ecx
cvtsi2ss %ecx,%xmm0
movss  %xmm0,0x10(%rsp)
mov    0xc(%rsp),%ebp
mov    %ebx,%edi
call   1060 <sqrt@plt>
add    %ebp,%eax
mov    %eax,%ecx
neg    %ecx
shr    $0x1f,%ecx
sub    %eax,%ecx
sar    %ecx
imul   0x8(%rsp),%ecx
cvtsi2ss %ecx,%xmm1
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xdf8(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    122f <main+0xef>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Ingrese los coeficientes de la cuadratica ax^2+bx+c\0A\00"
@.str.1 = [5 x i8] c"a = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"b = \00"
@.str.4 = [5 x i8] c"c = \00"
@.str.5 = [33 x i8] c"sus dos raices son imaginarias!\0A\00"
@.str.6 = [21 x i8] c"Raices: x1=%f x2=%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %2
%19 = mul nsw i32 4, %18
%20 = load i32, i32* %4
%21 = mul nsw i32 %19, %20
%22 = sub nsw i32 %17, %21
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %51
27: ; preds = %0
%28 = load i32, i32* %3
%29 = sub nsw i32 0, %28
%30 = load i32, i32* %5
%31 = call i32 @sqrt(i32 %30)
%32 = add nsw i32 %29, %31
%33 = sdiv i32 %32, 2
%34 = load i32, i32* %2
%35 = mul nsw i32 %33, %34
%36 = sitofp i32 %35 to float
store float %36, float* %6
%37 = load i32, i32* %3
%38 = sub nsw i32 0, %37
%39 = load i32, i32* %5
%40 = call i32 @sqrt(i32 %39)
%41 = sub nsw i32 %38, %40
%42 = sdiv i32 %41, 2
%43 = load i32, i32* %2
%44 = mul nsw i32 %42, %43
%45 = sitofp i32 %44 to float
store float %45, float* %7
%46 = load float, float* %6
%47 = fpext float %46 to double
%48 = load float, float* %7
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %47, double %49)
br label %51
51: ; preds = %27, %25
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"a = \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [5 x i8] c"b = \00"
@.str.4 = [5 x i8] c"c = \00"
@.str.6 = [21 x i8] c"Raices: x1=%f x2=%f\0A\00"
@str = [52 x i8] c"Ingrese los coeficientes de la cuadratica ax^2+bx+c\00"
@str.7 = [32 x i8] c"sus dos raices son imaginarias!\00"
define i32 @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 ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %14
%16 = load i32, i32* %1
%17 = mul i32 %16, -4
%18 = load i32, i32* %3
%19 = mul i32 %17, %18
%20 = add i32 %19, %15
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
br label %42
24: ; preds = %0
%25 = call i32 @sqrt(i32 %20)
%26 = sub i32 %25, %14
%27 = sdiv i32 %26, 2
%28 = load i32, i32* %1
%29 = mul nsw i32 %27, %28
%30 = sitofp i32 %29 to float
%31 = load i32, i32* %2
%32 = call i32 @sqrt(i32 %20)
%33 = add i32 %31, %32
%34 = sub i32 0, %33
%35 = sdiv i32 %34, 2
%36 = load i32, i32* %1
%37 = mul nsw i32 %35, %36
%38 = sitofp i32 %37 to float
%39 = fpext float %30 to double
%40 = fpext float %38 to double
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), double %39, double %40)
br label %42
42: ; preds = %24, %22
ret i32 0
}