#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 area_of_triangle(unsigned int, unsigned int, unsigned int);
char getchar();
scalar_t__ is_valid_triangle(unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, unsigned int *, unsigned int *, unsigned int *);
void test_input_triangle() {
  unsigned side1, side2, side3;
  char c;
  if (scanf("%u %u %u", &side1, &side2, &side3) == 3) {
    if (is_valid_triangle(side1, side2, side3)) {
      printf("%u, %u, and %u make a", side1, side2, side3);
      if (side1 == side2 && side1 == side3)
        printf("n EQUILATERAL ");
      else if (side1 == side2 || side2 == side3 || side3 == side1)
        printf("n ISOSCELES ");
      else
        printf(" SCALENE ");
      printf("triangle with an approximate area of %f.\n",
             area_of_triangle(side1, side2, side3));
    } else {
      printf("%d, %d, and %d do NOT seem to constitute a valid triangle.\n",
             side1, side2, side3);
    }
  } else
    printf("Invalid entry.\n");
  while ((c = getchar()) != '\n')
    ;
}


x86 assembly (clang, -O0):
<test_input_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1070 <scanf@plt>
cmp    $0x3,%eax
jne    125a <test_input_triangle+0x10a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1060 <is_valid_triangle@plt>
cmp    $0x0,%rax
je     123e <test_input_triangle+0xee>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d3 <test_input_triangle+0x83>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11d3 <test_input_triangle+0x83>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121d <test_input_triangle+0xcd>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     11f7 <test_input_triangle+0xa7>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11f7 <test_input_triangle+0xa7>
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    120a <test_input_triangle+0xba>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1218 <test_input_triangle+0xc8>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121d <test_input_triangle+0xcd>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <area_of_triangle@plt>
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1255 <test_input_triangle+0x105>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1268 <test_input_triangle+0x118>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126d <test_input_triangle+0x11d>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     1288 <test_input_triangle+0x138>
jmp    126d <test_input_triangle+0x11d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_input_triangle>:
sub    $0x18,%rsp
lea    0xe95(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1080 <scanf@plt>
cmp    $0x3,%eax
jne    121b <test_input_triangle+0xbb>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1070 <is_valid_triangle@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
test   %rax,%rax
je     1229 <test_input_triangle+0xc9>
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%eax
mov    0xc(%rsp),%ecx
cmp    %ecx,%eax
lea    0xe56(%rip),%rdi
lea    0xe5e(%rip),%r8
cmovne %r8,%rdi
mov    0x10(%rsp),%esi
lea    0xe5c(%rip),%rdx
cmove  %r8,%rdx
cmp    %ecx,%esi
cmove  %r8,%rdx
cmp    %esi,%eax
cmovne %r8,%rdi
cmovne %rdx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1040 <area_of_triangle@plt>
lea    0xe33(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
jmp    1240 <test_input_triangle+0xe0>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
jmp    1240 <test_input_triangle+0xe0>
lea    0xe3f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xa,%al
jne    1240 <test_input_triangle+0xe0>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%u %u %u\00"
@.str.1 = [22 x i8] c"%u, %u, and %u make a\00"
@.str.2 = [15 x i8] c"n EQUILATERAL \00"
@.str.3 = [13 x i8] c"n ISOSCELES \00"
@.str.4 = [10 x i8] c" SCALENE \00"
@.str.5 = [42 x i8] c"triangle with an approximate area of %f.\0A\00"
@.str.6 = [60 x i8] c"%d, %d, and %d do NOT seem to constitute a valid triangle.\0A\00"
@.str.7 = [16 x i8] c"Invalid entry.\0A\00"
define void @test_input_triangle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%6 = icmp eq i32 %5, 3
br i1 %6, label %7, label %56
7: ; preds = %0
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i64 @is_valid_triangle(i32 %8, i32 %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %50
13: ; preds = %7
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %27
21: ; preds = %13
%22 = load i32, i32* %1
%23 = load i32, i32* %3
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %44
27: ; preds = %21, %13
%28 = load i32, i32* %1
%29 = load i32, i32* %2
%30 = icmp eq i32 %28, %29
br i1 %30, label %39, label %31
31: ; preds = %27
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = icmp eq i32 %32, %33
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = load i32, i32* %3
%37 = load i32, i32* %1
%38 = icmp eq i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %35, %31, %27
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %43
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
br label %44
44: ; preds = %43, %25
%45 = load i32, i32* %1
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = call double @area_of_triangle(i32 %45, i32 %46, i32 %47)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %48)
br label %55
50: ; preds = %7
%51 = load i32, i32* %1
%52 = load i32, i32* %2
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i32 %51, i32 %52, i32 %53)
br label %55
55: ; preds = %50, %44
br label %58
56: ; preds = %0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %58
58: ; preds = %56, %55
br label %59
59: ; preds = %63, %58
%60 = call signext i8 (...) @getchar()
store i8 %60, i8* %4
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 10
br i1 %62, label %63, label %64
63: ; preds = %59
br label %59
64: ; preds = %59
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%u %u %u\00"
@.str.1 = [22 x i8] c"%u, %u, and %u make a\00"
@.str.2 = [15 x i8] c"n EQUILATERAL \00"
@.str.3 = [13 x i8] c"n ISOSCELES \00"
@.str.4 = [10 x i8] c" SCALENE \00"
@.str.5 = [42 x i8] c"triangle with an approximate area of %f.\0A\00"
@.str.6 = [60 x i8] c"%d, %d, and %d do NOT seem to constitute a valid triangle.\0A\00"
@str = [15 x i8] c"Invalid entry.\00"
define void @test_input_triangle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = icmp eq i32 %7, 3
br i1 %8, label %9, label %39
9: ; preds = %0
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i64 @is_valid_triangle(i32 %10, i32 %11, i32 %12)
%14 = icmp eq i64 %13, 0
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = load i32, i32* %3
br i1 %14, label %37, label %18
18: ; preds = %9
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = icmp eq i32 %20, %21
%23 = load i32, i32* %3
%24 = icmp eq i32 %20, %23
%25 = select i1 %22, i1 %24, i1 false
%26 = select i1 %25, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0)
%27 = icmp eq i32 %21, %23
%28 = select i1 %27, i1 true, i1 %24
%29 = select i1 %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0)
%30 = select i1 %22, i8* %26, i8* %29
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %30)
%32 = load i32, i32* %1
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = call double @area_of_triangle(i32 %32, i32 %33, i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), double %35)
br label %41
37: ; preds = %9
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
br label %41
39: ; preds = %0
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %41
41: ; preds = %18, %37, %39
br label %42
42: ; preds = %41, %42
%43 = call signext i8 (...) @getchar()
%44 = icmp eq i8 %43, 10
br i1 %44, label %45, label %42
45: ; preds = %42
ret void
}