#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 *, float *);
float sqrt(float);
int main() {
  float a, b, c, x1, x2, delta;
  printf("valor de a: ");
  scanf("%f", &a);
  printf("valor de b: ");
  scanf("%f", &b);
  printf("qual valor de c: ");
  scanf("%f", &c);
  if (a != 0) {
    delta = (b * b) - 4 * a * c;
    if (a > 0) {
      x1 = (-b + sqrt(delta)) / (2 * a);
      printf("x1=%f", x1);
      x2 = (-b - sqrt(delta)) / (2 * a);
      printf("x2=%f", x2);
    } else {
      printf("esse número é imaginário");
    }
    if (delta == 0) {
      x1 = (-b + sqrt(delta)) / (2 * a);
      printf("delta igual a zero, logo, x1=x2");
      printf("x1=%f", x1);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11b5 <main+0x85>
jp     11b5 <main+0x85>
jmp    1347 <main+0x217>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe39(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12b5 <main+0x185>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xdd3(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xd79(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12c3 <main+0x193>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1342 <main+0x212>
jp     1342 <main+0x212>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xcf5(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcf9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1347 <main+0x217>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xee4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf05(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x10(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a1 <main+0x71>
jnp    1300 <main+0x1d0>
movss  0x14(%rsp),%xmm3
ucomiss %xmm1,%xmm0
mulss  0xe4e(%rip),%xmm0
mulss  0x1c(%rsp),%xmm0
movaps %xmm3,%xmm1
mulss  %xmm3,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
jbe    127f <main+0x14f>
xorps  %xmm0,%xmm0
sqrtss %xmm1,%xmm0
xorps  %xmm2,%xmm2
ucomiss %xmm2,%xmm1
movss  %xmm0,0x20(%rsp)
jae    11fb <main+0xcb>
movss  0xc(%rsp),%xmm0
movss  %xmm3,0x18(%rsp)
call   1050 <sqrt@plt>
movss  0x18(%rsp),%xmm3
subss  %xmm3,%xmm0
movss  0x10(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm1
xorps  0xde4(%rip),%xmm1
movss  0xc(%rsp),%xmm0
ucomiss 0xdcb(%rip),%xmm0
movss  0x20(%rsp),%xmm0
jae    1256 <main+0x126>
movss  0xc(%rsp),%xmm0
movaps %xmm1,0x20(%rsp)
call   1050 <sqrt@plt>
movaps 0x20(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xddc(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128d <main+0x15d>
lea    0xdd2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1300 <main+0x1d0>
jp     1300 <main+0x1d0>
movss  0x14(%rsp),%xmm2
ucomiss %xmm1,%xmm0
jb     12ae <main+0x17e>
sqrtss %xmm0,%xmm0
jmp    12bf <main+0x18f>
movss  %xmm2,0xc(%rsp)
call   1050 <sqrt@plt>
movss  0xc(%rsp),%xmm2
subss  %xmm2,%xmm0
movaps %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd53(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"valor de a: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"valor de b: \00"
@.str.3 = [18 x i8] c"qual valor de c: \00"
@.str.4 = [6 x i8] c"x1=%f\00"
@.str.5 = [6 x i8] c"x2=%f\00"
@.str.6 = [28 x i8] c"esse n\C3\BAmero \C3\A9 imagin\C3\A1rio\00"
@.str.7 = [32 x i8] c"delta igual a zero, logo, x1=x2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%14 = load float, float* %2
%15 = fcmp une float %14, 0.000000e+00
br i1 %15, label %16, label %69
16: ; preds = %0
%17 = load float, float* %3
%18 = load float, float* %3
%19 = load float, float* %2
%20 = fmul float 4.000000e+00, %19
%21 = load float, float* %4
%22 = fmul float %20, %21
%23 = fneg float %22
%24 = call float @llvm.fmuladd.f32(float %17, float %18, float %23)
store float %24, float* %7
%25 = load float, float* %2
%26 = fcmp ogt float %25, 0.000000e+00
br i1 %26, label %27, label %50
27: ; preds = %16
%28 = load float, float* %3
%29 = fneg float %28
%30 = load float, float* %7
%31 = call float @sqrt(float %30)
%32 = fadd float %29, %31
%33 = load float, float* %2
%34 = fmul float 2.000000e+00, %33
%35 = fdiv float %32, %34
store float %35, float* %5
%36 = load float, float* %5
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %37)
%39 = load float, float* %3
%40 = fneg float %39
%41 = load float, float* %7
%42 = call float @sqrt(float %41)
%43 = fsub float %40, %42
%44 = load float, float* %2
%45 = fmul float 2.000000e+00, %44
%46 = fdiv float %43, %45
store float %46, float* %6
%47 = load float, float* %6
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %48)
br label %52
50: ; preds = %16
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %52
52: ; preds = %50, %27
%53 = load float, float* %7
%54 = fcmp oeq float %53, 0.000000e+00
br i1 %54, label %55, label %68
55: ; preds = %52
%56 = load float, float* %3
%57 = fneg float %56
%58 = load float, float* %7
%59 = call float @sqrt(float %58)
%60 = fadd float %57, %59
%61 = load float, float* %2
%62 = fmul float 2.000000e+00, %61
%63 = fdiv float %60, %62
store float %63, float* %5
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%65 = load float, float* %5
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %66)
br label %68
68: ; preds = %55, %52
br label %69
69: ; preds = %68, %0
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str = [13 x i8] c"valor de a: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [13 x i8] c"valor de b: \00"
@.str.3 = [18 x i8] c"qual valor de c: \00"
@.str.4 = [6 x i8] c"x1=%f\00"
@.str.5 = [6 x i8] c"x2=%f\00"
@.str.6 = [28 x i8] c"esse n\C3\BAmero \C3\A9 imagin\C3\A1rio\00"
@.str.7 = [32 x i8] c"delta igual a zero, logo, x1=x2\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %1
%14 = fcmp une float %13, 0.000000e+00
br i1 %14, label %15, label %53
15: ; preds = %0
%16 = load float, float* %2
%17 = load float, float* %3
%18 = fmul float %13, -4.000000e+00
%19 = fmul float %18, %17
%20 = call float @llvm.fmuladd.f32(float %16, float %16, float %19)
%21 = fcmp ogt float %13, 0.000000e+00
br i1 %21, label %22, label %39
22: ; preds = %15
%23 = call float @sqrt(float %20)
%24 = fsub float %23, %16
%25 = load float, float* %1
%26 = fmul float %25, 2.000000e+00
%27 = fdiv float %24, %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %28)
%30 = load float, float* %2
%31 = fneg float %30
%32 = call float @sqrt(float %20)
%33 = fsub float %31, %32
%34 = load float, float* %1
%35 = fmul float %34, 2.000000e+00
%36 = fdiv float %33, %35
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), double %37)
br label %41
39: ; preds = %15
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %41
41: ; preds = %39, %22
%42 = fcmp oeq float %20, 0.000000e+00
br i1 %42, label %43, label %53
43: ; preds = %41
%44 = load float, float* %2
%45 = call float @sqrt(float %20)
%46 = fsub float %45, %44
%47 = load float, float* %1
%48 = fmul float %47, 2.000000e+00
%49 = fdiv float %46, %48
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
%51 = fpext float %49 to double
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %51)
br label %53
53: ; preds = %41, %43, %0
ret i32 0
}