#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, int, double);
double sqrt(double);
int main() {
  FILE *fin = fopen("crease.in", "r");
  int times;
  fscanf(fin, "%d", &times);
  int t;
  for (t = 1; t <= times; t++) {
    double a, b;
    fscanf(fin, "%lf %lf", &a, &b);
    if (a > b) {
      double temp = a;
      a = b;
      b = temp;
    }
    double diagonal = sqrt(a * a + b * b);
    double crease = (a * diagonal) / b;
    printf("Crease #%d: %.2f\n", t, crease);
  }
  fclose(fin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8b(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1243 <main+0xf3>
mov    -0x10(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    11e7 <main+0x97>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x38(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%esi
movsd  -0x40(%rbp),%xmm0
lea    0xde7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1193 <main+0x43>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
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    $0x18,%rsp
lea    0xea3(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xe99(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <fscanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    124e <main+0xfe>
lea    0xe7b(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0xe72(%rip),%r13
xor    %ebp,%ebp
jmp    11e1 <main+0x91>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1070 <sqrt@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
mov    %r13,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
cmp    0x4(%rsp),%ebp
jge    124e <main+0xfe>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <fscanf@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
ucomisd %xmm0,%xmm2
jbe    1220 <main+0xd0>
movsd  %xmm0,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm1
jmp    1228 <main+0xd8>
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm1
movapd %xmm2,%xmm0
add    $0x1,%ebp
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xdc1(%rip),%xmm0
jb     11c0 <main+0x70>
sqrtsd %xmm0,%xmm0
jmp    11c5 <main+0x75>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"crease.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [18 x i8] c"Crease #%d: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = load i32*, i32** %2
%12 = call i32 (i32*, i8*, ...) @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %13
13: ; preds = %43, %0
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp sle i32 %14, %15
br i1 %16, label %17, label %46
17: ; preds = %13
%18 = load i32*, i32** %2
%19 = call i32 (i32*, i8*, ...) @fscanf(i32* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %5, double* %6)
%20 = load double, double* %5
%21 = load double, double* %6
%22 = fcmp ogt double %20, %21
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = load double, double* %5
store double %24, double* %7
%25 = load double, double* %6
store double %25, double* %5
%26 = load double, double* %7
store double %26, double* %6
br label %27
27: ; preds = %23, %17
%28 = load double, double* %5
%29 = load double, double* %5
%30 = load double, double* %6
%31 = load double, double* %6
%32 = fmul double %30, %31
%33 = call double @llvm.fmuladd.f64(double %28, double %29, double %32)
%34 = call double @sqrt(double %33)
store double %34, double* %8
%35 = load double, double* %5
%36 = load double, double* %8
%37 = fmul double %35, %36
%38 = load double, double* %6
%39 = fdiv double %37, %38
store double %39, double* %9
%40 = load i32, i32* %4
%41 = load double, double* %9
%42 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %40, double %41)
br label %43
43: ; preds = %27
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %13
46: ; preds = %13
%47 = load i32*, i32** %2
%48 = call i32 @fclose(i32* %47)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"crease.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [8 x i8] c"%lf %lf\00"
@.str.4 = [18 x i8] c"Crease #%d: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = call i32 (i32*, i8*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %33, label %9
9: ; preds = %0
%10 = bitcast double* %2 to i8*
%11 = bitcast double* %3 to i8*
br label %12
12: ; preds = %9, %19
%13 = phi i32 [ 1, %9 ], [ %30, %19 ]
%14 = call i32 (i32*, i8*, ...) @fscanf(i32* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), double* %2, double* %3)
%15 = load double, double* %2
%16 = load double, double* %3
%17 = fcmp ogt double %15, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store double %16, double* %2
store double %15, double* %3
br label %19
19: ; preds = %18, %12
%20 = phi double [ %15, %18 ], [ %16, %12 ]
%21 = phi double [ %16, %18 ], [ %15, %12 ]
%22 = fmul double %20, %20
%23 = call double @llvm.fmuladd.f64(double %21, double %21, double %22)
%24 = call double @sqrt(double %23)
%25 = load double, double* %2
%26 = fmul double %24, %25
%27 = load double, double* %3
%28 = fdiv double %26, %27
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %13, double %28)
%30 = add nuw nsw i32 %13, 1
%31 = load i32, i32* %1
%32 = icmp slt i32 %13, %31
br i1 %32, label %12, label %33
33: ; preds = %19, %0
%34 = call i32 @fclose(i32* %4)
ret i32 0
}