#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 perimetrocircunferencia(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int superficie(int);
int superficiedelaesfera(int);
int volesfera(int);
int main() {
  int r = 0;
  printf("Ingresar el radio de un circulo \n");
  scanf("%d", &r);
  while (r < 0) {
    printf("El radio debe ser positivo por favor vuelva a ingresarlo \n");
    scanf("%d", &r);
  }
  printf("La superficie del circulo es: %d \n", superficie(r));
  printf("El perimetro de la circunferencia es: %d \n",
         perimetrocircunferencia(r));
  printf("La superficie de la esfera es: %d \n", superficiedelaesfera(r));
  printf("El volumen de la esfera es: %d \n", volesfera(r));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe97(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11c1 <main+0x61>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
jmp    1194 <main+0x34>
mov    -0x8(%rbp),%edi
call   1040 <superficie@plt>
mov    %eax,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <perimetrocircunferencia@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1080 <superficiedelaesfera@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1070 <volesfera@plt>
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xf0e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
jns    11db <main+0x6b>
lea    0xf0a(%rip),%r14
lea    0xe4c(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
js     11c0 <main+0x50>
call   1050 <superficie@plt>
lea    0xe1c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
call   1040 <perimetrocircunferencia@plt>
lea    0xe26(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
call   1090 <superficiedelaesfera@plt>
lea    0xe38(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
call   1080 <volesfera@plt>
lea    0xe43(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Ingresar el radio de un circulo \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [59 x i8] c"El radio debe ser positivo por favor vuelva a ingresarlo \0A\00"
@.str.3 = [35 x i8] c"La superficie del circulo es: %d \0A\00"
@.str.4 = [43 x i8] c"El perimetro de la circunferencia es: %d \0A\00"
@.str.5 = [36 x i8] c"La superficie de la esfera es: %d \0A\00"
@.str.6 = [33 x i8] c"El volumen de la esfera es: %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 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), i32* %2)
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %5
11: ; preds = %5
%12 = load i32, i32* %2
%13 = call i32 @superficie(i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = call i32 @perimetrocircunferencia(i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = call i32 @superficiedelaesfera(i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %2
%22 = call i32 @volesfera(i32 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [35 x i8] c"La superficie del circulo es: %d \0A\00"
@.str.4 = [43 x i8] c"El perimetro de la circunferencia es: %d \0A\00"
@.str.5 = [36 x i8] c"La superficie de la esfera es: %d \0A\00"
@.str.6 = [33 x i8] c"El volumen de la esfera es: %d \0A\00"
@str = [33 x i8] c"Ingresar el radio de un circulo \00"
@str.7 = [58 x i8] c"El radio debe ser positivo por favor vuelva a ingresarlo \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 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), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0, %7
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.7, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp slt i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %0
%13 = phi i32 [ %5, %0 ], [ %10, %7 ]
%14 = call i32 @superficie(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %1
%17 = call i32 @perimetrocircunferencia(i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
%20 = call i32 @superficiedelaesfera(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %1
%23 = call i32 @volesfera(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i32 %23)
ret i32 0
}