#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 pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float sqrt(float);
int main(int argc, const char *argv[]) {
  float a, b, c, d, del, x1, x2;
  printf("Valor de 'a':\t");
  scanf("%f", &a);
  if (a == 0) {
    printf("A equação não é do segundo grau.\n");
  } else {
    printf("Valor de 'b':\t");
    scanf("%f", &b);
    printf("Valor de 'c':\t");
    scanf("%f", &c);
    d = (pow(b, 2) - 4 * a * c);
    del = sqrt(d);
    if (d < 0) {
      printf("\nA equação não possui raízes.\n");
      return 0;
    }
    if (d == 0) {
      x1 = ((-b + del) / (2 * a));
      printf("\nx = %.1f.\n", x1);
      return 0;
    }
    x1 = ((-b + del) / (2 * a));
    x2 = ((-b - del) / (2 * a));
    printf("\nx' = %.1f \n", x1);
    printf("x'' =  %.1f\n", x2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    119e <main+0x5e>
jp     119e <main+0x5e>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    133e <main+0x1fe>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
cvtsi2ss %eax,%xmm1
movss  0xe0b(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    124f <main+0x10f>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1345 <main+0x205>
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12b6 <main+0x176>
jp     12b6 <main+0x176>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x24(%rbp),%xmm0
movss  0xd7f(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdde(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1345 <main+0x205>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
addss  -0x24(%rbp),%xmm0
movss  0xd2f(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0x24(%rbp),%xmm0
movss  0xd02(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd6d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1195 <main+0x45>
jp     1195 <main+0x45>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
jmp    12c4 <main+0x174>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe85(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x4(%rsp),%xmm2
mulss  0xe09(%rip),%xmm2
mulss  0xc(%rsp),%xmm2
addss  %xmm0,%xmm2
ucomiss 0xdfc(%rip),%xmm2
jb     1213 <main+0xc3>
xorps  %xmm0,%xmm0
sqrtss %xmm2,%xmm0
jmp    1227 <main+0xd7>
movaps %xmm2,%xmm0
movss  %xmm2,0x10(%rsp)
call   1070 <sqrt@plt>
movss  0x10(%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm2,%xmm1
jbe    1240 <main+0xf0>
lea    0xe40(%rip),%rdi
call   1030 <puts@plt>
jmp    12c4 <main+0x174>
ucomiss %xmm1,%xmm2
movss  0x8(%rsp),%xmm2
jne    126c <main+0x11c>
jp     126c <main+0x11c>
subss  %xmm2,%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde6(%rip),%rdi
jmp    12bd <main+0x16d>
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
xorps  0xd96(%rip),%xmm2
movaps %xmm2,%xmm3
movss  0x4(%rsp),%xmm2
addss  %xmm2,%xmm2
divss  %xmm2,%xmm1
subss  %xmm0,%xmm3
divss  %xmm2,%xmm3
movaps %xmm3,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xdb6(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movaps 0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdac(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Valor de 'a':\09\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [38 x i8] c"A equa\C3\A7\C3\A3o n\C3\A3o \C3\A9 do segundo grau.\0A\00"
@.str.3 = [15 x i8] c"Valor de 'b':\09\00"
@.str.4 = [15 x i8] c"Valor de 'c':\09\00"
@.str.5 = [35 x i8] c"\0AA equa\C3\A7\C3\A3o n\C3\A3o possui ra\C3\ADzes.\0A\00"
@.str.6 = [12 x i8] c"\0Ax = %.1f.\0A\00"
@.str.7 = [13 x i8] c"\0Ax' = %.1f \0A\00"
@.str.8 = [13 x i8] c"x'' = %.1f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%15 = load float, float* %6
%16 = fcmp oeq float %15, 0.000000e+00
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
br label %73
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %7)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%24 = load float, float* %7
%25 = call i32 @pow(float %24, i32 2)
%26 = sitofp i32 %25 to float
%27 = load float, float* %6
%28 = fmul float 4.000000e+00, %27
%29 = load float, float* %8
%30 = fneg float %28
%31 = call float @llvm.fmuladd.f32(float %30, float %29, float %26)
store float %31, float* %9
%32 = load float, float* %9
%33 = call float @sqrt(float %32)
store float %33, float* %10
%34 = load float, float* %9
%35 = fcmp olt float %34, 0.000000e+00
br i1 %35, label %36, label %38
36: ; preds = %19
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %74
38: ; preds = %19
%39 = load float, float* %9
%40 = fcmp oeq float %39, 0.000000e+00
br i1 %40, label %41, label %52
41: ; preds = %38
%42 = load float, float* %7
%43 = fneg float %42
%44 = load float, float* %10
%45 = fadd float %43, %44
%46 = load float, float* %6
%47 = fmul float 2.000000e+00, %46
%48 = fdiv float %45, %47
store float %48, float* %11
%49 = load float, float* %11
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double %50)
store i32 0, i32* %3
br label %74
52: ; preds = %38
%53 = load float, float* %7
%54 = fneg float %53
%55 = load float, float* %10
%56 = fadd float %54, %55
%57 = load float, float* %6
%58 = fmul float 2.000000e+00, %57
%59 = fdiv float %56, %58
store float %59, float* %11
%60 = load float, float* %7
%61 = fneg float %60
%62 = load float, float* %10
%63 = fsub float %61, %62
%64 = load float, float* %6
%65 = fmul float 2.000000e+00, %64
%66 = fdiv float %63, %65
store float %66, float* %12
%67 = load float, float* %11
%68 = fpext float %67 to double
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %68)
%70 = load float, float* %12
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %71)
br label %73
73: ; preds = %52, %17
store i32 0, i32* %3
br label %74
74: ; preds = %73, %41, %36
%75 = load i32, i32* %3
ret i32 %75
}

LLVM IR (-O2):
@.str = [15 x i8] c"Valor de 'a':\09\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [15 x i8] c"Valor de 'b':\09\00"
@.str.4 = [15 x i8] c"Valor de 'c':\09\00"
@.str.6 = [12 x i8] c"\0Ax = %.1f.\0A\00"
@.str.7 = [13 x i8] c"\0Ax' = %.1f \0A\00"
@.str.8 = [13 x i8] c"x'' = %.1f\0A\00"
@str = [34 x i8] c"\0AA equa\C3\A7\C3\A3o n\C3\A3o possui ra\C3\ADzes.\00"
@str.9 = [37 x i8] c"A equa\C3\A7\C3\A3o n\C3\A3o \C3\A9 do segundo grau.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = bitcast float* %5 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%11 = load float, float* %3
%12 = fcmp oeq float %11, 0.000000e+00
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.9, i64 0, i64 0))
br label %53
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%20 = load float, float* %4
%21 = call i32 @pow(float %20, i32 2)
%22 = sitofp i32 %21 to float
%23 = load float, float* %3
%24 = load float, float* %5
%25 = fmul float %23, -4.000000e+00
%26 = call float @llvm.fmuladd.f32(float %25, float %24, float %22)
%27 = call float @sqrt(float %26)
%28 = fcmp olt float %26, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %15
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %53
31: ; preds = %15
%32 = fcmp oeq float %26, 0.000000e+00
%33 = load float, float* %4
br i1 %32, label %34, label %41
34: ; preds = %31
%35 = fsub float %27, %33
%36 = load float, float* %3
%37 = fmul float %36, 2.000000e+00
%38 = fdiv float %35, %37
%39 = fpext float %38 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), double %39)
br label %53
41: ; preds = %31
%42 = fneg float %33
%43 = fsub float %27, %33
%44 = load float, float* %3
%45 = fmul float %44, 2.000000e+00
%46 = fdiv float %43, %45
%47 = fsub float %42, %27
%48 = fdiv float %47, %45
%49 = fpext float %46 to double
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), double %49)
%51 = fpext float %48 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), double %51)
br label %53
53: ; preds = %13, %41, %34, %29
ret i32 0
}