#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*/ clearIBuffer();
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float cantidad_agua, capacidad_deposito, agua_restante, porcentaje_final;
  char r;
  printf("Bienvenido!\n\nIngrese la capacidad del deposito de agua: ");
  scanf("%f", &capacidad_deposito);
  agua_restante = capacidad_deposito;
  printf("\n\nSe abrira la valvula? (s/n): ");
  clearIBuffer();
  r = getchar();
  while (r == 's' || r == 'S') {
    printf("\nIngrese la cantidad de agua que registró el contador: ");
    scanf("%f", &cantidad_agua);
    agua_restante -= cantidad_agua;
    printf("\n\nLa cantidad de agua restante es %.4f.", agua_restante);
    if (agua_restante >= 1150 && agua_restante <= 1500)
      printf("\nSituacion normal.\n");
    else if (agua_restante < 1150)
      printf("\nSituacion de cuidado.\n");
    printf("\n\nSe abrira la valvula de nuevo? (s/n): ");
    clearIBuffer();
    r = getchar();
  }
  porcentaje_final = agua_restante / capacidad_deposito * 100;
  printf(
      "\n\n\nEL PROCESO HA FINALIZADO.\nLa cantidad de agua que queda en el "
      "deposito es %.4f (representa el %.4f %% de la capacidad del deposito).",
      agua_restante, porcentaje_final);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <clearIBuffer@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%ecx
mov    $0x1,%al
cmp    $0x73,%ecx
mov    %al,-0x16(%rbp)
je     11b5 <main+0x75>
movsbl -0x15(%rbp),%eax
cmp    $0x53,%eax
sete   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    11c5 <main+0x85>
jmp    1291 <main+0x151>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
movss  0xdea(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1248 <main+0x108>
movss  0xddd(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     1248 <main+0x108>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126d <main+0x12d>
movss  0xdb4(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1268 <main+0x128>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126d <main+0x12d>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <clearIBuffer@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x15(%rbp)
jmp    1196 <main+0x56>
movss  -0x10(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  0xd5d(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe59(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xea7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
movss  0x8(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clearIBuffer@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
and    $0xdf,%al
cmp    $0x53,%al
jne    1282 <main+0x132>
lea    0xeb2(%rip),%r14
lea    0xe88(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xed8(%rip),%r13
lea    0xfc1(%rip),%rbp
lea    0xef2(%rip),%rbx
jmp    1207 <main+0xb7>
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <clearIBuffer@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
and    $0xdf,%al
cmp    $0x53,%al
jne    1292 <main+0x142>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
movss  0x4(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xdb1(%rip),%xmm0
jb     1265 <main+0x115>
movss  0xdab(%rip),%xmm1
ucomiss %xmm0,%xmm1
mov    %rbp,%rdi
jae    11e0 <main+0x90>
movss  0xd93(%rip),%xmm1
ucomiss %xmm0,%xmm1
lea    0xf03(%rip),%rdi
ja     11e0 <main+0x90>
jmp    11e5 <main+0x95>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
divss  0x8(%rsp),%xmm0
mulss  0xd62(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xe3e(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [57 x i8] c"Bienvenido!\0A\0AIngrese la capacidad del deposito de agua: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"\0A\0ASe abrira la valvula? (s/n): \00"
@.str.3 = [57 x i8] c"\0AIngrese la cantidad de agua que registr\C3\B3 el contador: \00"
@.str.4 = [40 x i8] c"\0A\0ALa cantidad de agua restante es %.4f.\00"
@.str.5 = [20 x i8] c"\0ASituacion normal.\0A\00"
@.str.6 = [24 x i8] c"\0ASituacion de cuidado.\0A\00"
@.str.7 = [41 x i8] c"\0A\0ASe abrira la valvula de nuevo? (s/n): \00"
@.str.8 = [136 x i8] c"\0A\0A\0AEL PROCESO HA FINALIZADO.\0ALa cantidad de agua que queda en el deposito es %.4f (representa el %.4f %% de la capacidad del deposito).\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i8
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%9 = load float, float* %3
store float %9, float* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @clearIBuffer()
%12 = call signext i8 (...) @getchar()
store i8 %12, i8* %6
br label %13
13: ; preds = %45, %0
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 115
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 83
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ true, %13 ], [ %20, %17 ]
br i1 %22, label %23, label %49
23: ; preds = %21
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%26 = load float, float* %2
%27 = load float, float* %4
%28 = fsub float %27, %26
store float %28, float* %4
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), double %30)
%32 = load float, float* %4
%33 = fcmp oge float %32, 1.150000e+03
br i1 %33, label %34, label %39
34: ; preds = %23
%35 = load float, float* %4
%36 = fcmp ole float %35, 1.500000e+03
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
br label %45
39: ; preds = %34, %23
%40 = load float, float* %4
%41 = fcmp olt float %40, 1.150000e+03
br i1 %41, label %42, label %44
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %39
br label %45
45: ; preds = %44, %37
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%47 = call i32 (...) @clearIBuffer()
%48 = call signext i8 (...) @getchar()
store i8 %48, i8* %6
br label %13
49: ; preds = %21
%50 = load float, float* %4
%51 = load float, float* %3
%52 = fdiv float %50, %51
%53 = fmul float %52, 1.000000e+02
store float %53, float* %5
%54 = load float, float* %4
%55 = fpext float %54 to double
%56 = load float, float* %5
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str.8, i64 0, i64 0), double %55, double %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"Bienvenido!\0A\0AIngrese la capacidad del deposito de agua: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [32 x i8] c"\0A\0ASe abrira la valvula? (s/n): \00"
@.str.3 = [57 x i8] c"\0AIngrese la cantidad de agua que registr\C3\B3 el contador: \00"
@.str.4 = [40 x i8] c"\0A\0ALa cantidad de agua restante es %.4f.\00"
@.str.7 = [41 x i8] c"\0A\0ASe abrira la valvula de nuevo? (s/n): \00"
@.str.8 = [136 x i8] c"\0A\0A\0AEL PROCESO HA FINALIZADO.\0ALa cantidad de agua que queda en el deposito es %.4f (representa el %.4f %% de la capacidad del deposito).\00"
@str = [23 x i8] c"\0ASituacion de cuidado.\00"
@str.9 = [19 x i8] c"\0ASituacion normal.\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = load float, float* %2
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (...) @clearIBuffer()
%10 = call signext i8 (...) @getchar()
%11 = and i8 %10, -33
%12 = icmp eq i8 %11, 83
br i1 %12, label %15, label %13
13: ; preds = %0
%14 = fpext float %7 to double
br label %37
15: ; preds = %0, %31
%16 = phi float [ %20, %31 ], [ %7, %0 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%19 = load float, float* %1
%20 = fsub float %16, %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), double %21)
%23 = fcmp oge float %20, 1.150000e+03
%24 = fcmp ole float %20, 1.500000e+03
%25 = and i1 %23, %24
br i1 %25, label %28, label %26
26: ; preds = %15
%27 = fcmp olt float %20, 1.150000e+03
br i1 %27, label %28, label %31
28: ; preds = %26, %15
%29 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.9, i64 0, i64 0), %15 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0), %26 ]
%30 = call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %28, %26
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 (...) @clearIBuffer()
%34 = call signext i8 (...) @getchar()
%35 = and i8 %34, -33
%36 = icmp eq i8 %35, 83
br i1 %36, label %15, label %37
37: ; preds = %31, %13
%38 = phi double [ %14, %13 ], [ %21, %31 ]
%39 = phi float [ %7, %13 ], [ %20, %31 ]
%40 = load float, float* %2
%41 = fdiv float %39, %40
%42 = fmul float %41, 1.000000e+02
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([136 x i8], [136 x i8]* @.str.8, i64 0, i64 0), double %38, double %43)
ret i32 0
}