#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 *, int *);
int main() {
  int a, b, c;
  printf("Enter a: ");
  scanf("%d", &a);
  printf("Enter b: ");
  scanf("%d", &b);
  printf("Enter c: ");
  scanf("%d", &c);
  int sq_a = a * a;
  int sq_b = b * b;
  int sq_c = c * c;
  if (sq_a + sq_b == sq_c || sq_a + sq_c == sq_b || sq_b + sq_c == sq_a) {
    printf("It is a pythagorean triplet");
  } else {
    printf("It is not a pythagorean triplet");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     11ce <main+0xae>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     11ce <main+0xae>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11df <main+0xbf>
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
lea    0xe57(%rip),%rdi
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    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
imul   %eax,%eax
mov    0x8(%rsp),%ecx
imul   %ecx,%ecx
mov    0x4(%rsp),%edx
imul   %edx,%edx
lea    (%rdx,%rcx,1),%esi
cmp    %eax,%esi
lea    0xe89(%rip),%rsi
lea    0xe9e(%rip),%rdi
cmove  %rsi,%rdi
lea    (%rdx,%rax,1),%ebx
cmp    %ecx,%ebx
cmove  %rsi,%rdi
add    %ecx,%eax
cmp    %edx,%eax
cmove  %rsi,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter a: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Enter b: \00"
@.str.3 = [10 x i8] c"Enter c: \00"
@.str.4 = [28 x i8] c"It is a pythagorean triplet\00"
@.str.5 = [32 x i8] c"It is not a pythagorean triplet\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = mul nsw i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %3
%18 = load i32, i32* %3
%19 = mul nsw i32 %17, %18
store i32 %19, i32* %6
%20 = load i32, i32* %4
%21 = load i32, i32* %4
%22 = mul nsw i32 %20, %21
store i32 %22, i32* %7
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = add nsw i32 %23, %24
%26 = load i32, i32* %7
%27 = icmp eq i32 %25, %26
br i1 %27, label %40, label %28
28: ; preds = %0
%29 = load i32, i32* %5
%30 = load i32, i32* %7
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %6
%33 = icmp eq i32 %31, %32
br i1 %33, label %40, label %34
34: ; preds = %28
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = add nsw i32 %35, %36
%38 = load i32, i32* %5
%39 = icmp eq i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %34, %28, %0
%41 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %44
42: ; preds = %34
%43 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter a: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Enter b: \00"
@.str.3 = [10 x i8] c"Enter c: \00"
@.str.4 = [28 x i8] c"It is a pythagorean triplet\00"
@.str.5 = [32 x i8] c"It is not a pythagorean triplet\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* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %1
%14 = mul nsw i32 %13, %13
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, %15
%17 = load i32, i32* %3
%18 = mul nsw i32 %17, %17
%19 = add nuw nsw i32 %16, %14
%20 = icmp eq i32 %19, %18
%21 = add nuw nsw i32 %18, %14
%22 = icmp eq i32 %21, %16
%23 = select i1 %20, i1 true, i1 %22
%24 = add nuw nsw i32 %18, %16
%25 = icmp eq i32 %24, %14
%26 = select i1 %23, i1 true, i1 %25
%27 = select i1 %26, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0)
%28 = call i32 @printf(i8* dereferenceable(1) %27)
ret i32 0
}