#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, delta;
  printf("podaj wspolczynnik a: ");
  scanf("%f", &a);
  printf("podaj wspolczynnik b: ");
  scanf("%f", &b);
  printf("podaj wspolczynnik c: ");
  scanf("%f", &c);
  delta = (b * b) - (4 * a * c);
  if (a == 0) {
    printf("to nie rownanie kwadratowe\n");
  } else {
    if (delta > 0) {
      printf("pierwsze rozwiazanie x: %2f\n", (-b - sqrt(delta)) / (2 * a));
      printf("drugie rozwiazanie x: %2f\n", (-b + sqrt(delta)) / (2 * a));
    } else {
      if (delta == 0) {
        printf("jedno rozwiazanie x: %2f\n", -b / (2 * a));
      } else {
        if (delta < 0) {
          printf("brak rozwiazan\n");
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe55(%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,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11f9 <main+0xc9>
jp     11f9 <main+0xc9>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    132a <main+0x1fa>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    12af <main+0x17f>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xdc5(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe19(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xd75(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1325 <main+0x1f5>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1300 <main+0x1d0>
jp     1300 <main+0x1d0>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xd24(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdb0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1320 <main+0x1f0>
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    131b <main+0x1eb>
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1320 <main+0x1f0>
jmp    1325 <main+0x1f5>
jmp    132a <main+0x1fa>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11bb <main+0x7b>
jp     11bb <main+0x7b>
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
jmp    12bf <main+0x17f>
movss  0x4(%rsp),%xmm4
movss  0xe37(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  0xc(%rsp),%xmm2
movaps %xmm4,%xmm3
mulss  %xmm4,%xmm3
addss  %xmm2,%xmm3
ucomiss %xmm1,%xmm3
jbe    1291 <main+0x151>
xorps  0xe22(%rip),%xmm4
xorps  %xmm0,%xmm0
sqrtss %xmm3,%xmm0
xorps  %xmm1,%xmm1
movaps %xmm3,0x10(%rsp)
ucomiss %xmm1,%xmm3
movss  %xmm0,0x8(%rsp)
jae    121c <main+0xdc>
movaps 0x10(%rsp),%xmm0
movaps %xmm4,0x20(%rsp)
call   1060 <sqrt@plt>
movaps 0x20(%rsp),%xmm4
subss  %xmm0,%xmm4
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm2
movaps 0x10(%rsp),%xmm0
ucomiss 0xdb0(%rip),%xmm0
movss  0x8(%rsp),%xmm1
jae    1270 <main+0x130>
movss  %xmm2,0x10(%rsp)
call   1060 <sqrt@plt>
movss  0x10(%rsp),%xmm2
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xdf6(%rip),%rdi
jmp    12b8 <main+0x178>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm3
jne    12c7 <main+0x187>
jp     12c7 <main+0x187>
xorps  0xd6e(%rip),%xmm4
addss  %xmm0,%xmm0
divss  %xmm0,%xmm4
xorps  %xmm0,%xmm0
cvtss2sd %xmm4,%xmm0
lea    0xde8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret
ucomiss %xmm3,%xmm1
jbe    12bf <main+0x17f>
lea    0xde7(%rip),%rdi
jmp    11b1 <main+0x71>

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

LLVM IR (-O2):
@.str = [23 x i8] c"podaj wspolczynnik a: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"podaj wspolczynnik b: \00"
@.str.3 = [23 x i8] c"podaj wspolczynnik c: \00"
@.str.5 = [29 x i8] c"pierwsze rozwiazanie x: %2f\0A\00"
@.str.6 = [27 x i8] c"drugie rozwiazanie x: %2f\0A\00"
@.str.7 = [26 x i8] c"jedno rozwiazanie x: %2f\0A\00"
@str = [15 x i8] c"brak rozwiazan\00"
@str.9 = [27 x i8] c"to nie rownanie kwadratowe\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 ([23 x i8], [23 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 ([23 x i8], [23 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 ([23 x i8], [23 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* %2
%14 = load float, float* %1
%15 = load float, float* %3
%16 = fmul float %14, -4.000000e+00
%17 = fmul float %16, %15
%18 = call float @llvm.fmuladd.f32(float %13, float %13, float %17)
%19 = fcmp oeq float %14, 0.000000e+00
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0))
br label %53
22: ; preds = %0
%23 = fcmp ogt float %18, 0.000000e+00
br i1 %23, label %24, label %41
24: ; preds = %22
%25 = fneg float %13
%26 = call float @sqrt(float %18)
%27 = fsub float %25, %26
%28 = load float, float* %1
%29 = fmul float %28, 2.000000e+00
%30 = fdiv float %27, %29
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), double %31)
%33 = load float, float* %2
%34 = call float @sqrt(float %18)
%35 = fsub float %34, %33
%36 = load float, float* %1
%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 ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), double %39)
br label %53
41: ; preds = %22
%42 = fcmp oeq float %18, 0.000000e+00
br i1 %42, label %43, label %49
43: ; preds = %41
%44 = fneg float %13
%45 = fmul float %14, 2.000000e+00
%46 = fdiv float %44, %45
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double %47)
br label %53
49: ; preds = %41
%50 = fcmp olt float %18, 0.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %49
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %53
53: ; preds = %24, %49, %51, %43, %20
ret i32 0
}