#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 modul(double, double);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, double *, double *);
int main() {
  double x, y, r;
  printf("Zadej souradnice X a Y v [] oddelene carkami: ");
  if (scanf("[%lf,%lf]", &x, &y) != 2) {
    printf("Spatne zadani\n\a");
    return 1;
  }
  r = modul(x, y);
  printf("Vzdalenost bodu o souradnicich x=%lf a y=%lf od pocatku je %lf", x, y,
         r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
je     1184 <main+0x54>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bc <main+0x8c>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <modul@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
lea    0xe9b(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    118c <main+0x5c>
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1040 <modul@plt>
movaps %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
lea    0xec6(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    119f <main+0x6f>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Zadej souradnice X a Y v [] oddelene carkami: \00"
@.str.1 = [10 x i8] c"[%lf,%lf]\00"
@.str.2 = [16 x i8] c"Spatne zadani\0A\07\00"
@.str.3 = [63 x i8] c"Vzdalenost bodu o souradnicich x=%lf a y=%lf od pocatku je %lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %18
10: ; preds = %0
%11 = load double, double* %2
%12 = load double, double* %3
%13 = call double @modul(double %11, double %12)
store double %13, double* %4
%14 = load double, double* %2
%15 = load double, double* %3
%16 = load double, double* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), double %14, double %15, double %16)
store i32 0, i32* %1
br label %18
18: ; preds = %10, %8
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@.str = [47 x i8] c"Zadej souradnice X a Y v [] oddelene carkami: \00"
@.str.1 = [10 x i8] c"[%lf,%lf]\00"
@.str.2 = [16 x i8] c"Spatne zadani\0A\07\00"
@.str.3 = [63 x i8] c"Vzdalenost bodu o souradnicich x=%lf a y=%lf od pocatku je %lf\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2)
%7 = icmp eq i32 %6, 2
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %17
10: ; preds = %0
%11 = load double, double* %1
%12 = load double, double* %2
%13 = call double @modul(double %11, double %12)
%14 = load double, double* %1
%15 = load double, double* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.3, i64 0, i64 0), double %14, double %15, double %13)
br label %17
17: ; preds = %10, %8
%18 = phi i32 [ 1, %8 ], [ 0, %10 ]
ret i32 %18
}