#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
float surface(float);
float volume(float);
int main(int argc, char *argv[]) {
  float r, s, v;
  int wrong;
  do {
    printf("Enter the the raduis for a aphere: ");
    scanf("%f", &r);
    if (r < 0) {
      printf("ERROR ");
      wrong = 1;
    } else {
      wrong = 0;
    }
  } while (wrong);
  v = volume(r);
  s = surface(r);
  printf("The  radius is  %.4f.\n", r);
  printf("The surface area is %.4f and volume is %.4f. \n", s, v);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    119b <main+0x5b>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x20(%rbp)
jmp    11a2 <main+0x62>
movl   $0x0,-0x20(%rbp)
jmp    11a7 <main+0x67>
cmpl   $0x0,-0x20(%rbp)
jne    1156 <main+0x16>
movss  -0x14(%rbp),%xmm0
call   1030 <volume@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
call   1060 <surface@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe46(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jbe    11cd <main+0x8d>
lea    0xea8(%rip),%r14
lea    0xe7a(%rip),%r15
lea    0xe97(%rip),%r12
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
xorps  %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
ucomiss %xmm0,%xmm1
ja     11a0 <main+0x60>
call   1030 <volume@plt>
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm0
call   1060 <surface@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe29(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter the the raduis for a aphere: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c"ERROR \00"
@.str.3 = [23 x i8] c"The radius is %.4f.\0A\00"
@.str.4 = [47 x i8] c"The surface area is %.4f and volume is %.4f. \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %19, %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%13 = load float, float* %6
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %9
br label %18
17: ; preds = %10
store i32 0, i32* %9
br label %18
18: ; preds = %17, %15
br label %19
19: ; preds = %18
%20 = load i32, i32* %9
%21 = icmp ne i32 %20, 0
br i1 %21, label %10, label %22
22: ; preds = %19
%23 = load float, float* %6
%24 = call float @volume(float %23)
store float %24, float* %8
%25 = load float, float* %6
%26 = call float @surface(float %25)
store float %26, float* %7
%27 = load float, float* %6
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %28)
%30 = load float, float* %7
%31 = fpext float %30 to double
%32 = load float, float* %8
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), double %31, double %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter the the raduis for a aphere: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c"ERROR \00"
@.str.3 = [23 x i8] c"The radius is %.4f.\0A\00"
@.str.4 = [47 x i8] c"The surface area is %.4f and volume is %.4f. \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 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* %3)
%7 = load float, float* %3
%8 = fcmp olt float %7, 0.000000e+00
br i1 %8, label %9, label %15
9: ; preds = %2, %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = load float, float* %3
%14 = fcmp olt float %13, 0.000000e+00
br i1 %14, label %9, label %15
15: ; preds = %9, %2
%16 = phi float [ %7, %2 ], [ %13, %9 ]
%17 = call float @volume(float %16)
%18 = load float, float* %3
%19 = call float @surface(float %18)
%20 = load float, float* %3
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), double %21)
%23 = fpext float %19 to double
%24 = fpext float %17 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), double %23, double %24)
ret i32 0
}