#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 */
float calculateRoot(float, float, float);
float pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int sqrt(float);
void showResult(int type, float a, float b, float c) {
  float root;
  if (type == 1) {
    if (c == 0) {
      printf("Zero polynomial");
    } else {
      printf("Degree 0 polynomial");
    }
  } else {
    if (type == 2) {
      printf("Degree 1 polynomial, solution x=%g", -c / b);
    } else {
      printf("Degree 2 polynomial, solution x=");
      root = calculateRoot(a, b, c);
      if (root == 0) {
        printf("=%g\n", -b / pow(b, 2));
      } else {
        if (root > 0) {
          if (b == 0) {
            printf("\u00B1%g", (-b + sqrt(root)) / (2 * a));
          } else {
            printf("%g, x=%g", (-b + sqrt(root)) / (2 * a),
                   (b + sqrt(root)) / (2 * a));
          }
        } else {
          printf("%.3g\u00B1%.3gi", -b / (2 * a), sqrt(-root) / (2 * a));
        }
      }
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<showResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    11a1 <showResult+0x61>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    118e <showResult+0x4e>
jp     118e <showResult+0x4e>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119c <showResult+0x5c>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13f2 <showResult+0x2b2>
cmpl   $0x2,-0x4(%rbp)
jne    11d9 <showResult+0x99>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    13ed <showResult+0x2ad>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1040 <calculateRoot@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1260 <showResult+0x120>
jp     1260 <showResult+0x120>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    13e8 <showResult+0x2a8>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1374 <showResult+0x234>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12de <showResult+0x19e>
jp     12de <showResult+0x19e>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  -0x1c(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  0xd42(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd9f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    136f <showResult+0x22f>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  -0x30(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
addss  %xmm1,%xmm0
movss  0xcec(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  -0x2c(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
cvtsi2ss %eax,%xmm2
addss  %xmm2,%xmm1
movss  0xcac(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd0e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13e3 <showResult+0x2a3>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xc72(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1060 <sqrt@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
movss  0xc38(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xca3(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13e8 <showResult+0x2a8>
jmp    13ed <showResult+0x2ad>
jmp    13f2 <showResult+0x2b2>
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showResult>:
sub    $0x38,%rsp
cmp    $0x2,%edi
je     117c <showResult+0x2c>
cmp    $0x1,%edi
jne    1197 <showResult+0x47>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jne    1211 <showResult+0xc1>
jp     1211 <showResult+0xc1>
lea    0xe99(%rip),%rdi
jmp    1218 <showResult+0xc8>
xorps  0xe7d(%rip),%xmm2
divss  %xmm1,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe9f(%rip),%rdi
jmp    1205 <showResult+0xb5>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
movss  %xmm0,(%rsp)
movaps %xmm1,0x10(%rsp)
movaps %xmm2,0x20(%rsp)
call   1040 <printf@plt>
movss  (%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
movaps 0x20(%rsp),%xmm2
call   1050 <calculateRoot@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1224 <showResult+0xd4>
jp     1224 <showResult+0xd4>
movaps 0xe27(%rip),%xmm1
movaps 0x10(%rsp),%xmm0
xorps  %xmm0,%xmm1
movaps %xmm1,(%rsp)
mov    $0x2,%edi
call   1060 <pow@plt>
movaps (%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe73(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    12fb <showResult+0x1ab>
lea    0xe08(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12fb <showResult+0x1ab>
jbe    1264 <showResult+0x114>
movaps %xmm0,0x20(%rsp)
call   1070 <sqrt@plt>
xorps  %xmm0,%xmm0
movaps 0x10(%rsp),%xmm1
ucomiss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
subss  %xmm1,%xmm0
movss  (%rsp),%xmm2
addss  %xmm2,%xmm2
divss  %xmm2,%xmm0
cvtss2sd %xmm0,%xmm0
jne    12b9 <showResult+0x169>
jp     12b9 <showResult+0x169>
lea    0xe1b(%rip),%rdi
jmp    1205 <showResult+0xb5>
movaps 0xd95(%rip),%xmm2
movaps 0x10(%rsp),%xmm1
xorps  %xmm2,%xmm1
movss  (%rsp),%xmm3
addss  %xmm3,%xmm3
movss  %xmm3,(%rsp)
divss  %xmm3,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
xorps  %xmm2,%xmm0
call   1070 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xdda(%rip),%rdi
movsd  0x10(%rsp),%xmm0
jmp    12f4 <showResult+0x1a4>
movsd  %xmm0,0x30(%rsp)
movaps 0x20(%rsp),%xmm0
movss  %xmm2,(%rsp)
call   1070 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
addss  0x10(%rsp),%xmm0
divss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xd94(%rip),%rdi
movsd  0x30(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x38,%rsp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Zero polynomial\00"
@.str.1 = [20 x i8] c"Degree 0 polynomial\00"
@.str.2 = [35 x i8] c"Degree 1 polynomial, solution x=%g\00"
@.str.3 = [33 x i8] c"Degree 2 polynomial, solution x=\00"
@.str.4 = [5 x i8] c"=%g\0A\00"
@.str.5 = [5 x i8] c"\C2\B1%g\00"
@.str.6 = [9 x i8] c"%g, x=%g\00"
@.str.7 = [12 x i8] c"%.3g\C2\B1%.3gi\00"
@.str.8 = [2 x i8] c"\0A\00"
define void @showResult(i32 %0, float %1, float %2, float %3) {
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store i32 %0, i32* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %4
%13 = load float, float* %8
%14 = fcmp oeq float %13, 0.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %19
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
br label %105
20: ; preds = %4
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load float, float* %8
%25 = fneg float %24
%26 = load float, float* %7
%27 = fdiv float %25, %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %28)
br label %104
30: ; preds = %20
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%32 = load float, float* %6
%33 = load float, float* %7
%34 = load float, float* %8
%35 = call float @calculateRoot(float %32, float %33, float %34)
store float %35, float* %9
%36 = load float, float* %9
%37 = fcmp oeq float %36, 0.000000e+00
br i1 %37, label %38, label %46
38: ; preds = %30
%39 = load float, float* %7
%40 = fneg float %39
%41 = load float, float* %7
%42 = call float @pow(float %41, i32 2)
%43 = fdiv float %40, %42
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %44)
br label %103
46: ; preds = %30
%47 = load float, float* %9
%48 = fcmp ogt float %47, 0.000000e+00
br i1 %48, label %49, label %86
49: ; preds = %46
%50 = load float, float* %7
%51 = fcmp oeq float %50, 0.000000e+00
br i1 %51, label %52, label %64
52: ; preds = %49
%53 = load float, float* %7
%54 = fneg float %53
%55 = load float, float* %9
%56 = call i32 @sqrt(float %55)
%57 = sitofp i32 %56 to float
%58 = fadd float %54, %57
%59 = load float, float* %6
%60 = fmul float 2.000000e+00, %59
%61 = fdiv float %58, %60
%62 = fpext float %61 to double
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double %62)
br label %85
64: ; preds = %49
%65 = load float, float* %7
%66 = fneg float %65
%67 = load float, float* %9
%68 = call i32 @sqrt(float %67)
%69 = sitofp i32 %68 to float
%70 = fadd float %66, %69
%71 = load float, float* %6
%72 = fmul float 2.000000e+00, %71
%73 = fdiv float %70, %72
%74 = fpext float %73 to double
%75 = load float, float* %7
%76 = load float, float* %9
%77 = call i32 @sqrt(float %76)
%78 = sitofp i32 %77 to float
%79 = fadd float %75, %78
%80 = load float, float* %6
%81 = fmul float 2.000000e+00, %80
%82 = fdiv float %79, %81
%83 = fpext float %82 to double
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %74, double %83)
br label %85
85: ; preds = %64, %52
br label %102
86: ; preds = %46
%87 = load float, float* %7
%88 = fneg float %87
%89 = load float, float* %6
%90 = fmul float 2.000000e+00, %89
%91 = fdiv float %88, %90
%92 = fpext float %91 to double
%93 = load float, float* %9
%94 = fneg float %93
%95 = call i32 @sqrt(float %94)
%96 = sitofp i32 %95 to float
%97 = load float, float* %6
%98 = fmul float 2.000000e+00, %97
%99 = fdiv float %96, %98
%100 = fpext float %99 to double
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), double %92, double %100)
br label %102
102: ; preds = %86, %85
br label %103
103: ; preds = %102, %38
br label %104
104: ; preds = %103, %23
br label %105
105: ; preds = %104, %19
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Zero polynomial\00"
@.str.1 = [20 x i8] c"Degree 0 polynomial\00"
@.str.2 = [35 x i8] c"Degree 1 polynomial, solution x=%g\00"
@.str.3 = [33 x i8] c"Degree 2 polynomial, solution x=\00"
@.str.4 = [5 x i8] c"=%g\0A\00"
@.str.5 = [5 x i8] c"\C2\B1%g\00"
@.str.6 = [9 x i8] c"%g, x=%g\00"
@.str.7 = [12 x i8] c"%.3g\C2\B1%.3gi\00"
define void @showResult(i32 %0, float %1, float %2, float %3) {
switch i32 %0, label %16 [
i32 1, label %5
i32 2, label %11
]
5: ; preds = %4
%6 = fcmp oeq float %3, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %56
9: ; preds = %5
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %56
11: ; preds = %4
%12 = fneg float %3
%13 = fdiv float %12, %2
%14 = fpext float %13 to double
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %56
16: ; preds = %4
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call float @calculateRoot(float %1, float %2, float %3)
%19 = fcmp oeq float %18, 0.000000e+00
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = fneg float %2
%22 = tail call float @pow(float %2, i32 2)
%23 = fdiv float %21, %22
%24 = fpext float %23 to double
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %24)
br label %56
26: ; preds = %16
%27 = fcmp ogt float %18, 0.000000e+00
br i1 %27, label %28, label %45
28: ; preds = %26
%29 = fcmp oeq float %2, 0.000000e+00
%30 = tail call i32 @sqrt(float %18)
%31 = sitofp i32 %30 to float
%32 = fsub float %31, %2
%33 = fmul float %1, 2.000000e+00
%34 = fdiv float %32, %33
%35 = fpext float %34 to double
br i1 %29, label %36, label %38
36: ; preds = %28
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double %35)
br label %56
38: ; preds = %28
%39 = tail call i32 @sqrt(float %18)
%40 = sitofp i32 %39 to float
%41 = fadd float %40, %2
%42 = fdiv float %41, %33
%43 = fpext float %42 to double
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), double %35, double %43)
br label %56
45: ; preds = %26
%46 = fneg float %2
%47 = fmul float %1, 2.000000e+00
%48 = fdiv float %46, %47
%49 = fpext float %48 to double
%50 = fneg float %18
%51 = tail call i32 @sqrt(float %50)
%52 = sitofp i32 %51 to float
%53 = fdiv float %52, %47
%54 = fpext float %53 to double
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), double %49, double %54)
br label %56
56: ; preds = %11, %45, %38, %36, %20, %7, %9
%57 = tail call i32 @putchar(i32 10)
ret void
}