#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 FLT_MAX;
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int n;
  scanf("%d", &n);
  float min = FLT_MAX;
  float max = -FLT_MAX;
  for (int i = 0; i < n; ++i) {
    int people, kms;
    scanf("%d %d", &people, &kms);
    int pricePerKm = kms < 500 ? 50 : 80;
    float price = kms * pricePerKm / (float)people;
    if (price > max) {
      max = price;
    }
    if (price < min) {
      min = price;
    }
  }
  printf("Custo minimo %.2f\n", min);
  printf("Custo maximo %.2f\n", max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2ea0(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    0x2e90(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1212 <main+0xf2>
lea    0xe78(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%edx
mov    $0x50,%eax
mov    $0x32,%ecx
cmp    $0x1f4,%edx
cmovl  %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x20(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    11e2 <main+0xc2>
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x24(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11ff <main+0xdf>
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1204 <main+0xe4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1175 <main+0x55>
movss  -0xc(%rbp),%xmm0
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rax
movss  (%rax),%xmm1
movaps 0xeaf(%rip),%xmm2
xorps  %xmm1,%xmm2
cmpl   $0x0,0x4(%rsp)
jle    11e2 <main+0xc2>
lea    0xeaa(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r12
mov    $0x32,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movaps %xmm2,0x20(%rsp)
movaps %xmm1,0x10(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x1f4,%eax
mov    $0x50,%ecx
cmovl  %ebp,%ecx
imul   %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ssl 0xc(%rsp),%xmm1
divss  %xmm1,%xmm0
movaps %xmm0,%xmm3
maxss  0x20(%rsp),%xmm3
minss  0x10(%rsp),%xmm0
add    $0x1,%ebx
movaps %xmm0,%xmm1
movaps %xmm3,%xmm2
cmp    0x4(%rsp),%ebx
jl     1180 <main+0x60>
jmp    11e8 <main+0xc8>
movaps %xmm2,%xmm3
movaps %xmm1,%xmm0
movss  %xmm3,0x10(%rsp)
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
movss  0x10(%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@FLT_MAX = global float 0.000000e+00
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [19 x i8] c"Custo minimo %.2f\0A\00"
@.str.3 = [19 x i8] c"Custo maximo %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
store i32 0, i32* %1
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load float, float* @FLT_MAX
store float %11, float* %3
%12 = load float, float* @FLT_MAX
%13 = fneg float %12
store float %13, float* %4
store i32 0, i32* %5
br label %14
14: ; preds = %43, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %46
18: ; preds = %14
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 500
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 50, i32 80
store i32 %23, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = mul nsw i32 %24, %25
%27 = sitofp i32 %26 to float
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to float
%30 = fdiv float %27, %29
store float %30, float* %9
%31 = load float, float* %9
%32 = load float, float* %4
%33 = fcmp ogt float %31, %32
br i1 %33, label %34, label %36
34: ; preds = %18
%35 = load float, float* %9
store float %35, float* %4
br label %36
36: ; preds = %34, %18
%37 = load float, float* %9
%38 = load float, float* %3
%39 = fcmp olt float %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load float, float* %9
store float %41, float* %3
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %14
46: ; preds = %14
%47 = load float, float* %3
%48 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), float %47)
%49 = load float, float* %4
%50 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), float %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@FLT_MAX = global float 0.000000e+00
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [19 x i8] c"Custo minimo %.2f\0A\00"
@.str.3 = [19 x i8] c"Custo maximo %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load float, float* @FLT_MAX
%7 = fneg float %6
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
br label %18
13: ; preds = %18, %0
%14 = phi float [ %7, %0 ], [ %32, %18 ]
%15 = phi float [ %6, %0 ], [ %34, %18 ]
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), float %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), float %14)
ret i32 0
18: ; preds = %10, %18
%19 = phi float [ %6, %10 ], [ %34, %18 ]
%20 = phi float [ %7, %10 ], [ %32, %18 ]
%21 = phi i32 [ 0, %10 ], [ %35, %18 ]
%22 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 500
%25 = select i1 %24, i32 50, i32 80
%26 = mul nsw i32 %25, %23
%27 = sitofp i32 %26 to float
%28 = load i32, i32* %2
%29 = sitofp i32 %28 to float
%30 = fdiv float %27, %29
%31 = fcmp ogt float %30, %20
%32 = select i1 %31, float %30, float %20
%33 = fcmp olt float %30, %19
%34 = select i1 %33, float %30, float %19
%35 = add nuw nsw i32 %21, 1
%36 = load i32, i32* %1
%37 = icmp slt i32 %35, %36
br i1 %37, label %18, label %13
}