#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 M_PI;
double asin(double);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
double sqrt(double);
int /*<<< orphan*/ sscanf(char *, char *, ...);
main() {
  int int_value;
  float float_value;
  double dbl_value;
  char inbuf[133];
  printf("\nPlease enter a positive integer: ");
  gets(inbuf);
  sscanf(inbuf, "%d", &int_value);
  printf("Please enter a value between 0 and 1: ");
  gets(inbuf);
  sscanf(inbuf, "%f", &float_value);
  dbl_value = asin((double)float_value);
  dbl_value *= 180.0 / M_PI;
  printf("\n");
  printf("The square root of %d is %f\n", int_value, sqrt((double)int_value));
  printf("The arcsine of %.3f is %.1f degrees\n", float_value, dbl_value);
  printf("1.0 divided by 0.0 is %f\n", (1.0 / 0.0));
  printf("-1.0 divided by 0.0 is %f\n", (-1.0 / 0.0));
  printf("0.0 divided by 0.0 is %f\n", (0.0 / 0.0));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <gets@plt>
lea    -0xa0(%rbp),%rdi
lea    0xec0(%rip),%rsi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1060 <sscanf@plt>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <gets@plt>
lea    -0xa0(%rbp),%rdi
lea    0xeb7(%rip),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1060 <sscanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1050 <asin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe3c(%rip),%xmm0
mov    0x2e05(%rip),%rax
divsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xa4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
call   1070 <sqrt@plt>
mov    -0xa4(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm1
lea    0xe52(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
movsd  0xdbf(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
movsd  0xda1(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
movsd  0xd83(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xa0,%rsp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xeb9(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <sscanf@plt>
lea    0xea6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xeb7(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <sscanf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1060 <asin@plt>
mov    0x2e10(%rip),%rax
movsd  0xe20(%rip),%xmm1
divsd  (%rax),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x4(%rsp),%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1213 <main+0xb3>
sqrtsd %xmm0,%xmm0
jmp    1218 <main+0xb8>
call   1080 <sqrt@plt>
lea    0xe51(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1040 <printf@plt>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe55(%rip),%rdi
movsd  0x8(%rsp),%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xe67(%rip),%rdi
movsd  0xdb4(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe50(%rip),%rdi
movsd  0xda6(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe55(%rip),%rdi
movsd  0xd98(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"\0APlease enter a positive integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Please enter a value between 0 and 1: \00"
@.str.3 = [3 x i8] c"%f\00"
@M_PI = global double 0.000000e+00
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [29 x i8] c"The square root of %d is %f\0A\00"
@.str.6 = [37 x i8] c"The arcsine of %.3f is %.1f degrees\0A\00"
@.str.7 = [26 x i8] c"1.0 divided by 0.0 is %f\0A\00"
@.str.8 = [27 x i8] c"-1.0 divided by 0.0 is %f\0A\00"
@.str.9 = [26 x i8] c"0.0 divided by 0.0 is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca double
%4 = alloca [133 x i8]
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [133 x i8], [133 x i8]* %4, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [133 x i8], [133 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, i8*, ...) @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds [133 x i8], [133 x i8]* %4, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
%13 = getelementptr inbounds [133 x i8], [133 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, i8*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = call double @asin(double %16)
store double %17, double* %3
%18 = load double, double* @M_PI
%19 = fdiv double 1.800000e+02, %18
%20 = load double, double* %3
%21 = fmul double %20, %19
store double %21, double* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = load i32, i32* %1
%25 = sitofp i32 %24 to double
%26 = call double @sqrt(double %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %23, double %26)
%28 = load float, float* %2
%29 = fpext float %28 to double
%30 = load double, double* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %29, double %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double 0x7FF0000000000000)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double 0xFFF0000000000000)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), double 0x7FF8000000000000)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"\0APlease enter a positive integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Please enter a value between 0 and 1: \00"
@.str.3 = [3 x i8] c"%f\00"
@M_PI = global double 0.000000e+00
@.str.5 = [29 x i8] c"The square root of %d is %f\0A\00"
@.str.6 = [37 x i8] c"The arcsine of %.3f is %.1f degrees\0A\00"
@.str.7 = [26 x i8] c"1.0 divided by 0.0 is %f\0A\00"
@.str.8 = [27 x i8] c"-1.0 divided by 0.0 is %f\0A\00"
@.str.9 = [26 x i8] c"0.0 divided by 0.0 is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca [133 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = getelementptr inbounds [133 x i8], [133 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %6)
%9 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @gets(i8* %6)
%12 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %2)
%13 = load float, float* %2
%14 = fpext float %13 to double
%15 = call double @asin(double %14)
%16 = load double, double* @M_PI
%17 = fdiv double 1.800000e+02, %16
%18 = fmul double %15, %17
%19 = call i32 @putchar(i32 10)
%20 = load i32, i32* %1
%21 = sitofp i32 %20 to double
%22 = call double @sqrt(double %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0), i32 %20, double %22)
%24 = load float, float* %2
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %25, double %18)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), double 0x7FF0000000000000)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double 0xFFF0000000000000)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), double 0x7FF8000000000000)
ret i32 0
}