#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 /*<<< orphan*/ scanf(char *, float *);
float sqrt(float);
main() {
  float a, b, c, h, e;
  printf("Enter two sides of triangle (a,b) and the height(h)\n");
  printf("a=");
  scanf("%f", &a);
  printf("b=");
  scanf("%f", &b);
  printf("h=");
  scanf("%f", &h);
  e = (a * a - h * h) + (b * b - h * h);
  c = sqrt(e);
  if (a < b + c && b < a + c && c < a + b)
    printf("Third side of triangle(c) = %f", c);
  else
    printf("Triangle does not exist with third side =%f", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
mulss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm3
movss  -0x14(%rbp),%xmm2
mulss  -0x14(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1275 <main+0x145>
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1275 <main+0x145>
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1275 <main+0x145>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128c <main+0x15c>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecf(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe99(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps 0xe4a(%rip),%xmm1
xorps  %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm2
unpcklps %xmm0,%xmm2
shufps $0x0,%xmm1,%xmm1
mulps  %xmm2,%xmm2
addps  %xmm1,%xmm2
movaps %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm0
addss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11ef <main+0xaf>
sqrtss %xmm0,%xmm0
jmp    11f4 <main+0xb4>
call   1060 <sqrt@plt>
movss  0x8(%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movaps %xmm1,%xmm3
addss  %xmm2,%xmm3
ucomiss %xmm0,%xmm3
lea    0xe08(%rip),%rdi
lea    0xe20(%rip),%rax
cmovbe %rax,%rdi
movaps %xmm0,%xmm3
addss  %xmm2,%xmm3
ucomiss %xmm1,%xmm3
cmovbe %rax,%rdi
addss  %xmm0,%xmm1
ucomiss %xmm2,%xmm1
cvtss2sd %xmm0,%xmm0
cmovbe %rax,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"Enter two sides of triangle (a,b) and the height(h)\0A\00"
@.str.1 = [3 x i8] c"a=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"b=\00"
@.str.4 = [3 x i8] c"h=\00"
@.str.5 = [31 x i8] c"Third side of triangle(c) = %f\00"
@.str.6 = [44 x i8] c"Triangle does not exist with third side =%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %5)
%14 = load float, float* %2
%15 = load float, float* %2
%16 = load float, float* %5
%17 = load float, float* %5
%18 = fmul float %16, %17
%19 = fneg float %18
%20 = call float @llvm.fmuladd.f32(float %14, float %15, float %19)
%21 = load float, float* %3
%22 = load float, float* %3
%23 = load float, float* %5
%24 = load float, float* %5
%25 = fmul float %23, %24
%26 = fneg float %25
%27 = call float @llvm.fmuladd.f32(float %21, float %22, float %26)
%28 = fadd float %20, %27
store float %28, float* %6
%29 = load float, float* %6
%30 = call float @sqrt(float %29)
store float %30, float* %4
%31 = load float, float* %2
%32 = load float, float* %3
%33 = load float, float* %4
%34 = fadd float %32, %33
%35 = fcmp olt float %31, %34
br i1 %35, label %36, label %52
36: ; preds = %0
%37 = load float, float* %3
%38 = load float, float* %2
%39 = load float, float* %4
%40 = fadd float %38, %39
%41 = fcmp olt float %37, %40
br i1 %41, label %42, label %52
42: ; preds = %36
%43 = load float, float* %4
%44 = load float, float* %2
%45 = load float, float* %3
%46 = fadd float %44, %45
%47 = fcmp olt float %43, %46
br i1 %47, label %48, label %52
48: ; preds = %42
%49 = load float, float* %4
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), double %50)
br label %56
52: ; preds = %42, %36, %0
%53 = load float, float* %4
%54 = fpext float %53 to double
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), double %54)
br label %56
56: ; preds = %52, %48
%57 = load i32, i32* %1
ret i32 %57
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"a=\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"b=\00"
@.str.4 = [3 x i8] c"h=\00"
@.str.5 = [31 x i8] c"Third side of triangle(c) = %f\00"
@.str.6 = [44 x i8] c"Triangle does not exist with third side =%f\00"
@str = [52 x i8] c"Enter two sides of triangle (a,b) and the height(h)\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %3)
%14 = load float, float* %1
%15 = load float, float* %3
%16 = fneg float %15
%17 = fmul float %15, %16
%18 = load float, float* %2
%19 = insertelement <2 x float> poison, float %14, i64 0
%20 = insertelement <2 x float> %19, float %18, i64 1
%21 = insertelement <2 x float> poison, float %17, i64 0
%22 = shufflevector <2 x float> %21, <2 x float> poison, <2 x i32> zeroinitializer
%23 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %20, <2 x float> %20, <2 x float> %22)
%24 = shufflevector <2 x float> %23, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%25 = fadd <2 x float> %23, %24
%26 = extractelement <2 x float> %25, i64 0
%27 = call float @sqrt(float %26)
%28 = load float, float* %1
%29 = load float, float* %2
%30 = fadd float %27, %29
%31 = fcmp olt float %28, %30
%32 = fadd float %27, %28
%33 = fcmp olt float %29, %32
%34 = and i1 %33, %31
%35 = fadd float %28, %29
%36 = fcmp olt float %27, %35
%37 = select i1 %34, i1 %36, i1 false
%38 = fpext float %27 to double
%39 = select i1 %37, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %39, double %38)
ret i32 0
}