#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 main(void) {
  int a, b, c;
  char name[10];
  double radian;
  scanf("%s%d%d%d", name, &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    0xe96(%rip),%rdi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1070 <pow@plt>
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1070 <pow@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%edi
mov    $0x2,%esi
call   1070 <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   1040 <acos@plt>
movsd  %xmm0,-0x28(%rbp)
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xe41(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
call   1050 <is_right_angle@plt>
cmp    $0x0,%rax
je     1225 <main+0xd5>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1233 <main+0xe3>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe72(%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   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xe91(%rip),%rdi
lea    0x26(%rsp),%r14
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x14(%rsp),%r8
mov    %r14,%rsi
call   1070 <scanf@plt>
mov    0x10(%rsp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    %eax,%ebx
add    %ebp,%ebx
mov    0x14(%rsp),%edi
mov    $0x2,%esi
call   1080 <pow@plt>
mov    0x10(%rsp),%ecx
imul   0xc(%rsp),%ecx
sub    %eax,%ebx
add    %ecx,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1050 <acos@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
lea    0xe1c(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
movsd  0x18(%rsp),%xmm0
call   1060 <is_right_angle@plt>
test   %rax,%rax
lea    0xe67(%rip),%rax
lea    0xe7f(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xe00(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
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 = load i32, i32* %2
%10 = call i32 @pow(i32 %9, i32 2)
%11 = load i32, i32* %3
%12 = call i32 @pow(i32 %11, i32 2)
%13 = add nsw i32 %10, %12
%14 = load i32, i32* %4
%15 = call i32 @pow(i32 %14, i32 2)
%16 = sub nsw i32 %13, %15
%17 = load i32, i32* %2
%18 = mul nsw i32 2, %17
%19 = load i32, i32* %3
%20 = mul nsw i32 %18, %19
%21 = sdiv i32 %16, %20
%22 = call double @acos(i32 %21)
store double %22, double* %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%24 = load double, double* %6
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%27 = load double, double* %6
%28 = call i64 @is_right_angle(double %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %34
32: ; preds = %0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %35)
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 = load i32, i32* %1
%11 = call i32 @pow(i32 %10, i32 2)
%12 = load i32, i32* %2
%13 = call i32 @pow(i32 %12, i32 2)
%14 = add nsw i32 %13, %11
%15 = load i32, i32* %3
%16 = call i32 @pow(i32 %15, i32 2)
%17 = sub i32 %14, %16
%18 = load i32, i32* %1
%19 = shl nsw i32 %18, 1
%20 = load i32, i32* %2
%21 = mul nsw i32 %19, %20
%22 = sdiv i32 %17, %21
%23 = call double @acos(i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), double %23)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%27 = call i64 @is_right_angle(double %23)
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, 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)
%30 = call i32 @puts(i8* dereferenceable(1) %29)
%31 = 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
}