#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 *, float *);
int main() {
  float a, b, c;
  printf("Enter lengths of sides: \n");
  scanf("%f %f %f", &a, &b, &c);
  if ((a + b <= c) || (a + c <= b) || (b + c <= a))
    printf("A triangle can not be constructed.\n");
  else {
    if (a >= b) {
      float tmp = a;
      a = b;
      b = tmp;
    }
    if (a >= c) {
      float tmp = a;
      a = c;
      c = tmp;
    }
    if (b >= c) {
      float tmp = b;
      b = c;
      c = tmp;
    }
    if (c * c == a * a + b * b) {
      printf("The triangle is right triangle.\n");
      printf("Area is %7.3f\n", a * b / 2);
    } else {
      printf("The triangle is NOT a right triangle.\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jae    119d <main+0x7d>
movss  -0x8(%rbp),%xmm1
addss  -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jae    119d <main+0x7d>
movss  -0xc(%rbp),%xmm1
addss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11b0 <main+0x90>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ba <main+0x19a>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     11dd <main+0xbd>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     120a <main+0xea>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     1237 <main+0x117>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
movss  -0xc(%rbp),%xmm2
mulss  -0xc(%rbp),%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jne    12a7 <main+0x187>
jp     12a7 <main+0x187>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  0xd74(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12b5 <main+0x195>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ba <main+0x19a>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm3
movss  0xc(%rsp),%xmm0
movaps %xmm3,%xmm1
addss  %xmm0,%xmm1
movss  0x14(%rsp),%xmm2
ucomiss %xmm1,%xmm2
jae    11c6 <main+0x96>
movaps %xmm3,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm0
jae    11c6 <main+0x96>
movaps %xmm0,%xmm1
addss  %xmm2,%xmm1
ucomiss %xmm1,%xmm3
jae    11c6 <main+0x96>
ucomiss %xmm0,%xmm3
jae    11cf <main+0x9f>
movaps %xmm0,%xmm1
movaps %xmm3,%xmm0
ucomiss %xmm2,%xmm0
jb     11e3 <main+0xb3>
movss  %xmm2,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
movaps %xmm2,%xmm3
ucomiss %xmm0,%xmm1
jb     11ee <main+0xbe>
movss  %xmm0,0xc(%rsp)
movss  %xmm1,0x14(%rsp)
movaps %xmm0,%xmm2
jmp    11f4 <main+0xc4>
lea    0xeae(%rip),%rdi
jmp    1246 <main+0x116>
movss  %xmm0,0x10(%rsp)
movss  %xmm3,0xc(%rsp)
movaps %xmm3,%xmm1
ucomiss %xmm2,%xmm0
jae    11a1 <main+0x71>
movaps %xmm0,%xmm3
movaps %xmm2,%xmm0
ucomiss %xmm0,%xmm1
jae    11b5 <main+0x85>
movaps %xmm1,%xmm2
movaps %xmm0,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm2,%xmm2
mulss  %xmm3,%xmm3
addss  %xmm2,%xmm3
ucomiss %xmm3,%xmm1
jne    123f <main+0x10f>
jp     123f <main+0x10f>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
movss  0x10(%rsp),%xmm0
mulss  0xc(%rsp),%xmm0
mulss  0xdd5(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd7(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    124b <main+0x11b>
lea    0xdef(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Enter lengths of sides: \0A\00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [36 x i8] c"A triangle can not be constructed.\0A\00"
@.str.3 = [33 x i8] c"The triangle is right triangle.\0A\00"
@.str.4 = [15 x i8] c"Area is %7.3f\0A\00"
@.str.5 = [39 x i8] c"The triangle is NOT a right triangle.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, float* %4)
%10 = load float, float* %2
%11 = load float, float* %3
%12 = fadd float %10, %11
%13 = load float, float* %4
%14 = fcmp ole float %12, %13
br i1 %14, label %27, label %15
15: ; preds = %0
%16 = load float, float* %2
%17 = load float, float* %4
%18 = fadd float %16, %17
%19 = load float, float* %3
%20 = fcmp ole float %18, %19
br i1 %20, label %27, label %21
21: ; preds = %15
%22 = load float, float* %3
%23 = load float, float* %4
%24 = fadd float %22, %23
%25 = load float, float* %2
%26 = fcmp ole float %24, %25
br i1 %26, label %27, label %29
27: ; preds = %21, %15, %0
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %75
29: ; preds = %21
%30 = load float, float* %2
%31 = load float, float* %3
%32 = fcmp oge float %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load float, float* %2
store float %34, float* %5
%35 = load float, float* %3
store float %35, float* %2
%36 = load float, float* %5
store float %36, float* %3
br label %37
37: ; preds = %33, %29
%38 = load float, float* %2
%39 = load float, float* %4
%40 = fcmp oge float %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load float, float* %2
store float %42, float* %6
%43 = load float, float* %4
store float %43, float* %2
%44 = load float, float* %6
store float %44, float* %4
br label %45
45: ; preds = %41, %37
%46 = load float, float* %3
%47 = load float, float* %4
%48 = fcmp oge float %46, %47
br i1 %48, label %49, label %53
49: ; preds = %45
%50 = load float, float* %3
store float %50, float* %7
%51 = load float, float* %4
store float %51, float* %3
%52 = load float, float* %7
store float %52, float* %4
br label %53
53: ; preds = %49, %45
%54 = load float, float* %4
%55 = load float, float* %4
%56 = fmul float %54, %55
%57 = load float, float* %2
%58 = load float, float* %2
%59 = load float, float* %3
%60 = load float, float* %3
%61 = fmul float %59, %60
%62 = call float @llvm.fmuladd.f32(float %57, float %58, float %61)
%63 = fcmp oeq float %56, %62
br i1 %63, label %64, label %72
64: ; preds = %53
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%66 = load float, float* %2
%67 = load float, float* %3
%68 = fmul float %66, %67
%69 = fdiv float %68, 2.000000e+00
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %70)
br label %74
72: ; preds = %53
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %74
74: ; preds = %72, %64
br label %75
75: ; preds = %74, %27
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.4 = [15 x i8] c"Area is %7.3f\0A\00"
@str = [25 x i8] c"Enter lengths of sides: \00"
@str.6 = [38 x i8] c"The triangle is NOT a right triangle.\00"
@str.7 = [32 x i8] c"The triangle is right triangle.\00"
@str.8 = [35 x i8] c"A triangle can not be constructed.\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 ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %2, float* %3)
%9 = load float, float* %1
%10 = load float, float* %2
%11 = fadd float %9, %10
%12 = load float, float* %3
%13 = fcmp ugt float %11, %12
%14 = fadd float %9, %12
%15 = fcmp ugt float %14, %10
%16 = and i1 %13, %15
%17 = fadd float %10, %12
%18 = fcmp ugt float %17, %9
%19 = select i1 %16, i1 %18, i1 false
br i1 %19, label %22, label %20
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
br label %52
22: ; preds = %0
%23 = fcmp ult float %9, %10
br i1 %23, label %25, label %24
24: ; preds = %22
store float %10, float* %1
store float %9, float* %2
br label %25
25: ; preds = %24, %22
%26 = phi float [ %9, %24 ], [ %10, %22 ]
%27 = phi float [ %10, %24 ], [ %9, %22 ]
%28 = fcmp ult float %27, %12
br i1 %28, label %30, label %29
29: ; preds = %25
store float %12, float* %1
store float %27, float* %3
br label %30
30: ; preds = %29, %25
%31 = phi float [ %12, %29 ], [ %27, %25 ]
%32 = phi float [ %27, %29 ], [ %12, %25 ]
%33 = fcmp ult float %26, %32
br i1 %33, label %35, label %34
34: ; preds = %30
store float %32, float* %2
store float %26, float* %3
br label %35
35: ; preds = %34, %30
%36 = phi float [ %32, %34 ], [ %26, %30 ]
%37 = phi float [ %26, %34 ], [ %32, %30 ]
%38 = fmul float %37, %37
%39 = fmul float %36, %36
%40 = call float @llvm.fmuladd.f32(float %31, float %31, float %39)
%41 = fcmp oeq float %38, %40
br i1 %41, label %42, label %50
42: ; preds = %35
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%44 = load float, float* %1
%45 = load float, float* %2
%46 = fmul float %44, %45
%47 = fmul float %46, 5.000000e-01
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), double %48)
br label %52
50: ; preds = %35
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.6, i64 0, i64 0))
br label %52
52: ; preds = %42, %50, %20
ret i32 0
}