#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*/ printf(char *, int, double, double);
int scanf(char *, ...);
double sqrt(double);
int main() {
  int n, i = 1;
  double u, v, a, t, s;
  while (scanf("%d", &n) == 1) {
    if (n == 0)
      break;
    else if (n == 1) {
      scanf("%lf %lf %lf", &u, &v, &t);
      s = ((u + v) / 2.0) * t;
      a = ((v - u) / t);
      printf("Case %d: %.3lf %.3lf\n", i, s, a);
    } else if (n == 2) {
      scanf("%lf %lf %lf", &u, &v, &a);
      t = ((v - u) / a);
      s = ((u + v) / 2.0) * t;
      printf("Case %d: %.3lf %.3lf\n", i, s, t);
    } else if (n == 3) {
      scanf("%lf %lf %lf", &u, &a, &s);
      v = (u * u) + (2.0 * a * s);
      v = sqrt(v);
      t = ((v - u) / a);
      printf("Case %d: %.3lf %.3lf\n", i, v, t);
    } else if (n == 4) {
      scanf("%lf %lf %lf", &v, &a, &s);
      u = (v * v) - (2.0 * a * s);
      u = sqrt(u);
      t = ((v - u) / a);
      printf("Case %d: %.3lf %.3lf\n", i, u, t);
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xebb(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    13ac <main+0x27c>
cmpl   $0x0,-0x8(%rbp)
jne    1170 <main+0x40>
jmp    13ac <main+0x27c>
cmpl   $0x1,-0x8(%rbp)
jne    11e6 <main+0xb6>
lea    0xe8a(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xe5a(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    1399 <main+0x269>
cmpl   $0x2,-0x8(%rbp)
jne    125c <main+0x12c>
lea    0xe14(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xdd0(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xdc5(%rip),%rdi
call   1030 <printf@plt>
jmp    1394 <main+0x264>
cmpl   $0x3,-0x8(%rbp)
jne    12ea <main+0x1ba>
lea    0xd9e(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x38(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xd6e(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xd37(%rip),%rdi
call   1030 <printf@plt>
jmp    138f <main+0x25f>
cmpl   $0x4,-0x8(%rbp)
jne    138a <main+0x25a>
lea    0xd10(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x38(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xce0(%rip),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  -0x38(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
lea    0xc92(%rip),%rdi
call   1030 <printf@plt>
jmp    138f <main+0x25f>
jmp    1394 <main+0x264>
jmp    1399 <main+0x269>
jmp    139e <main+0x26e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xee3(%rip),%rdi
lea    0x24(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    135e <main+0x22e>
mov    0x24(%rsp),%eax
test   %eax,%eax
je     135e <main+0x22e>
mov    $0x1,%ebx
lea    0xeb6(%rip),%r14
lea    0x24(%rsp),%r15
lea    0xe9a(%rip),%rbp
lea    0xea6(%rip),%r12
lea    0xeab(%rip),%r13
nopl   0x0(%rax)
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     133d <main+0x20d>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x30(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
movapd %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe2d(%rip),%xmm0
movsd  0x30(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x28(%rsp)
subsd  %xmm2,%xmm1
divsd  %xmm3,%xmm1
movsd  %xmm1,0x8(%rsp)
jmp    1333 <main+0x203>
xchg   %ax,%ax
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
movapd %xmm0,%xmm1
subsd  %xmm2,%xmm1
divsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x30(%rsp)
addsd  %xmm2,%xmm0
mulsd  0xdc3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
jmp    1333 <main+0x203>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x28(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd71(%rip),%xmm0
jb     12fb <main+0x1cb>
sqrtsd %xmm0,%xmm0
jmp    1300 <main+0x1d0>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x28(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xd23(%rip),%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd1d(%rip),%xmm0
jb     1312 <main+0x1e2>
sqrtsd %xmm0,%xmm0
jmp    1317 <main+0x1e7>
call   1050 <sqrt@plt>
movapd %xmm0,%xmm1
subsd  0x18(%rsp),%xmm1
movsd  %xmm0,0x10(%rsp)
jmp    1327 <main+0x1f7>
call   1050 <sqrt@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x8(%rsp),%xmm1
movsd  %xmm1,0x30(%rsp)
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    135e <main+0x22e>
add    $0x1,%ebx
mov    0x24(%rsp),%eax
test   %eax,%eax
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [22 x i8] c"Case %d: %.3lf %.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store i32 1, i32* %3
br label %9
9: ; preds = %107, %0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %110
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
br label %110
16: ; preds = %12
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %36
19: ; preds = %16
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %5, double* %7)
%21 = load double, double* %4
%22 = load double, double* %5
%23 = fadd double %21, %22
%24 = fdiv double %23, 2.000000e+00
%25 = load double, double* %7
%26 = fmul double %24, %25
store double %26, double* %8
%27 = load double, double* %5
%28 = load double, double* %4
%29 = fsub double %27, %28
%30 = load double, double* %7
%31 = fdiv double %29, %30
store double %31, double* %6
%32 = load i32, i32* %3
%33 = load double, double* %8
%34 = load double, double* %6
%35 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %32, double %33, double %34)
br label %106
36: ; preds = %16
%37 = load i32, i32* %2
%38 = icmp eq i32 %37, 2
br i1 %38, label %39, label %56
39: ; preds = %36
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %5, double* %6)
%41 = load double, double* %5
%42 = load double, double* %4
%43 = fsub double %41, %42
%44 = load double, double* %6
%45 = fdiv double %43, %44
store double %45, double* %7
%46 = load double, double* %4
%47 = load double, double* %5
%48 = fadd double %46, %47
%49 = fdiv double %48, 2.000000e+00
%50 = load double, double* %7
%51 = fmul double %49, %50
store double %51, double* %8
%52 = load i32, i32* %3
%53 = load double, double* %8
%54 = load double, double* %7
%55 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %52, double %53, double %54)
br label %105
56: ; preds = %36
%57 = load i32, i32* %2
%58 = icmp eq i32 %57, 3
br i1 %58, label %59, label %79
59: ; preds = %56
%60 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %6, double* %8)
%61 = load double, double* %4
%62 = load double, double* %4
%63 = load double, double* %6
%64 = fmul double 2.000000e+00, %63
%65 = load double, double* %8
%66 = fmul double %64, %65
%67 = call double @llvm.fmuladd.f64(double %61, double %62, double %66)
store double %67, double* %5
%68 = load double, double* %5
%69 = call double @sqrt(double %68)
store double %69, double* %5
%70 = load double, double* %5
%71 = load double, double* %4
%72 = fsub double %70, %71
%73 = load double, double* %6
%74 = fdiv double %72, %73
store double %74, double* %7
%75 = load i32, i32* %3
%76 = load double, double* %5
%77 = load double, double* %7
%78 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %75, double %76, double %77)
br label %104
79: ; preds = %56
%80 = load i32, i32* %2
%81 = icmp eq i32 %80, 4
br i1 %81, label %82, label %103
82: ; preds = %79
%83 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6, double* %8)
%84 = load double, double* %5
%85 = load double, double* %5
%86 = load double, double* %6
%87 = fmul double 2.000000e+00, %86
%88 = load double, double* %8
%89 = fmul double %87, %88
%90 = fneg double %89
%91 = call double @llvm.fmuladd.f64(double %84, double %85, double %90)
store double %91, double* %4
%92 = load double, double* %4
%93 = call double @sqrt(double %92)
store double %93, double* %4
%94 = load double, double* %5
%95 = load double, double* %4
%96 = fsub double %94, %95
%97 = load double, double* %6
%98 = fdiv double %96, %97
store double %98, double* %7
%99 = load i32, i32* %3
%100 = load double, double* %4
%101 = load double, double* %7
%102 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %99, double %100, double %101)
br label %103
103: ; preds = %82, %79
br label %104
104: ; preds = %103, %59
br label %105
105: ; preds = %104, %39
br label %106
106: ; preds = %105, %19
br label %107
107: ; preds = %106
%108 = load i32, i32* %3
%109 = add nsw i32 %108, 1
store i32 %109, i32* %3
br label %9
110: ; preds = %15, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%lf %lf %lf\00"
@.str.2 = [22 x i8] c"Case %d: %.3lf %.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast i32* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = icmp ne i32 %13, 1
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 0
%17 = select i1 %14, i1 true, i1 %16
br i1 %17, label %78, label %18
18: ; preds = %0, %71
%19 = phi i32 [ %75, %71 ], [ %15, %0 ]
%20 = phi i32 [ %72, %71 ], [ 1, %0 ]
switch i32 %19, label %71 [
i32 1, label %21
i32 2, label %32
i32 3, label %43
i32 4, label %57
]
21: ; preds = %18
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %5)
%23 = load double, double* %2
%24 = load double, double* %3
%25 = fadd double %23, %24
%26 = fmul double %25, 5.000000e-01
%27 = load double, double* %5
%28 = fmul double %27, %26
store double %28, double* %6
%29 = fsub double %24, %23
%30 = fdiv double %29, %27
store double %30, double* %4
%31 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %20, double %28, double %30)
br label %71
32: ; preds = %18
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3, double* %4)
%34 = load double, double* %3
%35 = load double, double* %2
%36 = fsub double %34, %35
%37 = load double, double* %4
%38 = fdiv double %36, %37
store double %38, double* %5
%39 = fadd double %34, %35
%40 = fmul double %39, 5.000000e-01
%41 = fmul double %40, %38
store double %41, double* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %20, double %41, double %38)
br label %71
43: ; preds = %18
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %4, double* %6)
%45 = load double, double* %2
%46 = load double, double* %4
%47 = fmul double %46, 2.000000e+00
%48 = load double, double* %6
%49 = fmul double %47, %48
%50 = call double @llvm.fmuladd.f64(double %45, double %45, double %49)
%51 = call double @sqrt(double %50)
store double %51, double* %3
%52 = load double, double* %2
%53 = fsub double %51, %52
%54 = load double, double* %4
%55 = fdiv double %53, %54
store double %55, double* %5
%56 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %20, double %51, double %55)
br label %71
57: ; preds = %18
%58 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4, double* %6)
%59 = load double, double* %3
%60 = load double, double* %4
%61 = load double, double* %6
%62 = fmul double %60, -2.000000e+00
%63 = fmul double %62, %61
%64 = call double @llvm.fmuladd.f64(double %59, double %59, double %63)
%65 = call double @sqrt(double %64)
store double %65, double* %2
%66 = load double, double* %3
%67 = fsub double %66, %65
%68 = load double, double* %4
%69 = fdiv double %67, %68
store double %69, double* %5
%70 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %20, double %65, double %69)
br label %71
71: ; preds = %18, %21, %43, %57, %32
%72 = add nuw nsw i32 %20, 1
%73 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%74 = icmp ne i32 %73, 1
%75 = load i32, i32* %1
%76 = icmp eq i32 %75, 0
%77 = select i1 %74, i1 true, i1 %76
br i1 %77, label %78, label %18
78: ; preds = %71, %0
ret i32 0
}