#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 acos(int);
scalar_t__ is_right_angle(double);
int pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *, int *, int *, int *);
int /*<<< orphan*/ sort(int *, int *, int *);
int main(void) {
  int a, b, c;
  char name[10];
  double radian;
  scanf("%s%d%d%d", name, &a, &b, &c);
  sort(&a, &b, &c);
  radian = acos((pow(a, 2) + pow(b, 2) - pow(c, 2)) / (2 * a * b));
  printf("                   a^2+b^2-c^2 \n");
  printf("Radian C = arccos -------------  = %lf \n", radian);
  printf("                       2ab     \n");
  if (is_right_angle(radian)) {
    printf("This is a right triangle. \n");
  } else {
    printf("This is not a right triangle. \n");
  }
  printf("written by %s \n", name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a(%rbp),%rsi
lea    0xe86(%rip),%rdi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1070 <scanf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <sort@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
imul   -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <acos@plt>
movsd  %xmm0,-0x28(%rbp)
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
call   1060 <is_right_angle@plt>
cmp    $0x0,%rax
je     1246 <main+0xe6>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1254 <main+0xf4>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xe7d(%rip),%rdi
lea    0x26(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
lea    0x14(%rsp),%r12
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1080 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <sort@plt>
mov    0x10(%rsp),%edi
mov    $0x2,%esi
call   1090 <pow@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    $0x2,%esi
call   1090 <pow@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    0x14(%rsp),%edi
mov    $0x2,%esi
call   1090 <pow@plt>
mov    0x10(%rsp),%ecx
imul   0xc(%rsp),%ecx
sub    %eax,%ebp
add    %ecx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1060 <acos@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xe36(%rip),%rdi
call   1030 <puts@plt>
lea    0xdf1(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe36(%rip),%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm0
call   1070 <is_right_angle@plt>
test   %rax,%rax
lea    0xe3c(%rip),%rax
lea    0xe54(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xdd5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s%d%d%d\00"
@.str.1 = [33 x i8] c" a^2+b^2-c^2 \0A\00"
@.str.2 = [41 x i8] c"Radian C = arccos ------------- = %lf \0A\00"
@.str.3 = [33 x i8] c" 2ab \0A\00"
@.str.4 = [28 x i8] c"This is a right triangle. \0A\00"
@.str.5 = [32 x i8] c"This is not a right triangle. \0A\00"
@.str.6 = [16 x i8] c"written by %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca double
store i32 0, i32* %1
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %7, i32* %2, i32* %3, i32* %4)
%9 = call i32 @sort(i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %2
%11 = call i32 @pow(i32 %10, i32 2)
%12 = load i32, i32* %3
%13 = call i32 @pow(i32 %12, i32 2)
%14 = add nsw i32 %11, %13
%15 = load i32, i32* %4
%16 = call i32 @pow(i32 %15, i32 2)
%17 = sub nsw i32 %14, %16
%18 = load i32, i32* %2
%19 = mul nsw i32 2, %18
%20 = load i32, i32* %3
%21 = mul nsw i32 %19, %20
%22 = sdiv i32 %17, %21
%23 = call double @acos(i32 %22)
store double %23, double* %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%25 = load double, double* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%28 = load double, double* %6
%29 = call i64 @is_right_angle(double %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %35
33: ; preds = %0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s%d%d%d\00"
@.str.2 = [41 x i8] c"Radian C = arccos ------------- = %lf \0A\00"
@.str.6 = [16 x i8] c"written by %s \0A\00"
@str = [32 x i8] c" a^2+b^2-c^2 \00"
@str.7 = [32 x i8] c" 2ab \00"
@str.8 = [31 x i8] c"This is not a right triangle. \00"
@str.9 = [27 x i8] c"This is a right triangle. \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i32* %1, i32* %2, i32* %3)
%10 = call i32 @sort(i32* %1, i32* %2, i32* %3)
%11 = load i32, i32* %1
%12 = call i32 @pow(i32 %11, i32 2)
%13 = load i32, i32* %2
%14 = call i32 @pow(i32 %13, i32 2)
%15 = add nsw i32 %14, %12
%16 = load i32, i32* %3
%17 = call i32 @pow(i32 %16, i32 2)
%18 = sub i32 %15, %17
%19 = load i32, i32* %1
%20 = shl nsw i32 %19, 1
%21 = load i32, i32* %2
%22 = mul nsw i32 %20, %21
%23 = sdiv i32 %18, %22
%24 = call double @acos(i32 %23)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %24)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%28 = call i64 @is_right_angle(double %24)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @str.9, i64 0, i64 0)
%31 = call i32 @puts(i8* dereferenceable(1) %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %8)
ret i32 0
}