#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 calculo(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int n, i = 0;
  float precio, resultado = 0;
  printf("Ingrese la cantidad de precios: ");
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    do {
      printf("Precio: ");
      scanf("%f", &precio);
    } while (precio < 0);
    resultado = calculo(precio);
    if (precio < 50)
      printf(" El precio actualizado es %.2f\tel porcentaje aplicado es 20\%\n",
             resultado);
    else if (precio >= 50 && precio < 100)
      printf("El precio actualizado es %.2f\tel porcentaje aplicado es 15\%\n",
             resultado);
    else
      printf("El precio actualizado es %.2f\tel porcentaje aplicado es 10\%\n",
             resultado);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1263 <main+0x133>
jmp    1186 <main+0x56>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
ja     1186 <main+0x56>
movss  -0x10(%rbp),%xmm0
call   1030 <calculo@plt>
movss  %xmm0,-0x14(%rbp)
movss  0xe36(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11f0 <main+0xc0>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1250 <main+0x120>
movss  -0x10(%rbp),%xmm0
movss  0xe03(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1234 <main+0x104>
movss  0xdf6(%rip),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1234 <main+0x104>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    124b <main+0x11b>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1250 <main+0x120>
jmp    1255 <main+0x125>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1175 <main+0x45>
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
push   %rax
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    120f <main+0xdf>
lea    0xec2(%rip),%r14
lea    0xec4(%rip),%r15
mov    %rsp,%rbx
lea    0xebd(%rip),%r12
lea    0xf31(%rip),%rbp
xor    %r13d,%r13d
jmp    11b0 <main+0x80>
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r13d
cmp    0x4(%rsp),%r13d
jge    120f <main+0xdf>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     11b0 <main+0x80>
call   1030 <calculo@plt>
movss  (%rsp),%xmm1
movss  0xe1a(%rip),%xmm2
ucomiss %xmm1,%xmm2
ja     118b <main+0x5b>
ucomiss %xmm2,%xmm1
cvtss2sd %xmm0,%xmm0
jb     120a <main+0xda>
movss  0xe08(%rip),%xmm2
ucomiss %xmm1,%xmm2
jbe    120a <main+0xda>
lea    0xe72(%rip),%rdi
jmp    1192 <main+0x62>
mov    %rbp,%rdi
jmp    1192 <main+0x62>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Ingrese la cantidad de precios: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Precio: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [62 x i8] c" El precio actualizado es %.2f\09el porcentaje aplicado es 20%\0A\00"
@.str.5 = [61 x i8] c"El precio actualizado es %.2f\09el porcentaje aplicado es 15%\0A\00"
@.str.6 = [61 x i8] c"El precio actualizado es %.2f\09el porcentaje aplicado es 10%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
store float 0.000000e+00, float* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %8
8: ; preds = %44, %0
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %47
12: ; preds = %8
br label %13
13: ; preds = %16, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
br label %16
16: ; preds = %13
%17 = load float, float* %4
%18 = fcmp olt float %17, 0.000000e+00
br i1 %18, label %13, label %19
19: ; preds = %16
%20 = load float, float* %4
%21 = call float @calculo(float %20)
store float %21, float* %5
%22 = load float, float* %4
%23 = fcmp olt float %22, 5.000000e+01
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), double %26)
br label %43
28: ; preds = %19
%29 = load float, float* %4
%30 = fcmp oge float %29, 5.000000e+01
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load float, float* %4
%33 = fcmp olt float %32, 1.000000e+02
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load float, float* %5
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), double %36)
br label %42
38: ; preds = %31, %28
%39 = load float, float* %5
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), double %40)
br label %42
42: ; preds = %38, %34
br label %43
43: ; preds = %42, %24
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %8
47: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Ingrese la cantidad de precios: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [9 x i8] c"Precio: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [62 x i8] c" El precio actualizado es %.2f\09el porcentaje aplicado es 20%\0A\00"
@.str.5 = [61 x i8] c"El precio actualizado es %.2f\09el porcentaje aplicado es 15%\0A\00"
@.str.6 = [61 x i8] c"El precio actualizado es %.2f\09el porcentaje aplicado es 10%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = bitcast i32* %1 to i8*
%4 = bitcast float* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %36
9: ; preds = %0, %32
%10 = phi i32 [ %33, %32 ], [ 0, %0 ]
br label %11
11: ; preds = %9, %11
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%14 = load float, float* %2
%15 = fcmp olt float %14, 0.000000e+00
br i1 %15, label %11, label %16
16: ; preds = %11
%17 = call float @calculo(float %14)
%18 = load float, float* %2
%19 = fcmp olt float %18, 5.000000e+01
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = fpext float %17 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.4, i64 0, i64 0), double %21)
br label %32
23: ; preds = %16
%24 = fcmp oge float %18, 5.000000e+01
%25 = fcmp olt float %18, 1.000000e+02
%26 = and i1 %24, %25
%27 = fpext float %17 to double
br i1 %26, label %28, label %30
28: ; preds = %23
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), double %27)
br label %32
30: ; preds = %23
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0), double %27)
br label %32
32: ; preds = %20, %30, %28
%33 = add nuw nsw i32 %10, 1
%34 = load i32, i32* %1
%35 = icmp slt i32 %33, %34
br i1 %35, label %9, label %36
36: ; preds = %32, %0
ret i32 0
}