#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(float);
main() {
  int a, b, c;
  float x, x1, delta;
  printf("Digite valor de A \n");
  scanf("%d\n", &a);
  printf("Digite valor de B \n");
  scanf("%d\n", &b);
  printf("Digite valor de C \n");
  scanf("%d\n", &c);
  delta = b * b - 4 * a * c;
  if (delta < 0) {
    printf("NAO EXISTE RAIZ \n");
  }
  if (delta >= 0) {
    x = (-b + sqrt(delta)) - (4 * a * c) / (2 * a);
    x1 = (-b - sqrt(delta)) - (4 * a * c) / (2 * a);
    printf("Valor de x  %7.2f\n ", x, x1);
  } else {
    printf("A EQUAÇÃO NAO E DO SEGUNDO GRAU: \n");
  }
  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    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe84(%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
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    11d0 <main+0xa0>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1284 <main+0x154>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdda(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1292 <main+0x162>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x14(%rsp),%ebx
mov    %ebx,%eax
imul   %ebx,%eax
mov    0x10(%rsp),%ecx
imul   0xc(%rsp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
js     1235 <main+0xf5>
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x18(%rsp)
call   1060 <sqrt@plt>
mov    %eax,%ecx
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%eax
imul   %esi,%eax
shl    $0x2,%eax
add    %esi,%esi
cltd
idiv   %esi
add    %eax,%ebx
sub    %ebx,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  %xmm0,0x1c(%rsp)
mov    0x14(%rsp),%ebx
movss  0x18(%rsp),%xmm0
call   1060 <sqrt@plt>
mov    %eax,%ecx
add    %ebx,%ecx
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%eax
imul   %esi,%eax
shl    $0x2,%eax
add    %esi,%esi
cltd
idiv   %esi
add    %ecx,%eax
neg    %eax
cvtsi2ss %eax,%xmm1
movss  0x1c(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xdd8(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    124d <main+0x10d>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
lea    0xe09(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Digite valor de A \0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [20 x i8] c"Digite valor de B \0A\00"
@.str.3 = [20 x i8] c"Digite valor de C \0A\00"
@.str.4 = [18 x i8] c"NAO EXISTE RAIZ \0A\00"
@.str.5 = [20 x i8] c"Valor de x %7.2f\0A \00"
@.str.6 = [37 x i8] c"A EQUA\C3\87\C3\83O NAO E DO SEGUNDO GRAU: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %3
%15 = load i32, i32* %3
%16 = mul nsw i32 %14, %15
%17 = load i32, i32* %2
%18 = mul nsw i32 4, %17
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = sub nsw i32 %16, %20
%22 = sitofp i32 %21 to float
store float %22, float* %7
%23 = load float, float* %7
%24 = fcmp olt float %23, 0.000000e+00
br i1 %24, label %25, label %27
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %25, %0
%28 = load float, float* %7
%29 = fcmp oge float %28, 0.000000e+00
br i1 %29, label %30, label %64
30: ; preds = %27
%31 = load i32, i32* %3
%32 = sub nsw i32 0, %31
%33 = load float, float* %7
%34 = call i32 @sqrt(float %33)
%35 = add nsw i32 %32, %34
%36 = load i32, i32* %2
%37 = mul nsw i32 4, %36
%38 = load i32, i32* %4
%39 = mul nsw i32 %37, %38
%40 = load i32, i32* %2
%41 = mul nsw i32 2, %40
%42 = sdiv i32 %39, %41
%43 = sub nsw i32 %35, %42
%44 = sitofp i32 %43 to float
store float %44, float* %5
%45 = load i32, i32* %3
%46 = sub nsw i32 0, %45
%47 = load float, float* %7
%48 = call i32 @sqrt(float %47)
%49 = sub nsw i32 %46, %48
%50 = load i32, i32* %2
%51 = mul nsw i32 4, %50
%52 = load i32, i32* %4
%53 = mul nsw i32 %51, %52
%54 = load i32, i32* %2
%55 = mul nsw i32 2, %54
%56 = sdiv i32 %53, %55
%57 = sub nsw i32 %49, %56
%58 = sitofp i32 %57 to float
store float %58, float* %6
%59 = load float, float* %5
%60 = fpext float %59 to double
%61 = load float, float* %6
%62 = fpext float %61 to double
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %60, double %62)
br label %66
64: ; preds = %27
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
br label %66
66: ; preds = %64, %30
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.5 = [20 x i8] c"Valor de x %7.2f\0A \00"
@str = [19 x i8] c"Digite valor de A \00"
@str.7 = [19 x i8] c"Digite valor de B \00"
@str.8 = [19 x i8] c"Digite valor de C \00"
@str.9 = [36 x i8] c"A EQUA\C3\87\C3\83O NAO E DO SEGUNDO GRAU: \00"
@str.10 = [17 x i8] c"NAO EXISTE RAIZ \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 ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.8, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, %13
%15 = load i32, i32* %1
%16 = mul i32 %15, -4
%17 = load i32, i32* %3
%18 = mul i32 %16, %17
%19 = add i32 %18, %14
%20 = sitofp i32 %19 to float
%21 = icmp slt i32 %19, 0
br i1 %21, label %48, label %22
22: ; preds = %0
%23 = call i32 @sqrt(float %20)
%24 = load i32, i32* %1
%25 = shl nsw i32 %24, 2
%26 = load i32, i32* %3
%27 = mul nsw i32 %25, %26
%28 = shl nsw i32 %24, 1
%29 = sdiv i32 %27, %28
%30 = add i32 %13, %29
%31 = sub i32 %23, %30
%32 = sitofp i32 %31 to float
%33 = load i32, i32* %2
%34 = call i32 @sqrt(float %20)
%35 = add i32 %33, %34
%36 = load i32, i32* %1
%37 = shl nsw i32 %36, 2
%38 = load i32, i32* %3
%39 = mul nsw i32 %37, %38
%40 = shl nsw i32 %36, 1
%41 = sdiv i32 %39, %40
%42 = add i32 %35, %41
%43 = sub i32 0, %42
%44 = sitofp i32 %43 to float
%45 = fpext float %32 to double
%46 = fpext float %44 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), double %45, double %46)
br label %51
48: ; preds = %0
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.10, i64 0, i64 0))
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.9, i64 0, i64 0))
br label %51
51: ; preds = %48, %22
ret i32 0
}