#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 *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int firstSide;
  int secondSide;
  int thirdSide;
  printf("%s", "Enter first side(0 to exit): ");
  scanf("%d", &firstSide);
  while (firstSide != 0) {
    printf("%s", "Enter second sie: ");
    scanf("%d", &secondSide);
    printf("%s", "Enter third sie: ");
    scanf("%d", &thirdSide);
    if (firstSide < 0) {
      puts("You have provided a negative side!!!");
      puts("Please provide a new number!!!");
    } else if (secondSide < 0) {
      puts("You have provided a negative side!!!");
      puts("Please provide a new number!!!");
    } else if (thirdSide < 0) {
      puts("You have provided a negative side!!!");
      puts("Please provide a new number!!!");
    } else {
      if ((thirdSide * thirdSide) ==
          ((firstSide * firstSide) + (secondSide * secondSide))) {
        puts("The given sides can represent a right triangle!!!");
      } else {
        puts("The given sides can not represent a right triangle!!!");
      }
    }
    printf("\n%s", "Enter first side(0 to exit): ");
    scanf("%d", &firstSide);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xfad(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     129a <main+0x16a>
lea    0xf80(%rip),%rdi
lea    0xea7(%rip),%rsi
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xf5d(%rip),%rdi
lea    0xe97(%rip),%rsi
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11d9 <main+0xa9>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
jmp    1272 <main+0x142>
cmpl   $0x0,-0xc(%rbp)
jge    1200 <main+0xd0>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1030 <puts@plt>
jmp    126d <main+0x13d>
cmpl   $0x0,-0x10(%rbp)
jge    1227 <main+0xf7>
lea    0xe35(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4e(%rip),%rdi
call   1030 <puts@plt>
jmp    1268 <main+0x138>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
imul   -0xc(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jne    1257 <main+0x127>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
jmp    1263 <main+0x133>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
jmp    1268 <main+0x138>
jmp    126d <main+0x13d>
jmp    1272 <main+0x142>
lea    0xe79(%rip),%rdi
lea    0xd80(%rip),%rsi
call   1040 <printf@plt>
lea    0xd92(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xfae(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     124d <main+0x11d>
lea    0xf7f(%rip),%r15
lea    0xea3(%rip),%rbx
lea    0x10(%rsp),%rbp
lea    0xf6b(%rip),%r14
lea    0xe72(%rip),%r12
lea    0xc(%rsp),%r13
jmp    11d5 <main+0xa5>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     124d <main+0x11d>
mov    %r15,%rdi
lea    0xe42(%rip),%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r15,%rdi
lea    0xe39(%rip),%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     11a0 <main+0x70>
mov    0x14(%rsp),%ecx
test   %ecx,%ecx
js     11a0 <main+0x70>
mov    0x10(%rsp),%edx
test   %edx,%edx
js     11a0 <main+0x70>
imul   %edx,%edx
imul   %eax,%eax
imul   %ecx,%ecx
add    %eax,%ecx
lea    0xe51(%rip),%rdi
cmp    %ecx,%edx
je     11b3 <main+0x83>
lea    0xe74(%rip),%rdi
jmp    11b3 <main+0x83>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c"Enter first side(0 to exit): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Enter second sie: \00"
@.str.4 = [18 x i8] c"Enter third sie: \00"
@.str.5 = [37 x i8] c"You have provided a negative side!!!\00"
@.str.6 = [31 x i8] c"Please provide a new number!!!\00"
@.str.7 = [50 x i8] c"The given sides can represent a right triangle!!!\00"
@.str.8 = [54 x i8] c"The given sides can not represent a right triangle!!!\00"
@.str.9 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %51, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %54
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %51
20: ; preds = %10
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %50
26: ; preds = %20
%27 = load i32, i32* %4
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
%31 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
br label %49
32: ; preds = %26
%33 = load i32, i32* %4
%34 = load i32, i32* %4
%35 = mul nsw i32 %33, %34
%36 = load i32, i32* %2
%37 = load i32, i32* %2
%38 = mul nsw i32 %36, %37
%39 = load i32, i32* %3
%40 = load i32, i32* %3
%41 = mul nsw i32 %39, %40
%42 = add nsw i32 %38, %41
%43 = icmp eq i32 %35, %42
br i1 %43, label %44, label %46
44: ; preds = %32
%45 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
br label %48
46: ; preds = %32
%47 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0))
br label %48
48: ; preds = %46, %44
br label %49
49: ; preds = %48, %29
br label %50
50: ; preds = %49, %23
br label %51
51: ; preds = %50, %17
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %7
54: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c"Enter first side(0 to exit): \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"Enter second sie: \00"
@.str.4 = [18 x i8] c"Enter third sie: \00"
@.str.5 = [37 x i8] c"You have provided a negative side!!!\00"
@.str.6 = [31 x i8] c"Please provide a new number!!!\00"
@.str.7 = [50 x i8] c"The given sides can represent a right triangle!!!\00"
@.str.8 = [54 x i8] c"The given sides can not represent a right triangle!!!\00"
@.str.9 = [4 x i8] c"\0A%s\00"
define i32 @main() {
%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 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %44, label %11
11: ; preds = %0, %37
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %37
20: ; preds = %11
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %37
25: ; preds = %20
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0))
br label %37
30: ; preds = %25
%31 = mul nsw i32 %26, %26
%32 = mul nsw i32 %16, %16
%33 = mul nsw i32 %21, %21
%34 = add nuw nsw i32 %33, %32
%35 = icmp eq i32 %31, %34
%36 = select i1 %35, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0)
br label %37
37: ; preds = %30, %23, %28, %18
%38 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), %23 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), %28 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), %18 ], [ %36, %30 ]
%39 = call i32 @puts(i8* dereferenceable(1) %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%42 = load i32, i32* %1
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %11
44: ; preds = %37, %0
ret i32 0
}