#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 *, double *);
int main() {
  double a;
  printf("Podaj liczbę: ");
  scanf("%lf", &a);
  if (a < 0) {
    printf("Błąd: podana liczba nie może być ujemna.\n");
  } else {
    printf("Pierwiastek kwadratowy z twojej liczby: %lf\n", a * a);
    printf("Odwrotność: -%lf\n", a);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116e <main+0x4e>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1199 <main+0x79>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xec3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xedd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    116b <main+0x3b>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
jmp    1190 <main+0x60>
mulsd  %xmm0,%xmm0
lea    0xe9e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
lea    0xeb8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Podaj liczb\C4\99: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [46 x i8] c"B\C5\82\C4\85d: podana liczba nie mo\C5\BCe by\C4\87 ujemna.\0A\00"
@.str.3 = [45 x i8] c"Pierwiastek kwadratowy z twojej liczby: %lf\0A\00"
@.str.4 = [20 x i8] c"Odwrotno\C5\9B\C4\87: -%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%5 = load double, double* %2
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
br label %16
9: ; preds = %0
%10 = load double, double* %2
%11 = load double, double* %2
%12 = fmul double %10, %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %12)
%14 = load double, double* %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %14)
br label %16
16: ; preds = %9, %7
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [16 x i8] c"Podaj liczb\C4\99: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.3 = [45 x i8] c"Pierwiastek kwadratowy z twojej liczby: %lf\0A\00"
@.str.4 = [20 x i8] c"Odwrotno\C5\9B\C4\87: -%lf\0A\00"
@str = [45 x i8] c"B\C5\82\C4\85d: podana liczba nie mo\C5\BCe by\C4\87 ujemna.\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
br label %14
9: ; preds = %0
%10 = fmul double %5, %5
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), double %10)
%12 = load double, double* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), double %12)
br label %14
14: ; preds = %9, %7
ret i32 0
}