#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*/ oblRozwKwad(double, double, double, double *, double *);
double obliczRozwDwukwad(double, double, double *, double *, double *,
                         double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *, double *);
scalar_t__ sprawdzRozw(double, double, double, double);
int main(void) {
  double a, b, c, t[2] = {-1, -1}, x[4], xrozw;
  printf("Podaj wspolczynniki:\n");
  scanf("%lf %lf %lf", &a, &b, &c);
  oblRozwKwad(a, b, c, t, t + 1);
  xrozw = obliczRozwDwukwad(t[0], t[1], x, x + 1, x + 2, x + 3);
  for (int i = 0; i < xrozw; ++i)
    printf("Rozwiazanie %i: %lf Czy poprawne: %s\n", i + 1, x[i],
           sprawdzRozw(a, b, c, x[i]) ? "tak" : "nie");
  if (xrozw == 0)
    printf("Brak rozwiazan!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1060 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
add    $0x8,%rsi
call   1050 <oblRozwKwad@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    -0x50(%rbp),%rdi
lea    -0x50(%rbp),%rsi
add    $0x8,%rsi
lea    -0x50(%rbp),%rdx
add    $0x10,%rdx
lea    -0x50(%rbp),%rcx
add    $0x18,%rcx
call   1040 <obliczRozwDwukwad@plt>
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
cvtsi2sdl -0x5c(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1279 <main+0x129>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
movslq -0x5c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movslq -0x5c(%rbp),%rax
movsd  -0x50(%rbp,%rax,8),%xmm3
call   1070 <sprawdzRozw@plt>
mov    -0x6c(%rbp),%esi
movsd  -0x68(%rbp),%xmm0
mov    %rax,%rcx
lea    0xe0e(%rip),%rdx
lea    0xe03(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xdce(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11f2 <main+0xa2>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    129f <main+0x14f>
jp     129f <main+0x14f>
lea    0xdc8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
movaps 0xe9e(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xe96(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1070 <scanf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
lea    0x28(%rsp),%rsi
lea    0x20(%rsp),%rdi
call   1060 <oblRozwKwad@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
lea    0x48(%rsp),%rsi
lea    0x50(%rsp),%rdx
lea    0x58(%rsp),%rcx
lea    0x40(%rsp),%rdi
call   1050 <obliczRozwDwukwad@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    126a <main+0x10a>
xor    %ebx,%ebx
lea    0xe5f(%rip),%r15
lea    0xe54(%rip),%r12
lea    0xe27(%rip),%r14
movsd  %xmm0,(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  0x40(%rsp,%rbx,8),%xmm3
movsd  %xmm3,0x38(%rsp)
add    $0x1,%rbx
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
call   1080 <sprawdzRozw@plt>
test   %rax,%rax
mov    %r12,%rdx
cmove  %r15,%rdx
mov    %r14,%rdi
mov    %ebx,%esi
movsd  0x38(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movsd  (%rsp),%xmm0
ja     1210 <main+0xb0>
ucomisd 0xd8e(%rip),%xmm0
jne    1282 <main+0x122>
jp     1282 <main+0x122>
lea    0xdf2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.t = [2 x double] [double -1.000000e+00, double -1.000000e+00]
@.str = [22 x i8] c"Podaj wspolczynniki:\0A\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [38 x i8] c"Rozwiazanie %i: %lf Czy poprawne: %s\0A\00"
@.str.3 = [4 x i8] c"tak\00"
@.str.4 = [4 x i8] c"nie\00"
@.str.5 = [17 x i8] c"Brak rozwiazan!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca [2 x double]
%6 = alloca [4 x double]
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [2 x double]* %5 to i8*
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%12 = load double, double* %2
%13 = load double, double* %3
%14 = load double, double* %4
%15 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%16 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = call i32 @oblRozwKwad(double %12, double %13, double %14, double* %15, double* %17)
%19 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%20 = load double, double* %19
%21 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
%22 = load double, double* %21
%23 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%24 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%25 = getelementptr inbounds double, double* %24, i64 1
%26 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%27 = getelementptr inbounds double, double* %26, i64 2
%28 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 0
%29 = getelementptr inbounds double, double* %28, i64 3
%30 = call double @obliczRozwDwukwad(double %20, double %22, double* %23, double* %25, double* %27, double* %29)
store double %30, double* %7
store i32 0, i32* %8
br label %31
31: ; preds = %55, %0
%32 = load i32, i32* %8
%33 = sitofp i32 %32 to double
%34 = load double, double* %7
%35 = fcmp olt double %33, %34
br i1 %35, label %36, label %58
36: ; preds = %31
%37 = load i32, i32* %8
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %8
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 %40
%42 = load double, double* %41
%43 = load double, double* %2
%44 = load double, double* %3
%45 = load double, double* %4
%46 = load i32, i32* %8
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x double], [4 x double]* %6, i64 0, i64 %47
%49 = load double, double* %48
%50 = call i64 @sprawdzRozw(double %43, double %44, double %45, double %49)
%51 = icmp ne i64 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %38, double %42, i8* %53)
br label %55
55: ; preds = %36
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %31
58: ; preds = %31
%59 = load double, double* %7
%60 = fcmp oeq double %59, 0.000000e+00
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
ret i32 0
}

LLVM IR (-O2):
@__const.main.t = [2 x double] [double -1.000000e+00, double -1.000000e+00]
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [38 x i8] c"Rozwiazanie %i: %lf Czy poprawne: %s\0A\00"
@.str.3 = [4 x i8] c"tak\00"
@.str.4 = [4 x i8] c"nie\00"
@str = [21 x i8] c"Podaj wspolczynniki:\00"
@str.6 = [16 x i8] c"Brak rozwiazan!\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca [2 x double]
%5 = alloca [4 x double]
%6 = bitcast double* %1 to i8*
%7 = bitcast double* %2 to i8*
%8 = bitcast double* %3 to i8*
%9 = bitcast [2 x double]* %4 to i8*
%10 = bitcast [4 x double]* %5 to i8*
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%13 = load double, double* %1
%14 = load double, double* %2
%15 = load double, double* %3
%16 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%17 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
%18 = call i32 @oblRozwKwad(double %13, double %14, double %15, double* %16, double* %17)
%19 = load double, double* %16
%20 = load double, double* %17
%21 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%22 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 1
%23 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%24 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 3
%25 = call double @obliczRozwDwukwad(double %19, double %20, double* %21, double* %22, double* %23, double* %24)
%26 = fcmp ogt double %25, 0.000000e+00
br i1 %26, label %29, label %27
27: ; preds = %29, %0
%28 = fcmp oeq double %25, 0.000000e+00
br i1 %28, label %44, label %46
29: ; preds = %0, %29
%30 = phi i64 [ %31, %29 ], [ 0, %0 ]
%31 = add nuw i64 %30, 1
%32 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 %30
%33 = load double, double* %32
%34 = load double, double* %1
%35 = load double, double* %2
%36 = load double, double* %3
%37 = call i64 @sprawdzRozw(double %34, double %35, double %36, double %33)
%38 = icmp eq i64 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%40 = trunc i64 %31 to i32
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %40, double %33, i8* %39)
%42 = sitofp i32 %40 to double
%43 = fcmp ogt double %25, %42
br i1 %43, label %29, label %27
44: ; preds = %27
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %46
46: ; preds = %44, %27
ret i32 0
}