#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 M_PI;
int pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void sphere_surface_area() {
  float r, sa;
  printf("Radius Length: ");
  scanf("%f", &r);
  sa = 4 * M_PI * pow(r, 2);
  printf("Surface area is: %f", sa);
  printf("\n");
}


x86 assembly (clang, -O0):
<sphere_surface_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
mov    %eax,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphere_surface_area>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%ebx
movss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
imul   %ebx,%eax
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe7b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Radius Length: \00"
@.str.1 = [3 x i8] c"%f\00"
@M_PI = global i32 0
@.str.2 = [20 x i8] c"Surface area is: %f\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @sphere_surface_area() {
%1 = alloca float
%2 = alloca float
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 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 i32, i32* @M_PI
%6 = mul nsw i32 4, %5
%7 = load float, float* %1
%8 = call i32 @pow(float %7, i32 2)
%9 = mul nsw i32 %6, %8
%10 = sitofp i32 %9 to float
store float %10, float* %2
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Radius Length: \00"
@.str.1 = [3 x i8] c"%f\00"
@M_PI = global i32 0
@.str.2 = [20 x i8] c"Surface area is: %f\00"
define void @sphere_surface_area() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 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 i32, i32* @M_PI
%6 = shl nsw i32 %5, 2
%7 = load float, float* %1
%8 = call i32 @pow(float %7, i32 2)
%9 = mul nsw i32 %6, %8
%10 = sitofp i32 %9 to float
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %11)
%13 = call i32 @putchar(i32 10)
ret void
}