#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 */
double sqrt(int);
double overflow(double x, double y) {
  double t;
  if (x > y) {
    t = y / x;
    return (x * sqrt(1 + t * t));
  }
  t = x / y;
  return (y * sqrt(1 + t * t));
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1184 <overflow+0x74>
movsd  -0x18(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d1 <overflow+0xc1>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
push   %rax
ucomisd %xmm1,%xmm0
jbe    1132 <overflow+0x22>
movsd  %xmm0,(%rsp)
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
addsd  0xed4(%rip),%xmm1
movapd %xmm1,%xmm0
jmp    1147 <overflow+0x37>
divsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
addsd  0xebe(%rip),%xmm0
movsd  %xmm1,(%rsp)
cvttsd2si %xmm0,%edi
call   1030 <sqrt@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @overflow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp ogt double %7, %8
br i1 %9, label %10, label %21
10: ; preds = %2
%11 = load double, double* %5
%12 = load double, double* %4
%13 = fdiv double %11, %12
store double %13, double* %6
%14 = load double, double* %4
%15 = load double, double* %6
%16 = load double, double* %6
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = fptosi double %17 to i32
%19 = call double @sqrt(i32 %18)
%20 = fmul double %14, %19
store double %20, double* %3
br label %32
21: ; preds = %2
%22 = load double, double* %4
%23 = load double, double* %5
%24 = fdiv double %22, %23
store double %24, double* %6
%25 = load double, double* %5
%26 = load double, double* %6
%27 = load double, double* %6
%28 = call double @llvm.fmuladd.f64(double %26, double %27, double 1.000000e+00)
%29 = fptosi double %28 to i32
%30 = call double @sqrt(i32 %29)
%31 = fmul double %25, %30
store double %31, double* %3
br label %32
32: ; preds = %21, %10
%33 = load double, double* %3
ret double %33
}

LLVM IR (-O2):
define double @overflow(double %0, double %1) {
%3 = fcmp ogt double %0, %1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fdiv double %1, %0
%6 = tail call double @llvm.fmuladd.f64(double %5, double %5, double 1.000000e+00)
br label %10
7: ; preds = %2
%8 = fdiv double %0, %1
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double 1.000000e+00)
br label %10
10: ; preds = %7, %4
%11 = phi double [ %9, %7 ], [ %6, %4 ]
%12 = phi double [ %1, %7 ], [ %0, %4 ]
%13 = fptosi double %11 to i32
%14 = tail call double @sqrt(i32 %13)
%15 = fmul double %14, %12
ret double %15
}