#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 *, ...);
float sqrt(float);
void cal_raizes(float x, float y, float z) {
  float r1, r2, delta;
  float deli, rdel;
  if (x != 0) {
    delta = ((y * y) - (4 * x * z));
    if (delta >= 0) {
      r1 = (-y + (sqrt(delta))) / 2 * x;
      r2 = (-y - (sqrt(delta))) / 2 * x;
      printf("as raízes são reais: %0.2f,%0.2f \n", r1, r2);
    } else {
      if (delta < 0) {
        deli = -delta;
        rdel = sqrt(deli);
        printf("as raízes são complexas do tipo x+iy \n");
        printf("a raiz 1: %0.2f + i.%0.2f \n", ((-y) / 2 * x),
               ((rdel) / 2 * x));
        printf("a raiz 2: %0.2f - i.%0.2f \n", ((-y) / 2 * x),
               ((rdel) / 2 * x));
      }
    }
  }
}


x86 assembly (clang, -O0):
<cal_raizes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1153 <cal_raizes+0x33>
jp     1153 <cal_raizes+0x33>
jmp    132e <cal_raizes+0x20e>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xe9b(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1245 <cal_raizes+0x125>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xe35(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xdf2(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdcf(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1329 <cal_raizes+0x209>
xorps  %xmm0,%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1324 <cal_raizes+0x204>
movss  -0x18(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x20(%rbp)
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd64(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
movss  0xd4a(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd88(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd15(%rip),%xmm1
divss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
movss  0xcfb(%rip),%xmm2
divss  %xmm2,%xmm1
mulss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd55(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1329 <cal_raizes+0x209>
jmp    132e <cal_raizes+0x20e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_raizes>:
sub    $0x58,%rsp
movaps %xmm0,%xmm3
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm3
jne    1141 <cal_raizes+0x11>
jnp    1198 <cal_raizes+0x68>
movss  0xeb7(%rip),%xmm4
mulss  %xmm3,%xmm4
mulss  %xmm2,%xmm4
movaps %xmm1,%xmm2
mulss  %xmm1,%xmm2
addss  %xmm4,%xmm2
ucomiss %xmm0,%xmm2
jae    119d <cal_raizes+0x6d>
xorps  %xmm0,%xmm0
ucomiss %xmm2,%xmm0
jbe    1198 <cal_raizes+0x68>
movaps %xmm1,0x10(%rsp)
movss  %xmm3,0x8(%rsp)
movaps 0xe95(%rip),%xmm0
xorps  %xmm2,%xmm0
movss  0xe82(%rip),%xmm1
ucomiss %xmm2,%xmm1
jb     1252 <cal_raizes+0x122>
sqrtss %xmm0,%xmm0
jmp    1257 <cal_raizes+0x127>
add    $0x58,%rsp
ret
movaps 0xe6c(%rip),%xmm4
xorps  %xmm1,%xmm4
sqrtss %xmm2,%xmm5
xorps  %xmm6,%xmm6
ucomiss %xmm6,%xmm2
movaps %xmm5,%xmm0
movss  %xmm3,0x8(%rsp)
movaps %xmm4,0x30(%rsp)
jae    11f7 <cal_raizes+0xc7>
movaps %xmm2,%xmm0
movaps %xmm1,0x10(%rsp)
movaps %xmm2,0x40(%rsp)
movss  %xmm5,0x2c(%rsp)
call   1050 <sqrt@plt>
xorps  %xmm6,%xmm6
movss  0x2c(%rsp),%xmm5
movaps 0x30(%rsp),%xmm4
movaps 0x40(%rsp),%xmm2
movaps 0x10(%rsp),%xmm1
movss  0x8(%rsp),%xmm3
subss  %xmm1,%xmm0
mulss  0xe01(%rip),%xmm0
mulss  %xmm3,%xmm0
ucomiss %xmm6,%xmm2
jae    122e <cal_raizes+0xfe>
movss  %xmm0,0x10(%rsp)
movaps %xmm2,%xmm0
call   1050 <sqrt@plt>
movaps 0x30(%rsp),%xmm4
movss  0x8(%rsp),%xmm3
movaps %xmm0,%xmm5
movss  0x10(%rsp),%xmm0
subss  %xmm5,%xmm4
mulss  0xdca(%rip),%xmm4
mulss  %xmm3,%xmm4
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
lea    0xdd0(%rip),%rdi
jmp    12ca <cal_raizes+0x19a>
call   1050 <sqrt@plt>
movss  %xmm0,0x30(%rsp)
lea    0xe19(%rip),%rdi
call   1030 <puts@plt>
movaps 0x10(%rsp),%xmm1
mulss  0xd96(%rip),%xmm1
movss  0x8(%rsp),%xmm2
mulss  %xmm2,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x30(%rsp),%xmm1
mulss  0xd69(%rip),%xmm1
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xd95(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xda3(%rip),%rdi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    $0x2,%al
add    $0x58,%rsp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"as ra\C3\ADzes s\C3\A3o reais: %0.2f,%0.2f \0A\00"
@.str.1 = [41 x i8] c"as ra\C3\ADzes s\C3\A3o complexas do tipo x+iy \0A\00"
@.str.2 = [28 x i8] c"a raiz 1: %0.2f + i.%0.2f \0A\00"
@.str.3 = [28 x i8] c"a raiz 2: %0.2f - i.%0.2f \0A\00"
define void @cal_raizes(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%12 = load float, float* %4
%13 = fcmp une float %12, 0.000000e+00
br i1 %13, label %14, label %82
14: ; preds = %3
%15 = load float, float* %5
%16 = load float, float* %5
%17 = load float, float* %4
%18 = fmul float 4.000000e+00, %17
%19 = load float, float* %6
%20 = fmul float %18, %19
%21 = fneg float %20
%22 = call float @llvm.fmuladd.f32(float %15, float %16, float %21)
store float %22, float* %9
%23 = load float, float* %9
%24 = fcmp oge float %23, 0.000000e+00
br i1 %24, label %25, label %47
25: ; preds = %14
%26 = load float, float* %5
%27 = fneg float %26
%28 = load float, float* %9
%29 = call float @sqrt(float %28)
%30 = fadd float %27, %29
%31 = fdiv float %30, 2.000000e+00
%32 = load float, float* %4
%33 = fmul float %31, %32
store float %33, float* %7
%34 = load float, float* %5
%35 = fneg float %34
%36 = load float, float* %9
%37 = call float @sqrt(float %36)
%38 = fsub float %35, %37
%39 = fdiv float %38, 2.000000e+00
%40 = load float, float* %4
%41 = fmul float %39, %40
store float %41, float* %8
%42 = load float, float* %7
%43 = fpext float %42 to double
%44 = load float, float* %8
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %43, double %45)
br label %81
47: ; preds = %14
%48 = load float, float* %9
%49 = fcmp olt float %48, 0.000000e+00
br i1 %49, label %50, label %80
50: ; preds = %47
%51 = load float, float* %9
%52 = fneg float %51
store float %52, float* %10
%53 = load float, float* %10
%54 = call float @sqrt(float %53)
store float %54, float* %11
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%56 = load float, float* %5
%57 = fneg float %56
%58 = fdiv float %57, 2.000000e+00
%59 = load float, float* %4
%60 = fmul float %58, %59
%61 = fpext float %60 to double
%62 = load float, float* %11
%63 = fdiv float %62, 2.000000e+00
%64 = load float, float* %4
%65 = fmul float %63, %64
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %61, double %66)
%68 = load float, float* %5
%69 = fneg float %68
%70 = fdiv float %69, 2.000000e+00
%71 = load float, float* %4
%72 = fmul float %70, %71
%73 = fpext float %72 to double
%74 = load float, float* %11
%75 = fdiv float %74, 2.000000e+00
%76 = load float, float* %4
%77 = fmul float %75, %76
%78 = fpext float %77 to double
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %73, double %78)
br label %80
80: ; preds = %50, %47
br label %81
81: ; preds = %80, %25
br label %82
82: ; preds = %81, %3
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"as ra\C3\ADzes s\C3\A3o reais: %0.2f,%0.2f \0A\00"
@.str.2 = [28 x i8] c"a raiz 1: %0.2f + i.%0.2f \0A\00"
@.str.3 = [28 x i8] c"a raiz 2: %0.2f - i.%0.2f \0A\00"
@str = [40 x i8] c"as ra\C3\ADzes s\C3\A3o complexas do tipo x+iy \00"
define void @cal_raizes(float %0, float %1, float %2) {
%4 = fcmp une float %0, 0.000000e+00
br i1 %4, label %5, label %37
5: ; preds = %3
%6 = fmul float %0, -4.000000e+00
%7 = fmul float %6, %2
%8 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %7)
%9 = fcmp ult float %8, 0.000000e+00
br i1 %9, label %23, label %10
10: ; preds = %5
%11 = fneg float %1
%12 = tail call float @sqrt(float %8)
%13 = fsub float %12, %1
%14 = fmul float %13, 5.000000e-01
%15 = fmul float %14, %0
%16 = tail call float @sqrt(float %8)
%17 = fsub float %11, %16
%18 = fmul float %17, 5.000000e-01
%19 = fmul float %18, %0
%20 = fpext float %15 to double
%21 = fpext float %19 to double
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %20, double %21)
br label %37
23: ; preds = %5
%24 = fcmp olt float %8, 0.000000e+00
br i1 %24, label %25, label %37
25: ; preds = %23
%26 = fneg float %8
%27 = tail call float @sqrt(float %26)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%29 = fmul float %1, -5.000000e-01
%30 = fmul float %29, %0
%31 = fpext float %30 to double
%32 = fmul float %27, 5.000000e-01
%33 = fmul float %32, %0
%34 = fpext float %33 to double
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %31, double %34)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), double %31, double %34)
br label %37
37: ; preds = %10, %25, %23, %3
ret void
}