#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 */
float dist(float, float, float, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float distancia, x1, x2, y1, y2;
  do {
    printf("entre com x1 (<=0): ");
    scanf("%f", &x1);
    printf("entre com x2 (>x1): ");
    scanf("%f", &x2);
  } while (x1 < 0 && x2 <= 0);
  do {
    printf("entre com y1 (<=0): ");
    scanf("%f", &y1);
    printf("entre com y2 (>y1): ");
    scanf("%f", &y2);
  } while (y1 <= 0 && y2 <= 0);
  distancia = dist(x1, y1, x2, y2);
  printf("distancia: %f\n", distancia);
  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    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
mov    %al,-0x19(%rbp)
jbe    119a <main+0x6a>
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    113f <main+0xf>
jmp    11aa <main+0x7a>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe56(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
mov    %al,-0x1a(%rbp)
jb     1205 <main+0xd5>
xorps  %xmm0,%xmm0
ucomiss -0x18(%rbp),%xmm0
setae  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x7a>
movss  -0xc(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  -0x18(%rbp),%xmm3
call   1040 <dist@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe19(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%r14
lea    0xeca(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xec1(%rip),%r12
mov    %rsp,%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss 0x4(%rsp),%xmm0
jbe    119a <main+0x6a>
ucomiss (%rsp),%xmm0
jae    1160 <main+0x30>
lea    0xe8c(%rip),%r14
lea    0xe6d(%rip),%rbx
lea    0xc(%rsp),%r15
lea    0xe8e(%rip),%r12
lea    0x8(%rsp),%r13
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm1,%xmm0
movss  0x8(%rsp),%xmm3
jb     1203 <main+0xd3>
ucomiss %xmm3,%xmm0
jae    11c0 <main+0x90>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm2
call   1040 <dist@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe39(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"entre com x1 (<=0): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"entre com x2 (>x1): \00"
@.str.3 = [21 x i8] c"entre com y1 (<=0): \00"
@.str.4 = [21 x i8] c"entre com y2 (>y1): \00"
@.str.5 = [15 x i8] c"distancia: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
br label %7
7: ; preds = %18, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
br label %12
12: ; preds = %7
%13 = load float, float* %3
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load float, float* %4
%17 = fcmp ole float %16, 0.000000e+00
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br i1 %19, label %7, label %20
20: ; preds = %18
br label %21
21: ; preds = %32, %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
br label %26
26: ; preds = %21
%27 = load float, float* %5
%28 = fcmp ole float %27, 0.000000e+00
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = load float, float* %6
%31 = fcmp ole float %30, 0.000000e+00
br label %32
32: ; preds = %29, %26
%33 = phi i1 [ false, %26 ], [ %31, %29 ]
br i1 %33, label %21, label %34
34: ; preds = %32
%35 = load float, float* %3
%36 = load float, float* %5
%37 = load float, float* %4
%38 = load float, float* %6
%39 = call float @dist(float %35, float %36, float %37, float %38)
store float %39, float* %2
%40 = load float, float* %2
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"entre com x1 (<=0): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"entre com x2 (>x1): \00"
@.str.3 = [21 x i8] c"entre com y1 (<=0): \00"
@.str.4 = [21 x i8] c"entre com y2 (>y1): \00"
@.str.5 = [15 x i8] c"distancia: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
br label %9
9: ; preds = %9, %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%14 = load float, float* %1
%15 = fcmp olt float %14, 0.000000e+00
%16 = load float, float* %2
%17 = fcmp ole float %16, 0.000000e+00
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %9, label %19
19: ; preds = %9, %19
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%24 = load float, float* %3
%25 = fcmp ole float %24, 0.000000e+00
%26 = load float, float* %4
%27 = fcmp ole float %26, 0.000000e+00
%28 = select i1 %25, i1 %27, i1 false
br i1 %28, label %19, label %29
29: ; preds = %19
%30 = load float, float* %1
%31 = load float, float* %2
%32 = call float @dist(float %30, float %24, float %31, float %26)
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), double %33)
ret i32 0
}