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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
lea    0xe74(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     120f <main+0xef>
mov    -0x18(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     120f <main+0xef>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     120f <main+0xef>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    1220 <main+0x100>
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
jmp    122c <main+0x10c>
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%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>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    %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
mov    (%rsp),%esi
imul   %esi,%esi
lea    (%rcx,%rax,1),%r9d
lea    (%rsi,%r9,1),%ebx
lea    0xe73(%rip),%rdi
cmp    %edx,%ebx
je     11ea <main+0xca>
lea    (%rsi,%rdx,1),%r8d
lea    (%r8,%rax,1),%ebx
cmp    %ecx,%ebx
je     11ea <main+0xca>
add    %ecx,%r8d
add    %edx,%r9d
cmp    %esi,%r9d
lea    0xe53(%rip),%rcx
lea    0xe6a(%rip),%rdi
cmove  %rcx,%rdi
cmp    %eax,%r8d
cmove  %rcx,%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 = [10 x i8] c"Enter d: \00"
@.str.5 = [30 x i8] c"It is a pythagorean quadruple\00"
@.str.6 = [34 x i8] c"It is not a pythagorean quadruple\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
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%18 = load i32, i32* %2
%19 = load i32, i32* %2
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = mul nsw i32 %21, %22
store i32 %23, i32* %7
%24 = load i32, i32* %4
%25 = load i32, i32* %4
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %8
%27 = load i32, i32* %5
%28 = load i32, i32* %5
%29 = mul nsw i32 %27, %28
store i32 %29, i32* %9
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %9
%34 = add nsw i32 %32, %33
%35 = load i32, i32* %8
%36 = icmp eq i32 %34, %35
br i1 %36, label %61, label %37
37: ; preds = %0
%38 = load i32, i32* %6
%39 = load i32, i32* %8
%40 = add nsw i32 %38, %39
%41 = load i32, i32* %9
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %7
%44 = icmp eq i32 %42, %43
br i1 %44, label %61, label %45
45: ; preds = %37
%46 = load i32, i32* %7
%47 = load i32, i32* %8
%48 = add nsw i32 %46, %47
%49 = load i32, i32* %9
%50 = add nsw i32 %48, %49
%51 = load i32, i32* %6
%52 = icmp eq i32 %50, %51
br i1 %52, label %61, label %53
53: ; preds = %45
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = add nsw i32 %54, %55
%57 = load i32, i32* %8
%58 = add nsw i32 %56, %57
%59 = load i32, i32* %9
%60 = icmp eq i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %53, %45, %37, %0
%62 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
br label %65
63: ; preds = %53
%64 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %65
65: ; preds = %63, %61
%66 = load i32, i32* %1
ret i32 %66
}

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 = [10 x i8] c"Enter d: \00"
@.str.5 = [30 x i8] c"It is a pythagorean quadruple\00"
@.str.6 = [34 x i8] c"It is not a pythagorean quadruple\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %1
%18 = mul nsw i32 %17, %17
%19 = load i32, i32* %2
%20 = mul nsw i32 %19, %19
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, %21
%23 = load i32, i32* %4
%24 = mul nsw i32 %23, %23
%25 = add nuw nsw i32 %20, %18
%26 = add nuw nsw i32 %24, %25
%27 = icmp eq i32 %26, %22
br i1 %27, label %39, label %28
28: ; preds = %0
%29 = add nuw i32 %24, %22
%30 = add i32 %29, %18
%31 = icmp eq i32 %30, %20
br i1 %31, label %39, label %32
32: ; preds = %28
%33 = add i32 %29, %20
%34 = icmp eq i32 %33, %18
%35 = add nuw nsw i32 %25, %22
%36 = icmp eq i32 %35, %24
%37 = select i1 %34, i1 true, i1 %36
%38 = select i1 %37, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0)
br label %39
39: ; preds = %32, %0, %28
%40 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), %28 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), %0 ], [ %38, %32 ]
%41 = call i32 @printf(i8* dereferenceable(1) %40)
ret i32 0
}