#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 */
scalar_t__ KvadrRov(int, int, int, float *);
scalar_t__ KvadrRov2(int, int, int, float *, float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void priklad_dva() {
  printf("========== PRIKLAD 2 ==========\n");
  printf("Zadani cisel pro priklad 2.\n");
  printf("A = ");
  int a, b, c;
  scanf("%i", &a);
  printf("B = ");
  scanf("%i", &b);
  printf("C = ");
  scanf("%i", &c);
  float vysledek[2];
  float x1, x2;
  if (KvadrRov(a, b, c, vysledek)) {
    printf("Koreny(funkce s polem): %f  %f\n", vysledek[0], vysledek[1]);
  } else {
    printf("Nelze vypocitat (funkce s polem)\n");
  }
  if (KvadrRov2(a, b, c, &x1, &x2)) {
    printf("Koreny(funkce s pointery): %f  %f\n", x1, x2);
  } else {
    printf("Nelze vypocitat (funkce s pointery)\n");
  }
  printf("========== KONEC PRIKLADU 2 ==========\n");
}


x86 assembly (clang, -O0):
<priklad_dva>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x14(%rbp),%rcx
call   1050 <KvadrRov@plt>
cmp    $0x0,%rax
je     11ff <priklad_dva+0xbf>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe5d(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    120d <priklad_dva+0xcd>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1040 <KvadrRov2@plt>
cmp    $0x0,%rax
je     1252 <priklad_dva+0x112>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe4c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1260 <priklad_dva+0x120>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priklad_dva>:
push   %rbx
sub    $0x20,%rsp
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe83(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe72(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
lea    0x18(%rsp),%rcx
call   1060 <KvadrRov@plt>
test   %rax,%rax
je     1204 <priklad_dva+0xb4>
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe17(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    1210 <priklad_dva+0xc0>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
call   1050 <KvadrRov2@plt>
test   %rax,%rax
je     1254 <priklad_dva+0x104>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xde7(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    1260 <priklad_dva+0x110>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"========== PRIKLAD 2 ==========\0A\00"
@.str.1 = [29 x i8] c"Zadani cisel pro priklad 2.\0A\00"
@.str.2 = [5 x i8] c"A = \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [5 x i8] c"B = \00"
@.str.5 = [5 x i8] c"C = \00"
@.str.6 = [32 x i8] c"Koreny(funkce s polem): %f %f\0A\00"
@.str.7 = [34 x i8] c"Nelze vypocitat (funkce s polem)\0A\00"
@.str.8 = [35 x i8] c"Koreny(funkce s pointery): %f %f\0A\00"
@.str.9 = [37 x i8] c"Nelze vypocitat (funkce s pointery)\0A\00"
@.str.10 = [40 x i8] c"========== KONEC PRIKLADU 2 ==========\0A\00"
define void @priklad_dva() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x float]
%5 = alloca float
%6 = alloca float
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 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), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 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), i32* %2)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 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), i32* %3)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 0
%19 = call i64 @KvadrRov(i32 %15, i32 %16, i32 %17, float* %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %0
%22 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 0
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 1
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %24, double %27)
br label %31
29: ; preds = %0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %31
31: ; preds = %29, %21
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = call i64 @KvadrRov2(i32 %32, i32 %33, i32 %34, float* %5, float* %6)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %43
37: ; preds = %31
%38 = load float, float* %5
%39 = fpext float %38 to double
%40 = load float, float* %6
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), double %39, double %41)
br label %45
43: ; preds = %31
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.9, i64 0, i64 0))
br label %45
45: ; preds = %43, %37
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"A = \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [5 x i8] c"B = \00"
@.str.5 = [5 x i8] c"C = \00"
@.str.6 = [32 x i8] c"Koreny(funkce s polem): %f %f\0A\00"
@.str.8 = [35 x i8] c"Koreny(funkce s pointery): %f %f\0A\00"
@str = [32 x i8] c"========== PRIKLAD 2 ==========\00"
@str.11 = [28 x i8] c"Zadani cisel pro priklad 2.\00"
@str.12 = [33 x i8] c"Nelze vypocitat (funkce s polem)\00"
@str.13 = [36 x i8] c"Nelze vypocitat (funkce s pointery)\00"
@str.14 = [39 x i8] c"========== KONEC PRIKLADU 2 ==========\00"
define void @priklad_dva() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [2 x float]
%5 = alloca float
%6 = alloca float
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = bitcast i32* %1 to i8*
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%18 = bitcast [2 x float]* %4 to i8*
%19 = bitcast float* %5 to i8*
%20 = bitcast float* %6 to i8*
%21 = load i32, i32* %1
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 0
%25 = call i64 @KvadrRov(i32 %21, i32 %22, i32 %23, float* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %34, label %27
27: ; preds = %0
%28 = load float, float* %24
%29 = fpext float %28 to double
%30 = getelementptr inbounds [2 x float], [2 x float]* %4, i64 0, i64 1
%31 = load float, float* %30
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), double %29, double %32)
br label %36
34: ; preds = %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.12, i64 0, i64 0))
br label %36
36: ; preds = %34, %27
%37 = load i32, i32* %1
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = call i64 @KvadrRov2(i32 %37, i32 %38, i32 %39, float* %5, float* %6)
%41 = icmp eq i64 %40, 0
br i1 %41, label %48, label %42
42: ; preds = %36
%43 = load float, float* %5
%44 = fpext float %43 to double
%45 = load float, float* %6
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.8, i64 0, i64 0), double %44, double %46)
br label %50
48: ; preds = %36
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.13, i64 0, i64 0))
br label %50
50: ; preds = %48, %42
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.14, i64 0, i64 0))
ret void
}