#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 */
int /*<<< orphan*/ instruct();
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int sqrt(scalar_t__);
int /*<<< orphan*/ thanks();
int main(void) {
  double height, surface_area, radius1, radius2;
  instruct();
  printf("\n\nEnter the height of the cylinder>\n");
  scanf("%lf", &height);
  printf("Enter the surface area of the cylinder>\n");
  scanf("%lf", &surface_area);
  radius1 = (-2 * 3.1416 * height + sqrt(pow(2 * 3.1416 * height, 2) -
                                         4 * 2 * 3.1416 * (-surface_area))) /
            (2 * 2 * 3.1416);
  radius2 = (-2 * 3.1416 * height - sqrt(pow(2 * 3.1416 * height, 2) -
                                         4 * 2 * 3.1416 * (-surface_area))) /
            (2 * 2 * 3.1416);
  printf("\nThe radius of the cylinder is %.2f or %.2f(negative value not "
         "acceptable)\n",
         radius1, radius2);
  thanks();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <instruct@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe54(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe10(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <sqrt@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movsd  0xde5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdcd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xdca(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1060 <pow@plt>
cvtsi2sd %rax,%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd86(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1070 <sqrt@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd44(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd2c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xd84(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <thanks@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1040 <instruct@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
lea    0xe91(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mulsd  0xe38(%rip),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1070 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  0xe1c(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe02(%rip),%xmm1
addsd  %xmm0,%xmm1
divsd  0xdfe(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0xdcd(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x2,%esi
call   1070 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xdb3(%rip),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1080 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xd92(%rip),%xmm1
subsd  %xmm0,%xmm1
divsd  0xd8e(%rip),%xmm1
lea    0xd93(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1090 <thanks@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"\0A\0AEnter the height of the cylinder>\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [41 x i8] c"Enter the surface area of the cylinder>\0A\00"
@.str.3 = [76 x i8] c"\0AThe radius of the cylinder is %.2f or %.2f(negative value not acceptable)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (...) @instruct()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%11 = load double, double* %2
%12 = load double, double* %2
%13 = fmul double 6.283200e+00, %12
%14 = fptosi double %13 to i32
%15 = call i64 @pow(i32 %14, i32 2)
%16 = sitofp i64 %15 to double
%17 = load double, double* %3
%18 = fneg double %17
%19 = call double @llvm.fmuladd.f64(double -2.513280e+01, double %18, double %16)
%20 = fptosi double %19 to i64
%21 = call i32 @sqrt(i64 %20)
%22 = sitofp i32 %21 to double
%23 = call double @llvm.fmuladd.f64(double -6.283200e+00, double %11, double %22)
%24 = fdiv double %23, 1.256640e+01
store double %24, double* %4
%25 = load double, double* %2
%26 = load double, double* %2
%27 = fmul double 6.283200e+00, %26
%28 = fptosi double %27 to i32
%29 = call i64 @pow(i32 %28, i32 2)
%30 = sitofp i64 %29 to double
%31 = load double, double* %3
%32 = fneg double %31
%33 = call double @llvm.fmuladd.f64(double -2.513280e+01, double %32, double %30)
%34 = fptosi double %33 to i64
%35 = call i32 @sqrt(i64 %34)
%36 = sitofp i32 %35 to double
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double -6.283200e+00, double %25, double %37)
%39 = fdiv double %38, 1.256640e+01
store double %39, double* %5
%40 = load double, double* %4
%41 = load double, double* %5
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), double %40, double %41)
%43 = call i32 (...) @thanks()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.3 = [76 x i8] c"\0AThe radius of the cylinder is %.2f or %.2f(negative value not acceptable)\0A\00"
@str = [36 x i8] c"\0A\0AEnter the height of the cylinder>\00"
@str.4 = [40 x i8] c"Enter the surface area of the cylinder>\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 (...) @instruct()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%10 = load double, double* %1
%11 = fmul double %10, 6.283200e+00
%12 = fptosi double %11 to i32
%13 = call i64 @pow(i32 %12, i32 2)
%14 = sitofp i64 %13 to double
%15 = load double, double* %2
%16 = fneg double %15
%17 = call double @llvm.fmuladd.f64(double %16, double -2.513280e+01, double %14)
%18 = fptosi double %17 to i64
%19 = call i32 @sqrt(i64 %18)
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double %10, double -6.283200e+00, double %20)
%22 = fdiv double %21, 1.256640e+01
%23 = load double, double* %1
%24 = fmul double %23, 6.283200e+00
%25 = fptosi double %24 to i32
%26 = call i64 @pow(i32 %25, i32 2)
%27 = sitofp i64 %26 to double
%28 = load double, double* %2
%29 = fneg double %28
%30 = call double @llvm.fmuladd.f64(double %29, double -2.513280e+01, double %27)
%31 = fptosi double %30 to i64
%32 = call i32 @sqrt(i64 %31)
%33 = sitofp i32 %32 to double
%34 = fneg double %33
%35 = call double @llvm.fmuladd.f64(double %23, double -6.283200e+00, double %34)
%36 = fdiv double %35, 1.256640e+01
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.3, i64 0, i64 0), double %22, double %36)
%38 = call i32 (...) @thanks()
ret i32 0
}