#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 */
double pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float sqrt(float);
int main() {
  float a, b, c, delta;
  printf("Program oblicza pierwiastki rownania w postaci\n");
  printf("  ax + bx + c =0\n");
  printf("Podaj wartosc a:");
  scanf("%f", &a);
  printf("Podaj wartosc b:");
  scanf("%f", &b);
  printf("Podaj wartosc c:");
  scanf("%f", &c);
  if (a == 0.0)
    if (b != 0.0)
      printf("Jest to równanie liniowe o rozwiazaniu x=%f\n", -c / b);
    else if (c == 0.0)
      printf("Rozwiazaniem jest dowolne x\n");
    else
      printf("Brak rozwiazan\n");
  else {
    delta = pow(b, 2) - 4.0 * a * c;
    if (delta < 0)
      printf("Brak rozwiazan rzeczywistych\n");
    else if (delta > 0)
      printf("Rozwiazaniem sa x1=%f i x2=%f\n", (-b - sqrt(delta)) / (2 * a),
             (-b + sqrt(delta)) / (2 * a));
    else
      printf("Rozwiazaniem sa x1=x2=%f\n", -b / (2 * a));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1277 <main+0x137>
jp     1277 <main+0x137>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1202 <main+0xc2>
jp     1202 <main+0xc2>
jmp    1230 <main+0xf0>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1272 <main+0x132>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    125f <main+0x11f>
jp     125f <main+0x11f>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126d <main+0x12d>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x132>
jmp    13e0 <main+0x2a0>
movss  -0xc(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xd66(%rip),%xmm0
mulsd  %xmm2,%xmm0
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    12ef <main+0x1af>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13db <main+0x29b>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    13a1 <main+0x261>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  0xcd3(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  -0x24(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x20(%rbp),%xmm0
addss  %xmm2,%xmm1
movss  0xc87(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
divss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd68(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    13d6 <main+0x296>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xc4d(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    13db <main+0x29b>
jmp    13e0 <main+0x2a0>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xf65(%rip),%rdi
call   1030 <puts@plt>
lea    0xf88(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
movss  0x10(%rsp),%xmm0
jne    120d <main+0xbd>
jp     120d <main+0xbd>
ucomiss %xmm1,%xmm0
movss  0x14(%rsp),%xmm1
jne    11e8 <main+0x98>
jnp    1254 <main+0x104>
xorps  0xe21(%rip),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    135b <main+0x20b>
mov    $0x2,%edi
call   1060 <pow@plt>
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm2
movss  0x14(%rsp),%xmm3
cvtss2sd %xmm3,%xmm3
mulsd  0xdcd(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
cvtsd2ss %xmm2,%xmm2
xorpd  %xmm0,%xmm0
ucomiss %xmm2,%xmm0
jbe    1272 <main+0x122>
lea    0xeb2(%rip),%rdi
jmp    1356 <main+0x206>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    134f <main+0x1ff>
jp     134f <main+0x1ff>
lea    0xec0(%rip),%rdi
jmp    1356 <main+0x206>
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
movss  0x10(%rsp),%xmm3
xorps  0xd8b(%rip),%xmm3
jbe    1334 <main+0x1e4>
xorps  %xmm1,%xmm1
sqrtss %xmm2,%xmm1
ucomiss %xmm0,%xmm2
movaps %xmm1,%xmm0
jae    12c4 <main+0x174>
movaps %xmm2,%xmm0
movss  %xmm2,0x18(%rsp)
movss  %xmm1,0xc(%rsp)
movaps %xmm3,0x20(%rsp)
call   1070 <sqrt@plt>
movaps 0x20(%rsp),%xmm3
movss  0xc(%rsp),%xmm1
movss  0x18(%rsp),%xmm2
subss  %xmm0,%xmm3
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm3
cvtss2sd %xmm3,%xmm3
movss  0x10(%rsp),%xmm4
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jae    130b <main+0x1bb>
movaps %xmm2,%xmm0
movsd  %xmm3,0x18(%rsp)
movss  %xmm4,0xc(%rsp)
call   1070 <sqrt@plt>
movss  0xc(%rsp),%xmm4
movsd  0x18(%rsp),%xmm3
movaps %xmm0,%xmm1
subss  %xmm4,%xmm1
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm0
divss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xd60(%rip),%rdi
movaps %xmm3,%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
jmp    135b <main+0x20b>
addss  %xmm1,%xmm1
divss  %xmm1,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
lea    0xd5d(%rip),%rdi
jmp    1201 <main+0xb1>
lea    0xdc8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"Program oblicza pierwiastki rownania w postaci\0A\00"
@.str.1 = [18 x i8] c" ax + bx + c =0\0A\00"
@.str.2 = [17 x i8] c"Podaj wartosc a:\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c"Podaj wartosc b:\00"
@.str.5 = [17 x i8] c"Podaj wartosc c:\00"
@.str.6 = [46 x i8] c"Jest to r\C3\B3wnanie liniowe o rozwiazaniu x=%f\0A\00"
@.str.7 = [29 x i8] c"Rozwiazaniem jest dowolne x\0A\00"
@.str.8 = [16 x i8] c"Brak rozwiazan\0A\00"
@.str.9 = [30 x i8] c"Brak rozwiazan rzeczywistych\0A\00"
@.str.10 = [31 x i8] c"Rozwiazaniem sa x1=%f i x2=%f\0A\00"
@.str.11 = [26 x i8] c"Rozwiazaniem sa x1=x2=%f\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 ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = fcmp oeq double %15, 0.000000e+00
br i1 %16, label %17, label %38
17: ; preds = %0
%18 = load float, float* %3
%19 = fpext float %18 to double
%20 = fcmp une double %19, 0.000000e+00
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load float, float* %4
%23 = fneg float %22
%24 = load float, float* %3
%25 = fdiv float %23, %24
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), double %26)
br label %37
28: ; preds = %17
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = fcmp oeq double %30, 0.000000e+00
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %36
34: ; preds = %28
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36, %21
br label %86
38: ; preds = %0
%39 = load float, float* %3
%40 = call double @pow(float %39, i32 2)
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = fmul double 4.000000e+00, %42
%44 = load float, float* %4
%45 = fpext float %44 to double
%46 = fneg double %43
%47 = call double @llvm.fmuladd.f64(double %46, double %45, double %40)
%48 = fptrunc double %47 to float
store float %48, float* %5
%49 = load float, float* %5
%50 = fcmp olt float %49, 0.000000e+00
br i1 %50, label %51, label %53
51: ; preds = %38
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0))
br label %85
53: ; preds = %38
%54 = load float, float* %5
%55 = fcmp ogt float %54, 0.000000e+00
br i1 %55, label %56, label %76
56: ; preds = %53
%57 = load float, float* %3
%58 = fneg float %57
%59 = load float, float* %5
%60 = call float @sqrt(float %59)
%61 = fsub float %58, %60
%62 = load float, float* %2
%63 = fmul float 2.000000e+00, %62
%64 = fdiv float %61, %63
%65 = fpext float %64 to double
%66 = load float, float* %3
%67 = fneg float %66
%68 = load float, float* %5
%69 = call float @sqrt(float %68)
%70 = fadd float %67, %69
%71 = load float, float* %2
%72 = fmul float 2.000000e+00, %71
%73 = fdiv float %70, %72
%74 = fpext float %73 to double
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), double %65, double %74)
br label %84
76: ; preds = %53
%77 = load float, float* %3
%78 = fneg float %77
%79 = load float, float* %2
%80 = fmul float 2.000000e+00, %79
%81 = fdiv float %78, %80
%82 = fpext float %81 to double
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), double %82)
br label %84
84: ; preds = %76, %56
br label %85
85: ; preds = %84, %51
br label %86
86: ; preds = %85, %37
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
@.str.2 = [17 x i8] c"Podaj wartosc a:\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [17 x i8] c"Podaj wartosc b:\00"
@.str.5 = [17 x i8] c"Podaj wartosc c:\00"
@.str.6 = [46 x i8] c"Jest to r\C3\B3wnanie liniowe o rozwiazaniu x=%f\0A\00"
@.str.10 = [31 x i8] c"Rozwiazaniem sa x1=%f i x2=%f\0A\00"
@.str.11 = [26 x i8] c"Rozwiazaniem sa x1=x2=%f\0A\00"
@str = [47 x i8] c"Program oblicza pierwiastki rownania w postaci\00"
@str.12 = [17 x i8] c" ax + bx + c =0\00"
@str.13 = [29 x i8] c"Brak rozwiazan rzeczywistych\00"
@str.14 = [15 x i8] c"Brak rozwiazan\00"
@str.15 = [28 x i8] c"Rozwiazaniem jest dowolne x\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%15 = load float, float* %1
%16 = fcmp oeq float %15, 0.000000e+00
%17 = load float, float* %2
br i1 %16, label %18, label %32
18: ; preds = %0
%19 = fcmp une float %17, 0.000000e+00
%20 = load float, float* %3
br i1 %19, label %21, label %26
21: ; preds = %18
%22 = fneg float %20
%23 = fdiv float %22, %17
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), double %24)
br label %68
26: ; preds = %18
%27 = fcmp oeq float %20, 0.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
br label %68
30: ; preds = %26
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.14, i64 0, i64 0))
br label %68
32: ; preds = %0
%33 = call double @pow(float %17, i32 2)
%34 = load float, float* %1
%35 = fpext float %34 to double
%36 = load float, float* %3
%37 = fpext float %36 to double
%38 = fmul double %35, -4.000000e+00
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %33)
%40 = fptrunc double %39 to float
%41 = fcmp olt float %40, 0.000000e+00
br i1 %41, label %42, label %44
42: ; preds = %32
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.13, i64 0, i64 0))
br label %68
44: ; preds = %32
%45 = fcmp ogt float %40, 0.000000e+00
%46 = load float, float* %2
%47 = fneg float %46
br i1 %45, label %48, label %63
48: ; preds = %44
%49 = call float @sqrt(float %40)
%50 = fsub float %47, %49
%51 = load float, float* %1
%52 = fmul float %51, 2.000000e+00
%53 = fdiv float %50, %52
%54 = fpext float %53 to double
%55 = load float, float* %2
%56 = call float @sqrt(float %40)
%57 = fsub float %56, %55
%58 = load float, float* %1
%59 = fmul float %58, 2.000000e+00
%60 = fdiv float %57, %59
%61 = fpext float %60 to double
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), double %54, double %61)
br label %68
63: ; preds = %44
%64 = fmul float %34, 2.000000e+00
%65 = fdiv float %47, %64
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0), double %66)
br label %68
68: ; preds = %42, %63, %48, %21, %30, %28
ret i32 0
}