#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*/ exit(int);
int /*<<< orphan*/ pow(double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int /*<<< orphan*/ sqrt(double);
int main() {
  double R;
  printf("Podaj liczbe rzeczywista: ");
  scanf("%lf", &R);
  if (R == 0) {
    printf("Nie ma odwrotnosci liczby 0\n");
    exit(1);
  }
  if (R < 0) {
    printf("Pierwiastek z liczby ujemnej nie istnieje\n");
    exit(1);
  } else {
    printf("Odwrotnosc liczby: %lf\n", pow(R, -1));
    printf("Pierwiastek kwadratowy z danej liczby wynosi:  %lf\n", sqrt(R));
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ad <main+0x5d>
jp     11ad <main+0x5d>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11d3 <main+0x83>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movsd  -0x10(%rbp),%xmm0
mov    $0xffffffff,%edi
call   1050 <pow@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
call   1060 <sqrt@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    118f <main+0x2f>
jnp    11cd <main+0x6d>
ucomisd %xmm0,%xmm1
ja     11d6 <main+0x76>
mov    $0xffffffff,%edi
call   1060 <pow@plt>
lea    0xe79(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
call   1070 <sqrt@plt>
lea    0xe77(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xec1(%rip),%rdi
jmp    11dd <main+0x7d>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Podaj liczbe rzeczywista: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [29 x i8] c"Nie ma odwrotnosci liczby 0\0A\00"
@.str.3 = [43 x i8] c"Pierwiastek z liczby ujemnej nie istnieje\0A\00"
@.str.4 = [24 x i8] c"Odwrotnosc liczby: %lf\0A\00"
@.str.5 = [52 x i8] c"Pierwiastek kwadratowy z danej liczby wynosi: %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 ([27 x i8], [27 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 oeq double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = load double, double* %2
%12 = fcmp olt double %11, 0.000000e+00
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %10
%17 = load double, double* %2
%18 = call i32 @pow(double %17, i32 -1)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = load double, double* %2
%21 = call i32 @sqrt(double %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Podaj liczbe rzeczywista: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.4 = [24 x i8] c"Odwrotnosc liczby: %lf\0A\00"
@.str.5 = [52 x i8] c"Pierwiastek kwadratowy z danej liczby wynosi: %lf\0A\00"
@str = [42 x i8] c"Pierwiastek z liczby ujemnej nie istnieje\00"
@str.6 = [28 x i8] c"Nie ma odwrotnosci liczby 0\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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 oeq double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.6, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = fcmp olt double %5, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %10
%16 = call i32 @pow(double %5, i32 -1)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load double, double* %1
%19 = call i32 @sqrt(double %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i32 %19)
ret i32 0
}