#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*/ die(char *);
scalar_t__ pow(double, int);
double sqrt(scalar_t__);
double hypotenuse(double side0, double side1) {
  double retVal;
  if ((side0 < 0) || (side1 < 0))
    die("Legs cannot be negative.\n");
  retVal = sqrt(pow(side0, 2) + pow(side1, 2));
  return retVal;
}


x86 assembly (clang, -O0):
<hypotenuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     115e <hypotenuse+0x2e>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116a <hypotenuse+0x3a>
lea    0xe9b(%rip),%rdi
call   1030 <die@plt>
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hypotenuse>:
push   %rbx
sub    $0x10,%rsp
xorpd  %xmm2,%xmm2
ucomisd %xmm0,%xmm2
movsd  %xmm1,0x8(%rsp)
ja     114b <hypotenuse+0x1b>
ucomisd %xmm1,%xmm2
jbe    1161 <hypotenuse+0x31>
lea    0xeae(%rip),%rdi
movsd  %xmm0,(%rsp)
call   1030 <die@plt>
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <sqrt@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Legs cannot be negative.\0A\00"
define double @hypotenuse(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = fcmp olt double %6, 0.000000e+00
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load double, double* %4
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = load double, double* %3
%15 = call i64 @pow(double %14, i32 2)
%16 = load double, double* %4
%17 = call i64 @pow(double %16, i32 2)
%18 = add nsw i64 %15, %17
%19 = call double @sqrt(i64 %18)
store double %19, double* %5
%20 = load double, double* %5
ret double %20
}

LLVM IR (-O2):
@.str = [26 x i8] c"Legs cannot be negative.\0A\00"
define double @hypotenuse(double %0, double %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fcmp olt double %1, 0.000000e+00
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @die(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = tail call i64 @pow(double %0, i32 2)
%10 = tail call i64 @pow(double %1, i32 2)
%11 = add nsw i64 %10, %9
%12 = tail call double @sqrt(i64 %11)
ret double %12
}