#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 */
float asin(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void arccos() {
  float deg, rad, angle, val;
  printf("Enter the value: \n");
  scanf("%f", &val);
  printf("The value you have input is %.2f. \n", val);
  if (val > 1.0 || val < 1.0) {
    printf("Arccos(%.2f) is undefined.", val);
  } else {
    angle = asin(val);
    deg = angle * (180.0 / 3.14);
    printf("Arccos(%.2f) is equal to %.f degrees.", val, deg);
  }
}


x86 assembly (clang, -O0):
<arccos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe82(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11a3 <arccos+0x73>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe67(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bf <arccos+0x8f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    120c <arccos+0xdc>
movss  -0x10(%rbp),%xmm0
call   1040 <asin@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe29(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x4(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe60(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arccos>:
push   %rax
lea    0xf30(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
movss  0xe7c(%rip),%xmm1
ucomiss %xmm0,%xmm1
je     119d <arccos+0x5d>
cvtss2sd %xmm0,%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
pop    %rax
ret
call   1050 <asin@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0xe5a(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe88(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the value: \0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [36 x i8] c"The value you have input is %.2f. \0A\00"
@.str.3 = [27 x i8] c"Arccos(%.2f) is undefined.\00"
@.str.4 = [38 x i8] c"Arccos(%.2f) is equal to %.f degrees.\00"
define void @arccos() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %8)
%10 = load float, float* %4
%11 = fpext float %10 to double
%12 = fcmp ogt double %11, 1.000000e+00
br i1 %12, label %17, label %13
13: ; preds = %0
%14 = load float, float* %4
%15 = fpext float %14 to double
%16 = fcmp olt double %15, 1.000000e+00
br i1 %16, label %17, label %21
17: ; preds = %13, %0
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %19)
br label %33
21: ; preds = %13
%22 = load float, float* %4
%23 = call float @asin(float %22)
store float %23, float* %3
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = fmul double %25, 0x404CA99461D59AE7
%27 = fptrunc double %26 to float
store float %27, float* %1
%28 = load float, float* %4
%29 = fpext float %28 to double
%30 = load float, float* %1
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %29, double %31)
br label %33
33: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [36 x i8] c"The value you have input is %.2f. \0A\00"
@.str.3 = [27 x i8] c"Arccos(%.2f) is undefined.\00"
@.str.4 = [38 x i8] c"Arccos(%.2f) is equal to %.f degrees.\00"
@str = [18 x i8] c"Enter the value: \00"
define void @arccos() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load float, float* %1
%9 = fcmp ueq float %8, 1.000000e+00
br i1 %9, label %13, label %10
10: ; preds = %0
%11 = fpext float %8 to double
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), double %11)
br label %22
13: ; preds = %0
%14 = call float @asin(float %8)
%15 = fpext float %14 to double
%16 = fmul double %15, 0x404CA99461D59AE7
%17 = fptrunc double %16 to float
%18 = load float, float* %1
%19 = fpext float %18 to double
%20 = fpext float %17 to double
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %19, double %20)
br label %22
22: ; preds = %13, %10
ret void
}