#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 /*<<< orphan*/ scanf(char *, ...);
double sqrt(double);
int main() {
  double b, c, d, u, v, a, t, s;
  int i, j, n;
  i = 1;
  while (1) {
    scanf("%d", &n);
    if (n == 0) {
      break;
    } else
      scanf("%lf %lf %lf", &b, &c, &d);
    if (n == 1) {
      u = b;
      v = c;
      t = d;
      a = (v - u) / t;
      s = u * t + .5 * a * t * t;
      printf("Case %d: %.3lf %.3lf\n", i, s, a);
    } else if (n == 2) {
      u = b;
      v = c;
      a = d;
      t = (v - u) / a;
      s = u * t + .5 * a * t * t;
      printf("Case %d: %.3lf %.3lf\n", i, s, t);
    } else if (n == 3) {
      u = b;
      a = c;
      s = d;
      v = sqrt(u * u + 2 * a * s);
      t = (v - u) / a;
      printf("Case %d: %.3lf %.3lf\n", i, v, t);
    } else if (n == 4) {
      v = b;
      a = c;
      s = d;
      u = sqrt(v * v - 2 * a * s);
      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    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x54(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x54(%rbp)
jne    1167 <main+0x37>
jmp    13d0 <main+0x2a0>
lea    0xea5(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x54(%rbp)
jne    1209 <main+0xd9>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0xe39(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x4c(%rbp),%esi
movsd  -0x48(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
jmp    13c2 <main+0x292>
cmpl   $0x2,-0x54(%rbp)
jne    1291 <main+0x161>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  0xdb1(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x4c(%rbp),%esi
movsd  -0x48(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    0xd98(%rip),%rdi
call   1030 <printf@plt>
jmp    13bd <main+0x28d>
cmpl   $0x3,-0x54(%rbp)
jne    1319 <main+0x1e9>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  0xd35(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4c(%rbp),%esi
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    0xd10(%rip),%rdi
call   1030 <printf@plt>
jmp    13b8 <main+0x288>
cmpl   $0x4,-0x54(%rbp)
jne    13b3 <main+0x283>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  0xcad(%rip),%xmm1
mulsd  -0x38(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4c(%rbp),%esi
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
lea    0xc71(%rip),%rdi
call   1030 <printf@plt>
jmp    13b8 <main+0x288>
jmp    13bd <main+0x28d>
jmp    13c2 <main+0x292>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x60,%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    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     1322 <main+0x1f2>
mov    $0x1,%ebx
lea    0x18(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xeb6(%rip),%rbp
lea    0xc(%rsp),%r14
lea    0xe9a(%rip),%r15
jmp    11db <main+0xab>
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
mulsd  0xe66(%rip),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
lea    0xe7e(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     1322 <main+0x1f2>
lea    0xe49(%rip),%rdi
lea    0x20(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11c0 <main+0x90>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
movsd  0x20(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm3
mulsd  0xdd9(%rip),%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
jmp    11b2 <main+0x82>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x20(%rsp),%xmm3
movsd  0x18(%rsp),%xmm2
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
mulsd  0x10(%rsp),%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xd92(%rip),%xmm0
jb     12ca <main+0x19a>
sqrtsd %xmm0,%xmm0
jmp    12e7 <main+0x1b7>
cs nopw 0x0(%rax,%rax,1)
movsd  0x20(%rsp),%xmm1
movsd  0x18(%rsp),%xmm3
movapd %xmm3,%xmm2
mulsd  0xd58(%rip),%xmm2
mulsd  0x10(%rsp),%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
ucomisd 0xd4e(%rip),%xmm0
jb     12f8 <main+0x1c8>
sqrtsd %xmm0,%xmm0
jmp    1315 <main+0x1e5>
movsd  %xmm2,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
call   1050 <sqrt@plt>
movsd  0x28(%rsp),%xmm3
movsd  0x30(%rsp),%xmm2
movapd %xmm0,%xmm1
subsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
jmp    11b2 <main+0x82>
movsd  %xmm1,0x30(%rsp)
movsd  %xmm3,0x28(%rsp)
call   1050 <sqrt@plt>
movsd  0x28(%rsp),%xmm3
movsd  0x30(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  %xmm3,%xmm1
jmp    11b2 <main+0x82>
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 double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %10
br label %13
13: ; preds = %0, %122
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%15 = load i32, i32* %12
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
br label %125
18: ; preds = %13
%19 = 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)
br label %20
20: ; preds = %18
%21 = load i32, i32* %12
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %45
23: ; preds = %20
%24 = load double, double* %2
store double %24, double* %5
%25 = load double, double* %3
store double %25, double* %6
%26 = load double, double* %4
store double %26, double* %8
%27 = load double, double* %6
%28 = load double, double* %5
%29 = fsub double %27, %28
%30 = load double, double* %8
%31 = fdiv double %29, %30
store double %31, double* %7
%32 = load double, double* %5
%33 = load double, double* %8
%34 = load double, double* %7
%35 = fmul double 5.000000e-01, %34
%36 = load double, double* %8
%37 = fmul double %35, %36
%38 = load double, double* %8
%39 = fmul double %37, %38
%40 = call double @llvm.fmuladd.f64(double %32, double %33, double %39)
store double %40, double* %9
%41 = load i32, i32* %10
%42 = load double, double* %9
%43 = load double, double* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %41, double %42, double %43)
br label %122
45: ; preds = %20
%46 = load i32, i32* %12
%47 = icmp eq i32 %46, 2
br i1 %47, label %48, label %70
48: ; preds = %45
%49 = load double, double* %2
store double %49, double* %5
%50 = load double, double* %3
store double %50, double* %6
%51 = load double, double* %4
store double %51, double* %7
%52 = load double, double* %6
%53 = load double, double* %5
%54 = fsub double %52, %53
%55 = load double, double* %7
%56 = fdiv double %54, %55
store double %56, double* %8
%57 = load double, double* %5
%58 = load double, double* %8
%59 = load double, double* %7
%60 = fmul double 5.000000e-01, %59
%61 = load double, double* %8
%62 = fmul double %60, %61
%63 = load double, double* %8
%64 = fmul double %62, %63
%65 = call double @llvm.fmuladd.f64(double %57, double %58, double %64)
store double %65, double* %9
%66 = load i32, i32* %10
%67 = load double, double* %9
%68 = load double, double* %8
%69 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %66, double %67, double %68)
br label %121
70: ; preds = %45
%71 = load i32, i32* %12
%72 = icmp eq i32 %71, 3
br i1 %72, label %73, label %94
73: ; preds = %70
%74 = load double, double* %2
store double %74, double* %5
%75 = load double, double* %3
store double %75, double* %7
%76 = load double, double* %4
store double %76, double* %9
%77 = load double, double* %5
%78 = load double, double* %5
%79 = load double, double* %7
%80 = fmul double 2.000000e+00, %79
%81 = load double, double* %9
%82 = fmul double %80, %81
%83 = call double @llvm.fmuladd.f64(double %77, double %78, double %82)
%84 = call double @sqrt(double %83)
store double %84, double* %6
%85 = load double, double* %6
%86 = load double, double* %5
%87 = fsub double %85, %86
%88 = load double, double* %7
%89 = fdiv double %87, %88
store double %89, double* %8
%90 = load i32, i32* %10
%91 = load double, double* %6
%92 = load double, double* %8
%93 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %90, double %91, double %92)
br label %120
94: ; preds = %70
%95 = load i32, i32* %12
%96 = icmp eq i32 %95, 4
br i1 %96, label %97, label %119
97: ; preds = %94
%98 = load double, double* %2
store double %98, double* %6
%99 = load double, double* %3
store double %99, double* %7
%100 = load double, double* %4
store double %100, double* %9
%101 = load double, double* %6
%102 = load double, double* %6
%103 = load double, double* %7
%104 = fmul double 2.000000e+00, %103
%105 = load double, double* %9
%106 = fmul double %104, %105
%107 = fneg double %106
%108 = call double @llvm.fmuladd.f64(double %101, double %102, double %107)
%109 = call double @sqrt(double %108)
store double %109, double* %5
%110 = load double, double* %6
%111 = load double, double* %5
%112 = fsub double %110, %111
%113 = load double, double* %7
%114 = fdiv double %112, %113
store double %114, double* %8
%115 = load i32, i32* %10
%116 = load double, double* %5
%117 = load double, double* %8
%118 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %115, double %116, double %117)
br label %119
119: ; preds = %97, %94
br label %120
120: ; preds = %119, %73
br label %121
121: ; preds = %120, %48
br label %122
122: ; preds = %121, %23
%123 = load i32, i32* %10
%124 = add nsw i32 %123, 1
store i32 %124, i32* %10
br label %13
125: ; preds = %17
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 double
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 0
br i1 %11, label %65, label %12
12: ; preds = %0, %60
%13 = phi i32 [ %61, %60 ], [ 1, %0 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2, double* %3)
%15 = load i32, i32* %4
switch i32 %15, label %60 [
i32 1, label %16
i32 2, label %27
i32 3, label %38
i32 4, label %49
]
16: ; preds = %12
%17 = load double, double* %1
%18 = load double, double* %2
%19 = load double, double* %3
%20 = fsub double %18, %17
%21 = fdiv double %20, %19
%22 = fmul double %21, 5.000000e-01
%23 = fmul double %19, %22
%24 = fmul double %19, %23
%25 = call double @llvm.fmuladd.f64(double %17, double %19, double %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %25, double %21)
br label %60
27: ; preds = %12
%28 = load double, double* %1
%29 = load double, double* %2
%30 = load double, double* %3
%31 = fsub double %29, %28
%32 = fdiv double %31, %30
%33 = fmul double %30, 5.000000e-01
%34 = fmul double %33, %32
%35 = fmul double %32, %34
%36 = call double @llvm.fmuladd.f64(double %28, double %32, double %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %36, double %32)
br label %60
38: ; preds = %12
%39 = load double, double* %1
%40 = load double, double* %2
%41 = load double, double* %3
%42 = fmul double %40, 2.000000e+00
%43 = fmul double %42, %41
%44 = call double @llvm.fmuladd.f64(double %39, double %39, double %43)
%45 = call double @sqrt(double %44)
%46 = fsub double %45, %39
%47 = fdiv double %46, %40
%48 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %45, double %47)
br label %60
49: ; preds = %12
%50 = load double, double* %1
%51 = load double, double* %2
%52 = load double, double* %3
%53 = fmul double %51, -2.000000e+00
%54 = fmul double %53, %52
%55 = call double @llvm.fmuladd.f64(double %50, double %50, double %54)
%56 = call double @sqrt(double %55)
%57 = fsub double %50, %56
%58 = fdiv double %57, %51
%59 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %56, double %58)
br label %60
60: ; preds = %12, %27, %49, %38, %16
%61 = add nuw nsw i32 %13, 1
%62 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%63 = load i32, i32* %4
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %12
65: ; preds = %60, %0
ret i32 0
}