#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int m, n, side1, side2, hypotenuse;
  printf("Input two integers, and I will give you a pythagoream triple: \n");
  scanf("%d %d", &m, &n);
  if (!(m > n)) {
    puts("first must be higer than last");
    return 1;
  }
  side1 = m * m - n * n;
  side2 = 2 * m * n;
  hypotenuse = m * m + n * n;
  printf("Side: %d, side: %d and hypotenuse: %d \n", side1, side2, hypotenuse);
  return 0;
}


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   1040 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1185 <main+0x55>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d6 <main+0xa6>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
cmp    %ecx,%edx
jle    1188 <main+0x58>
mov    %edx,%eax
imul   %edx,%eax
imul   %ecx,%edx
imul   %ecx,%ecx
mov    %eax,%esi
sub    %ecx,%esi
add    %edx,%edx
add    %eax,%ecx
lea    0xea7(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1199 <main+0x69>
lea    0xe77(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [64 x i8] c"Input two integers, and I will give you a pythagoream triple: \0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [30 x i8] c"first must be higer than last\00"
@.str.3 = [40 x i8] c"Side: %d, side: %d and hypotenuse: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %9, %10
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = call i32 @puts(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %37
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = sub nsw i32 %17, %20
store i32 %21, i32* %4
%22 = load i32, i32* %2
%23 = mul nsw i32 2, %22
%24 = load i32, i32* %3
%25 = mul nsw i32 %23, %24
store i32 %25, i32* %5
%26 = load i32, i32* %2
%27 = load i32, i32* %2
%28 = mul nsw i32 %26, %27
%29 = load i32, i32* %3
%30 = load i32, i32* %3
%31 = mul nsw i32 %29, %30
%32 = add nsw i32 %28, %31
store i32 %32, i32* %6
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %34, i32 %35)
store i32 0, i32* %1
br label %37
37: ; preds = %14, %12
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [30 x i8] c"first must be higer than last\00"
@.str.3 = [40 x i8] c"Side: %d, side: %d and hypotenuse: %d \0A\00"
@str = [63 x i8] c"Input two integers, and I will give you a pythagoream triple: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %7, %8
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %20
12: ; preds = %0
%13 = mul nsw i32 %7, %7
%14 = mul nsw i32 %8, %8
%15 = sub nsw i32 %13, %14
%16 = shl nsw i32 %7, 1
%17 = mul nsw i32 %16, %8
%18 = add nuw nsw i32 %14, %13
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %17, i32 %18)
br label %20
20: ; preds = %12, %10
%21 = phi i32 [ 0, %12 ], [ 1, %10 ]
ret i32 %21
}