#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 */
scalar_t__ is_right_angle(double);
double my_acos(int);
int pow(double, double);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *, double *, double *, double *);
int /*<<< orphan*/ sort(double *, double *, double *);
int main(void) {
  char name[10];
  double a, b, c;
  double radian;
  scanf("%s%lf%lf%lf", name, &a, &b, &c);
  sort(&a, &b, &c);
  radian = my_acos((pow(a, 2.0) + pow(b, 2.0) - pow(c, 2.0)) / (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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xe8e(%rip),%rdi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%r8
call   1070 <scanf@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <sort@plt>
movsd  -0x18(%rbp),%xmm0
movsd  0xe57(%rip),%xmm1
call   1080 <pow@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe42(%rip),%xmm1
call   1080 <pow@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe26(%rip),%xmm1
call   1080 <pow@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe0e(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <my_acos@plt>
movsd  %xmm0,-0x30(%rbp)
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xe0d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
call   1060 <is_right_angle@plt>
cmp    $0x0,%rax
je     1264 <main+0x104>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x112>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xe85(%rip),%rdi
lea    0x26(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r15
lea    0x18(%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>
movsd  0x10(%rsp),%xmm0
movsd  0xe3c(%rip),%xmm1
call   1090 <pow@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
movsd  0xe27(%rip),%xmm1
call   1090 <pow@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movsd  0x18(%rsp),%xmm0
movsd  0xe10(%rip),%xmm1
call   1090 <pow@plt>
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <my_acos@plt>
movsd  %xmm0,(%rsp)
lea    0xe26(%rip),%rdi
call   1030 <puts@plt>
lea    0xde1(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe27(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
call   1070 <is_right_angle@plt>
test   %rax,%rax
lea    0xe2e(%rip),%rax
lea    0xe46(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xdc7(%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 = [12 x i8] c"%s%lf%lf%lf\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 [10 x i8]
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7, double* %3, double* %4, double* %5)
%9 = call i32 @sort(double* %3, double* %4, double* %5)
%10 = load double, double* %3
%11 = call i32 @pow(double %10, double 2.000000e+00)
%12 = load double, double* %4
%13 = call i32 @pow(double %12, double 2.000000e+00)
%14 = add nsw i32 %11, %13
%15 = load double, double* %5
%16 = call i32 @pow(double %15, double 2.000000e+00)
%17 = sub nsw i32 %14, %16
%18 = sitofp i32 %17 to double
%19 = load double, double* %3
%20 = fmul double 2.000000e+00, %19
%21 = load double, double* %4
%22 = fmul double %20, %21
%23 = fdiv double %18, %22
%24 = fptosi double %23 to i32
%25 = call double @my_acos(i32 %24)
store double %25, double* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%27 = load double, double* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%30 = load double, double* %6
%31 = call i64 @is_right_angle(double %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %37
35: ; preds = %0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s%lf%lf%lf\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 [10 x i8]
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5, double* %2, double* %3, double* %4)
%10 = call i32 @sort(double* %2, double* %3, double* %4)
%11 = load double, double* %2
%12 = call i32 @pow(double %11, double 2.000000e+00)
%13 = load double, double* %3
%14 = call i32 @pow(double %13, double 2.000000e+00)
%15 = add nsw i32 %14, %12
%16 = load double, double* %4
%17 = call i32 @pow(double %16, double 2.000000e+00)
%18 = sub i32 %15, %17
%19 = sitofp i32 %18 to double
%20 = load double, double* %2
%21 = fmul double %20, 2.000000e+00
%22 = load double, double* %3
%23 = fmul double %21, %22
%24 = fdiv double %19, %23
%25 = fptosi double %24 to i32
%26 = call double @my_acos(i32 %25)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %26)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%30 = call i64 @is_right_angle(double %26)
%31 = icmp eq i64 %30, 0
%32 = select i1 %31, 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)
%33 = call i32 @puts(i8* dereferenceable(1) %32)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %5)
ret i32 0
}