#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 */
float area_of_circle(float *);
int area_of_square(int *);
int /*<<< orphan*/ flushall();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
main() {
  printf("Area Calculator\n\n");
  int side_square;
  float radius_circle;
  printf("Please enter a number for the length of the side of the square: ");
  scanf("%d", &side_square);
  getchar();
  printf("Please enter a number for the radius of the circle: ");
  scanf("%f", &radius_circle);
  int answer1 = area_of_square(&side_square);
  printf("\Area of the square is %d^2\n", answer1);
  getchar();
  float answer2 = area_of_circle(&radius_circle);
  printf("\Area of the circle is %f^2\n", answer2);
  flushall();
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x4(%rbp),%rdi
call   1080 <area_of_square@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
lea    -0x8(%rbp),%rdi
call   1030 <area_of_circle@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeab(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <flushall@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xf39(%rip),%rdi
call   1030 <puts@plt>
lea    0xe79(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
lea    0x4(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %r14,%rdi
call   1090 <area_of_square@plt>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    %rbx,%rdi
call   1040 <area_of_circle@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <flushall@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Area Calculator\0A\0A\00"
@.str.1 = [65 x i8] c"Please enter a number for the length of the side of the square: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [53 x i8] c"Please enter a number for the radius of the circle: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [28 x i8] c"Area of the square is %d^2\0A\00"
@.str.6 = [28 x i8] c"Area of the circle is %f^2\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (...) @getchar()
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%11 = call i32 @area_of_square(i32* %1)
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %12)
%14 = call i32 (...) @getchar()
%15 = call float @area_of_circle(float* %2)
store float %15, float* %4
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %17)
%19 = call i32 (...) @flushall()
%20 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [65 x i8] c"Please enter a number for the length of the side of the square: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [53 x i8] c"Please enter a number for the radius of the circle: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [28 x i8] c"Area of the square is %d^2\0A\00"
@.str.6 = [28 x i8] c"Area of the circle is %f^2\0A\00"
@str = [17 x i8] c"Area Calculator\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (...) @getchar()
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %2)
%11 = call i32 @area_of_square(i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @getchar()
%14 = call float @area_of_circle(float* %2)
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), double %15)
%17 = call i32 (...) @flushall()
%18 = call i32 (...) @getchar()
ret i32 0
}